Fix #81679: Tracing JIT crashes on reattaching #7776
Closed
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.
When a new process reattaches to OPcache, tracing JIT causes segfaults,
because each new process allocates its own
zend_jit_traces
andzend_jit_exit_groups
in SHM, although these need to be shared betweenall processes.
We solve that by only allocating these structs for the first process,
and store the pointers in
accel_shared_globals
, so we can reassignthem when a new process reattaches.
Well, this is more like a request for help than an actual pull request:
accel_shared_globals
seems viable, but there is likely a better solution. Anyway, thevoid *jit_traces
should get the proper type.JIT_G(exit_counters)
is still allocated in process memory?@dstogov, you may want to have a look at this. As is, tracing JIT apparently can't work in "reattaching environments" (i.e. most Windows stacks, except for Apache mpm_winnt). An alternative solution to let
zend_jit_startup()
fail when reattaching, won't work, since the OPcode JIT handlers are still going to be executed.