Skip to content

Commit f7a28c4

Browse files
committed
Merge branch 'PHP-8.2'
2 parents ff42cb0 + 381d0dd commit f7a28c4

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,13 @@ static void zend_jit_trace_add_code(const void *start, uint32_t size)
247247
t->code_size = size;
248248
}
249249

250+
/**
251+
* Locate a trace in the #zend_jit_traces array with the specified
252+
* #code_start address.
253+
*
254+
* @return the #zend_jit_traces index or 0 if no such #code_start
255+
* address was found
256+
*/
250257
static uint32_t zend_jit_find_trace(const void *addr)
251258
{
252259
uint32_t i;
@@ -256,7 +263,6 @@ static uint32_t zend_jit_find_trace(const void *addr)
256263
return i;
257264
}
258265
}
259-
ZEND_UNREACHABLE();
260266
return 0;
261267
}
262268

@@ -6832,6 +6838,15 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
68326838
const void *timeout_exit_addr = NULL;
68336839

68346840
t->link = zend_jit_find_trace(p->opline->handler);
6841+
if (t->link == 0) {
6842+
/* this can happen if ZEND_JIT_EXIT_INVALIDATE was handled
6843+
* by zend_jit_trace_exit() in another thread after this
6844+
* thread set ZEND_JIT_TRACE_STOP_LINK in zend_jit_trace_execute();
6845+
* ZEND_JIT_EXIT_INVALIDATE resets the opline handler to one of
6846+
* the "_counter_handler" functions, and these are not registered
6847+
* tracer functions */
6848+
goto jit_failure;
6849+
}
68356850
if ((zend_jit_traces[t->link].flags & ZEND_JIT_TRACE_USES_INITIAL_IP)
68366851
&& !zend_jit_set_ip(&dasm_state, p->opline)) {
68376852
goto jit_failure;

0 commit comments

Comments
 (0)