Fix JIT vm_interrupt#21910
Merged
morrisonlevi merged 4 commits intophp:PHP-8.4from Apr 30, 2026
Merged
Conversation
dstogov
approved these changes
Apr 29, 2026
Member
dstogov
left a comment
There was a problem hiding this comment.
This doesn't affect PHP without observer.
So I don't object.
Merge this, if you are sure.
e28cf6a to
b25704e
Compare
b25704e to
4e778d6
Compare
Contributor
Author
|
I've done some extra testing. Although I am not too experienced with JIT stuff, I don't seem to have caused any regressions and did fix this new test case, so I will merge. |
morrisonlevi
added a commit
that referenced
this pull request
Apr 30, 2026
# Via GitHub * PHP-8.4: Fix JIT vm_interrupt (#21910) # Conflicts: # ext/opcache/jit/zend_jit_ir.c
morrisonlevi
added a commit
that referenced
this pull request
Apr 30, 2026
* PHP-8.5: Fix JIT vm_interrupt (#21910)
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.
We've been observing crashes in our customers' applications at Datadog for months with no clear sign of what is wrong directly from the call stacks. Yesterday we finally got a key insight: it's an interaction with the tracing JIT and VM interrupt. When the interrupt fires, the JIT returns to the VM with a stale caller opline installed on the active callee execute_data, so the interpreter resumes the caller’s call opcode against the wrong frame. It can happen on both x86_64 and aarch64.
The tell-tale sign was that the interpreter was executing one of the fcall family of opcodes where
EX(call)is unexpectedly NULL, and this JIT path was the only way that could happen.This PR contains a reproducer for the issue. It modifies zend_test to set an interrupt function from an observer_begin hoo; this is not strictly necessary, this is just the most reliable way I could make the needed timing to trigger. I've made a
jit.Dockerfileto accompany it:Dockerfile for reproducing the JIT issue
As for the fix itself... I'm less confident in it. Please review it carefully as JIT code can be tricky and I had an AI agent help me with it. I'm targeting 8.4 with this PR.