Fix GH-21006: JIT SEGV with FETCH_OBJ_FUNC_ARG and property hooks#21369
Open
iliaal wants to merge 1 commit intophp:masterfrom
Open
Fix GH-21006: JIT SEGV with FETCH_OBJ_FUNC_ARG and property hooks#21369iliaal wants to merge 1 commit intophp:masterfrom
iliaal wants to merge 1 commit intophp:masterfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FETCH_OBJ_FUNC_ARG(orFETCH_OBJ_R), the handler may find theSIMPLE_GETflag set in the runtime cache for a hooked property. This causes it to push a call frame for the hook function, changingexecute_data. When the trace resumes, it continues with the wrongexecute_data, leading to a segfault.zend_jit_trace_handler()to clear theSIMPLE_GETflag before calling the VM handler, so it falls through toread_propertyinstead.Closes GH-21006