re-enable JIT for ZTS builds on Apple Silicon#22712
Open
realFlowControl wants to merge 3 commits into
Open
Conversation
Contributor
|
I don't know if this was in response to my mail, but thank you 😄 |
Contributor
Author
Actually yes, haha. I knew that this should work, I just was not working on it and then reading your mail reminded me of it 👍 |
arnaud-lb
reviewed
Jul 13, 2026
Comment on lines
+3800
to
+3801
| buf = mmap(NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, | ||
| MAP_PRIVATE | MAP_ANON | MAP_JIT, -1, 0); |
Member
There was a problem hiding this comment.
Could you clarify if MAP_JIT can be used freely without an com.apple.security.cs.allow-jit entitlement?
Member
There was a problem hiding this comment.
The com.apple.security.cs.allow-jit entitlement is required only when an app adopts the Hardened Runtime capability.
i.e. it's not relevant to non-app store executables.
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.
Fixes #13400
For
__APPLE__ && __aarch64__ && ZTS, this PR moves the JIT buffer out of the OPcache shared memory and creates a dedicated mapping.Background
OPcache JIT is currently disabled for ZTS builds on Apple Silicon. The JIT buffer normally lives at the end of OPcache's
MAP_SHARED | MAP_ANONallocation. In ZTS, one thread may generate code while another executes existing code, so the buffer must remain executable while it is writable.Apple Silicon rejects RWX anonymous mappings with
EPERM. Apple's supported solution isMAP_JITwithpthread_jit_write_protect_np(), which provides per-thread write protection, but macOS rejectsMAP_JIT | MAP_SHAREDwithEINVAL. The existing combined OPcache/JIT mapping won't work on Apple Silicon.