From 061b46e09d9485f134427b55d3efb2e257bd6d97 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Wed, 9 Apr 2025 16:31:48 +0200 Subject: [PATCH] Save opline in zend_jit_hot_func() Closes GH-18289 --- NEWS | 1 + ext/opcache/jit/zend_jit.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/NEWS b/NEWS index 5912cde4fa6..582efbc598c 100644 --- a/NEWS +++ b/NEWS @@ -33,6 +33,7 @@ PHP NEWS - Opcache: . Fixed bug GH-18294 (assertion failure zend_jit_ir.c). (nielsdos) + . Fixed bug GH-18289 (Fix segfault in JIT). (Florian Engelhardt) - OpenSSL: . Fix memory leak in openssl_sign() when passing invalid algorithm. diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index 2d4ef0bf4fc..e477cbdb562 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -3033,6 +3033,10 @@ void ZEND_FASTCALL zend_jit_hot_func(zend_execute_data *execute_data, const zend op_array->opcodes[i].handler = jit_extension->orig_handlers[i]; } +#ifdef HAVE_GCC_GLOBAL_REGS + EX(opline) = opline; +#endif + /* perform real JIT for this function */ zend_real_jit_func(op_array, NULL, opline, ZEND_JIT_ON_HOT_COUNTERS); } zend_catch {