Skip to content

Commit 350af54

Browse files
authored
Fix GH-14475: PHP 8.3.7 with JIT encounters infinite loop on specific paths (#14558)
1 parent df219cc commit 350af54

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
@@ -8308,7 +8308,20 @@ int ZEND_FASTCALL zend_jit_trace_exit(uint32_t exit_num, zend_jit_registers_buf
83088308
if (!(ZEND_OP_TRACE_INFO(t->opline, jit_extension->offset)->trace_flags & (ZEND_JIT_TRACE_JITED|ZEND_JIT_TRACE_BLACKLISTED))) {
83098309
/* skip: not JIT-ed nor blacklisted */
83108310
} else if (ZEND_JIT_TRACE_NUM >= JIT_G(max_root_traces)) {
8311-
/* skip: too many root traces */
8311+
/* too many root traces, blacklist the root trace */
8312+
if (!(ZEND_OP_TRACE_INFO(t->opline, jit_extension->offset)->trace_flags & ZEND_JIT_TRACE_BLACKLISTED)) {
8313+
SHM_UNPROTECT();
8314+
zend_jit_unprotect();
8315+
8316+
((zend_op*)opline)->handler =
8317+
ZEND_OP_TRACE_INFO(t->opline, jit_extension->offset)->orig_handler;
8318+
8319+
ZEND_OP_TRACE_INFO(t->opline, jit_extension->offset)->trace_flags &= ~ZEND_JIT_TRACE_JITED;
8320+
ZEND_OP_TRACE_INFO(t->opline, jit_extension->offset)->trace_flags |= ZEND_JIT_TRACE_BLACKLISTED;
8321+
8322+
zend_jit_protect();
8323+
SHM_PROTECT();
8324+
}
83128325
} else {
83138326
SHM_UNPROTECT();
83148327
zend_jit_unprotect();

0 commit comments

Comments
 (0)