RESOLVED FIXED274805
[JSC] Add optional mprotect mode for executable memory on Intel
https://bugs.webkit.org/show_bug.cgi?id=274805
Summary [JSC] Add optional mprotect mode for executable memory on Intel
David Degazio
Reported 2024-05-28 15:37:16 PDT
rdar://128901530 We currently don't rely on OS memory protections on Intel platforms for the executable region, since the performance cost of re-protecting the this region for every modification is too steep. But in the absence of that, it's possible bugs can clobber executable memory without any real signs of failure until if/when the clobbered code gets executed. Let's at least have a build-time option to, at some cost (expecting on the order of 10-30% regressed with the current non-invasive approach, maybe this can be improved?), use mprotect() to protect pages in the executable memory region whenever we start or finish writing to them. This should turn any illegal writes to these pages outside of critical sections in the LinkBuffer or performJITMemcpy into traps, making it easier to find executable memory corruption bugs - like an executable memory sanitizer.
Attachments
David Degazio
Comment 1 2024-05-28 16:00:43 PDT
EWS
Comment 2 2024-05-29 12:27:25 PDT
Committed 279455@main (3d6a7300a281): <https://commits.webkit.org/279455@main> Reviewed commits have been landed. Closing PR #29198 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.