[macOS 10.14] Use MAP_JIT for all executable JIT pages for 10.14 Enhanced Runtime
Categories
(Core :: JavaScript Engine: JIT, enhancement, P3)
Tracking
()
People
(Reporter: haik, Assigned: jandem)
References
(Blocks 2 open bugs)
Details
(Keywords: sec-want, Whiteboard: [adv-main123-])
Attachments
(1 file)
| Reporter | ||
Updated•7 years ago
|
Comment 1•7 years ago
|
||
Comment 2•7 years ago
|
||
| Reporter | ||
Comment 3•7 years ago
|
||
| Reporter | ||
Comment 4•7 years ago
|
||
| Reporter | ||
Updated•7 years ago
|
| Reporter | ||
Comment 5•6 years ago
|
||
(In reply to Haik Aftandilian [:haik] from comment #3)
(In reply to Nicolas B. Pierron [:nbp] {backlog: 39} from comment #1)
What is the deadline for 10.14 release?
We don't have a specific deadline for this work. Before we can adopt
Enhanced Runtime (and then consider using MAP_JIT), we have to build Firefox
with the 10.14 SDK and we haven't prioritized that work yet.
That was incorrect. Building with the 10.14 SDK is not required to enable Hardened Runtime (aka Enhanced Runtime.) It does require running the codesign command on 10.13.6 or newer, but that's a build/releng issue.
| Assignee | ||
Comment 6•4 years ago
|
||
I looked into this a bit today. I think we could make this work with a number of changes to the JIT code allocator, but when I tried to switch from com.apple.security.cs.allow-unsigned-executable-memory = true to com.apple.security.cs.allow-jit = true I ran into issues with the IOInterposer patching binary code, so turning off allow-unsigned-executable-memory will require more work...
Updated•3 years ago
|
| Assignee | ||
Comment 7•2 years ago
|
||
Bug 1837194 is doing this for Apple Silicon hardware for performance reasons. We could probably also fix this for Intel machines now. It depends a bit on which operations the kernel allows there for MAP_JIT pages.
| Assignee | ||
Comment 8•1 year ago
|
||
The Apple Silicon MAP_JIT changes have stuck and I think it's worth trying to do the same for Intel Macs now. It also helps that we no longer support macOS <= 10.14 since Firefox 115 because older versions didn't support MAP_JIT (or it didn't work the same way).
This will potentially let us remove the allow-unsigned-executable-memory entitlement. The IOInterposer probably also requires it, but that isn't enabled on release AFAICT so if there's no other blocker we could at least improve the situation for the release channel.
| Assignee | ||
Comment 9•1 year ago
|
||
We've been using MAP_JIT on Apple Silicon since bug 1837194.
With this change we no longer need the com.apple.security.cs.allow-unsigned-executable-memory
entitlement for the JITs (pre-release Firefox still needs it for the IOInterposer
on Intel).
Support for MAP_JIT is enabled by the separate com.apple.security.cs.allow-jit entitlement.
Intel Macs don't have the pthread_jit_write_protect_np API, so we use a similar
strategy as on Apple Silicon but with mprotect added to it.
Updated•1 year ago
|
| Assignee | ||
Comment 10•1 year ago
|
||
With this patch + setting MOZ_DISABLE_POISON_IO_INTERPOSER=1 I can start a codesigned Firefox build without the allow-unsigned-executable-memory entitlement on my Intel MBP \o/
| Reporter | ||
Comment 11•1 year ago
•
|
||
(In reply to Jan de Mooij [:jandem] from comment #10)
With this patch + setting
MOZ_DISABLE_POISON_IO_INTERPOSER=1I can start a codesigned Firefox build without theallow-unsigned-executable-memoryentitlement on my Intel MBP \o/
Awesome! Could the Interposer be changed to use MAP_JIT too?
| Assignee | ||
Comment 12•1 year ago
|
||
(In reply to Haik Aftandilian [:haik] from comment #11)
Awesome! Could the Interposer be changed to use MAP_JIT too?
I'm not very familiar with it, but I think it works by patching code. MAP_JIT doesn't really work for that use case because the code is already allocated and mapped, we just need to make it writable.
Comment 13•1 year ago
|
||
Comment 14•1 year ago
|
||
| bugherder | ||
Updated•1 year ago
|
Updated•1 year ago
|
Description
•