JIT: SEGV in exception handler stub after OOM inside an output-buffer callback

未关闭
#25,304 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
c, php
领域
backend

调研方向

Start by reproducing the crash with the supplied PHP script and CLI command, with JIT tracing enabled and a 16M memory limit. Then trace the exception handler stub reached after the output-buffer callback runs out of memory. Done when the reproducer no longer crashes and a regression test covers the failure.

由索引模型根据 Issue 内容生成。

描述

Bug Status: Needs Triage
Description

The following code:

<?php
$o = new stdClass;
ob_start(function ($buffer) use (&$storage) {
    $storage .= $buffer;
    return '';
}, 1);
while ($o < 10);

Resulted in this output:

==3128836==ERROR: AddressSanitizer: SEGV on unknown address 0x00000000001f (pc 0x0000484f1049 bp 0x7ffeced13390 sp 0x7ffeced132b0 T0)
==3128836==The signal is caused by a READ memory access.
==3128836==Hint: address points to the zero page.
    #0 0x484f1049  (/dev/zero (deleted)+0x8000049)

SUMMARY: AddressSanitizer: SEGV (/dev/zero (deleted)+0x8000049) 

To reproduce: USE_ZEND_ALLOC=1 ./sapi/cli/php -d memory_limit=16M -d opcache.enable_cli=1 -d opcache.jit=tracing -d opcache.jit_buffer_size=64M -d opcache.file_update_protection=0 test.php

Commit:

33a61f765a94e018a8d55d962a73e8c8331ee256

Configurations:

CC="clang-12" CXX="clang++-12" CFLAGS="-DZEND_VERIFY_TYPE_INFERENCE" CXXFLAGS="-DZEND_VERIFY_TYPE_INFERENCE" ./configure --enable-debug --enable-address-sanitizer --enable-undefined-sanitizer --enable-re2c-cgoto --enable-zts --enable-bcmath --enable-calendar --enable-dba --enable-dl-test --enable-exif --enable-ftp --enable-gd --enable-gd-jis-conv --enable-mbstring --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvmsg --enable-zend-test --with-zlib --with-bz2 --with-curl --with-enchant --with-gettext --with-gmp --with-mhash --with-ldap --with-libedit --with-readline --with-snmp --with-sodium --with-xsl --with-zip --with-mysqli --with-pdo-mysql --with-pdo-pgsql --with-pgsql --with-sqlite3 --with-pdo-sqlite --with-webp --with-jpeg --with-freetype --enable-sigchild --with-pcre-jit --with-iconv

Operating System:

Ubuntu 20.04 Host, Docker 0599jiangyc/flowfusion:latest

This report is automatically generated by FlowFusion

PHP Version
nightly
Operating System

No response

主要语言
C
星标
41.8k
派生
8.5k
平均合并
2 天 12 小时
30 天内合并 PR
137

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

php/php-src 的其他 Issue

查看 php/php-src 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。