Skip to content

Commit e842ddf

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix GH-14475: PHP 8.3.7 with JIT encounters infinite loop on specific paths (#14558)
2 parents e9b3643 + 350af54 commit e842ddf

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8329,7 +8329,20 @@ int ZEND_FASTCALL zend_jit_trace_exit(uint32_t exit_num, zend_jit_registers_buf
83298329
if (!(ZEND_OP_TRACE_INFO(t->opline, jit_extension->offset)->trace_flags & (ZEND_JIT_TRACE_JITED|ZEND_JIT_TRACE_BLACKLISTED))) {
83308330
/* skip: not JIT-ed nor blacklisted */
83318331
} else if (ZEND_JIT_TRACE_NUM >= JIT_G(max_root_traces)) {
8332-
/* skip: too many root traces */
8332+
/* too many root traces, blacklist the root trace */
8333+
if (!(ZEND_OP_TRACE_INFO(t->opline, jit_extension->offset)->trace_flags & ZEND_JIT_TRACE_BLACKLISTED)) {
8334+
SHM_UNPROTECT();
8335+
zend_jit_unprotect();
8336+
8337+
((zend_op*)opline)->handler =
8338+
ZEND_OP_TRACE_INFO(t->opline, jit_extension->offset)->orig_handler;
8339+
8340+
ZEND_OP_TRACE_INFO(t->opline, jit_extension->offset)->trace_flags &= ~ZEND_JIT_TRACE_JITED;
8341+
ZEND_OP_TRACE_INFO(t->opline, jit_extension->offset)->trace_flags |= ZEND_JIT_TRACE_BLACKLISTED;
8342+
8343+
zend_jit_protect();
8344+
SHM_PROTECT();
8345+
}
83338346
} else {
83348347
SHM_UNPROTECT();
83358348
zend_jit_unprotect();

0 commit comments

Comments
 (0)