Skip to content

Fix GH-21006: JIT SEGV with FETCH_OBJ_FUNC_ARG and property hooks#21369

Open
iliaal wants to merge 1 commit intophp:masterfrom
iliaal:fix/gh-21006-jit-fetch-obj-func-arg-segv
Open

Fix GH-21006: JIT SEGV with FETCH_OBJ_FUNC_ARG and property hooks#21369
iliaal wants to merge 1 commit intophp:masterfrom
iliaal:fix/gh-21006-jit-fetch-obj-func-arg-segv

Conversation

@iliaal
Copy link
Contributor

@iliaal iliaal commented Mar 7, 2026

Summary

  • When JIT falls back to the VM handler for FETCH_OBJ_FUNC_ARG (or FETCH_OBJ_R), the handler may find the SIMPLE_GET flag set in the runtime cache for a hooked property. This causes it to push a call frame for the hook function, changing execute_data. When the trace resumes, it continues with the wrong execute_data, leading to a segfault.
  • Fix: emit IR code in zend_jit_trace_handler() to clear the SIMPLE_GET flag before calling the VM handler, so it falls through to read_property instead.

Closes GH-21006

When the JIT falls back to the VM handler for FETCH_OBJ_FUNC_ARG (or
FETCH_OBJ_R), the handler may find the SIMPLE_GET flag set in the
runtime cache for a hooked property. This causes it to push a call
frame for the hook function, changing execute_data. When the trace
resumes after the handler returns, it continues with the wrong
execute_data, leading to a segfault on the next opcode that accesses
EX(call).

Fix by emitting IR code in zend_jit_trace_handler() to clear the
SIMPLE_GET flag in the runtime cache before calling the VM handler,
so it falls through to read_property instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JIT has wrong expectations for ZEND_FETCH_OBJ_FUNC_ARG when the prop is hooked

1 participant