Skip to content

Commit 9d07f5a

Browse files
committed
Fix invalid target opline with jit->reuse_ip active
When the JIT jumps out of tracing while reuse_ip is set, it will jump directly to the reused pointer, which might be e.g. EX(call) instead of EX(opline). Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
1 parent 253f4af commit 9d07f5a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

ext/opcache/jit/zend_jit_ir.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16811,6 +16811,9 @@ static int zend_jit_trace_end_loop(zend_jit_ctx *jit, int loop_ref, const void *
1681116811

1681216812
static int zend_jit_trace_return(zend_jit_ctx *jit, bool original_handler, const zend_op *opline)
1681316813
{
16814+
if (!original_handler) {
16815+
zend_jit_set_ip(jit, opline);
16816+
}
1681416817
if (GCC_GLOBAL_REGS) {
1681516818
if (!original_handler) {
1681616819
ir_TAILCALL(IR_VOID, ir_LOAD_A(jit_IP(jit)));

ext/opcache/jit/zend_jit_trace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7225,10 +7225,10 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
72257225
}
72267226
zend_jit_trace_link_to_root(&ctx, &zend_jit_traces[t->link], timeout_exit_addr);
72277227
} else {
7228-
zend_jit_trace_return(&ctx, 0, NULL);
7228+
zend_jit_trace_return(&ctx, 0, p->opline);
72297229
}
72307230
} else if (p->stop == ZEND_JIT_TRACE_STOP_RETURN) {
7231-
zend_jit_trace_return(&ctx, 0, NULL);
7231+
zend_jit_trace_return(&ctx, 0, p->opline);
72327232
} else {
72337233
// TODO: not implemented ???
72347234
ZEND_ASSERT(0 && p->stop);

0 commit comments

Comments
 (0)