[php-src] Issue #20562: segfault in jit

From: Date: Sat, 22 Nov 2025 14:41:00 +0000
Subject: [php-src] Issue #20562: segfault in jit
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251278@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/20562 Author: chongwick ### Description The following code: ```php <?php $v_8538 = '*** Testing nl2br() : usage variations ***\n'; $v_8540 = 'Hello\nWorld'; $v_8549 = 1; $v_8553 = nl2br($v_8549,); $v_8542 = 'Hello\rWorld'; $v_8543 = '\rHello\rWorld\r'; $v_8554 = var_dump($v_8553,); $v_8546 = '\n'; $v_8547 = '\n\n'; $v_3497 = 'B'; $v_8539 = array(0 => $v_8540,1 => $v_8553,2 => $v_8542,3 => $v_8543,4 => $v_8554,5 => $v_8546,6 => $v_8546,7 => $v_8547,8 => $v_3497,); foreach ($v_8539 as $str){ $v_8551 = $str; $v_8552 = "-- Iteration $v_8549 --\n"; $v_8555 = $v_8542; $v_8555++; $v_9126 = SampleFilter::class; $v_9127 = class_exists($v_9126,); $v_9128 = !($v_9127); if($v_9128){ $v_9129 = 'sample.filter'; $v_9130 = SampleFilter::class; $v_9131 = stream_filter_register($v_9129,$v_9130,); $v_9132 = 'php://filter/read=sample.filter/resource='; $v_9133 = __FILE__; $v_9134 = $v_9132 . $v_9133; } } ``` Resulted in this output: ``` string(1) "1" AddressSanitizer:DEADLYSIGNAL ================================================================= ==3870223==ERROR: AddressSanitizer: SEGV on unknown address 0x6206bec69338 (pc 0x0000028a3b61 bp 0x7ffea2e64030 sp 0x7ffea2e63e10 T0) ==3870223==The signal is caused by a READ memory access. #0 0x28a3b61 in ir_gcm_find_lca /home/w023dtc/nightly_php/php-src/ext/opcache/jit/ir/ir_gcm.c:67:29 #1 0x2877eb3 in ir_gcm_schedule_late /home/w023dtc/nightly_php/php-src/ext/opcache/jit/ir/ir_gcm.c:525:23 #2 0x2872a88 in ir_gcm /home/w023dtc/nightly_php/php-src/ext/opcache/jit/ir/ir_gcm.c:715:4 #3 0x316b81d in zend_jit_ir_compile /home/w023dtc/nightly_php/php-src/ext/opcache/jit/zend_jit_ir.c:2893:2 #4 0x3006fa4 in zend_jit_finish /home/w023dtc/nightly_php/php-src/ext/opcache/jit/zend_jit_ir.c:16744:10 #5 0x2e3fda7 in zend_jit_trace /home/w023dtc/nightly_php/php-src/ext/opcache/jit/zend_jit_trace.c:7317:12 #6 0x2c00929 in zend_jit_compile_root_trace /home/w023dtc/nightly_php/php-src/ext/opcache/jit/zend_jit_trace.c:7532:14 #7 0x2bf2bf0 in zend_jit_trace_hot_root /home/w023dtc/nightly_php/php-src/ext/opcache/jit/zend_jit_trace.c:8226:10 #8 0x2bb88b3 in zend_jit_trace_counter_helper /home/w023dtc/nightly_php/php-src/ext/opcache/jit/zend_jit_vm_helpers.c:472:7 #9 0x2bb814a in zend_jit_func_trace_helper /home/w023dtc/nightly_php/php-src/ext/opcache/jit/zend_jit_vm_helpers.c:508:2 #10 0x5c35aab in execute_ex /home/w023dtc/nightly_php/php-src/Zend/zend_vm_execute.h:116212:12 #11 0x5c3803c in zend_execute /home/w023dtc/nightly_php/php-src/Zend/zend_vm_execute.h:121924:2 #12 0x69c92c9 in zend_execute_script /home/w023dtc/nightly_php/php-src/Zend/zend.c:1975:3 #13 0x5195b9a in php_execute_script_ex /home/w023dtc/nightly_php/php-src/main/main.c:2645:13 #14 0x5196cd8 in php_execute_script /home/w023dtc/nightly_php/php-src/main/main.c:2685:9 #15 0x69de1da in do_cli /home/w023dtc/nightly_php/php-src/sapi/cli/php_cli.c:951:5 #16 0x69d85bf in main /home/w023dtc/nightly_php/php-src/sapi/cli/php_cli.c:1362:18 #17 0x147c69cc1d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 #18 0x147c69cc1e3f in __libc_start_main csu/../csu/libc-start.c:392:3 #19 0x607af4 in _start (/home/w023dtc/nightly_php/php-src/sapi/cli/php+0x607af4) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/w023dtc/nightly_php/php-src/ext/opcache/jit/ir/ir_gcm.c:67:29 in ir_gcm_find_lca ==3870223==ABORTING ``` ``` USE_ZEND_ALLOC=0 php-d "memory_limit = -1" -d "zend.assertions = 1" -d "display_errors = On" -d "display_startup_errors = On" -d "opcache.memory_consumption=4096M" -d "opcache.enable=1" -d "opcache.enable_cli=1" -d "opcache.jit=tracing" -d "opcache.validate_timestamps=0" -d "opcache.jit_buffer_size=128M" -d "opcache.file_update_protection=0" -d "opcache.max_accelerated_files=1000000" -d "opcache.interned_strings_buffer=64" -d "opcache.jit_prof_threshold=0.000000001" -d "opcache.jit_max_root_traces= 100000" -d "opcache.jit_max_side_traces= 100000" -d "opcache.jit_max_exit_counters=100000" -d "opcache.jit_hot_loop=1" -d "opcache.jit_hot_func=1" -d "opcache.jit_hot_return=1" -d "opcache.jit_hot_side_exit=1" -d "opcache.jit_blacklist_root_trace=255" -d "opcache.jit_blacklist_side_trace=255" -d "opcache.protect_memory=1" script.php ``` ### PHP Version ```plain nightly ``` ### Operating System 22.04

« previous php.bugs (#251278) next »