Support MAP_JIT with pthread_jit_write_protect_np on Apple Silicon
Categories
(Core :: JavaScript Engine: JIT, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox116 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
Details
(Whiteboard: [sp3])
Attachments
(2 files)
|
Bug 1837194 - Use MAP_JIT with pthread_jit_write_protect_np on Apple Silicon. r?nbp!,mstange!,rhunt!
48 bytes,
text/x-phabricator-request
|
Details | |
|
48 bytes,
text/x-phabricator-request
|
Details |
See bug 1835876 comment 5. We can't do RWX on this platform, so we need to use Apple's thread-local permission switching APIs. I have a prototype of this working locally for the JS JITs.
| Assignee | ||
Comment 1•2 years ago
|
||
On Mac ARM64 hardware we still use mprotect and W^X because supporting RWX pages
requires additional changes. This patch makes those changes.
With Apple's fast thread-local writable/executable toggling API for all JIT pages
(pthread_jit_write_protect_np) this is a much more efficient version of W^X.
Using MAP_JIT requires some changes to how we reserve and commit JIT pages because
of additional restrictions the kernel enforces for these regions.
| Assignee | ||
Comment 2•2 years ago
|
||
Now that we're using MAP_JIT on Apple Silicon we should also use the allow-jit
entitlement.
The weaker allow-unsigned-executable-memory entitlement is still needed for the Intel
hardware where we don't use MAP_JIT yet. We'll probably be able to use MAP_JIT there
too at some point, but for now this is a step in the right direction.
Depends on D180407
Comment 4•2 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/fa183f58a682
https://hg.mozilla.org/mozilla-central/rev/1dc3aecfed3a
Updated•2 years ago
|
Updated•2 years ago
|
Description
•