Repository navigation
Fix GH-25220: Clear leftover func_info after JIT setup failure - #25224
Open
rafamolina1 wants to merge 1 commit into
Open
rafamolina1 wants to merge 1 commit into
rafamolina1 wants to merge 1 commit into
Conversation
When hot-counter JIT setup runs out of shared memory mid-script, the remaining op_arrays kept pointers into the released call-graph arena. Clear those FUNC_INFO slots on the delayed-trigger jit_failure path.
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
zend_jit_script()builds the call graph inCG(arena)and stores thosefunc_infopointers on every op_array. For delayed JIT triggers (hot counters, first-exec, etc.) it then allocatesjit_extensionfrom shared memory, whichzend_accel_script_persist_calc()does not reserve.jit_failurereleased the arena without clearing the remainingFUNC_INFOslots. A later hot compile of a successfully-setup function then reads a callee's stalefunc_infoand segfaults in type inference orzend_jit_cleanup_func_info().FUNC_INFOfrom the failed index onward on the non-SCRIPT_LOADfailure path so leftover op_arrays no longer point into the freed arena.Fixes GH-25220
Test plan
opcache.jit=1235, 8M SHM, 150 classes of 50 methods) segfaults on unpatched PHP 8.5.4 (rc=139)make test TESTS=ext/opcache/tests/jit/gh25220.phptPASSes on the patched build