-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Fix segfault in JIT #18289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix segfault in JIT #18289
Conversation
9e6b036
to
ce29717
Compare
ce29717
to
abac1f6
Compare
Hi, can you demonstrate the problem with a test case? |
No easy reproducer at this time. The issue is happening with Datadog's allocation profiler. We're working on verifying the issue manually with the customer which hit the issue. The rough idea at this time: if this path is taken, and allocations start happening then the profiler may gather a sample. Then we read a bad opline when walking the stack and collecting file and line information. |
@arnaud-lb doesn't this look similar to the problem you are fixing in #18297 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dstogov I think this is a different issue.
This looks similar the classic issue where emitting an error from the allocator crashes because EX(opline)
is not initialized (we crash when fetching the file/line for the error message). The usual fix is to save opline in op handlers that may allocate.
In this case the op handler is zend_jit_func_counter_helper()
or zend_jit_loop_counter_helper()
, which call zend_jit_hot_func()
, so saving opline there seems fine.
For zend_jit_trace_counter_helper()
we save in zend_jit_trace_hot_root()
(here).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. You convinced me. Approved.
Thank you @realFlowControl! |
This PR saves the opline, as otherwise it can be a dangling pointer