-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add exec
option to mmap
#53463
base: master
Are you sure you want to change the base?
Add exec
option to mmap
#53463
Conversation
Most CPUs define that it is UB to execute code immediately after writing to the memory. They usually require some sort of flush, fence, and icache invalidation calls before that is legal |
TODO:
|
Regarding windows failures: Instead, I was thinking about limiting the Need to dust off my windows VM to see if I can implement that locally. |
Regarding macOS failures:
|
I would like to note that WX permissions could be restricted |
I updated the PR description and I think this is no longer an issue, because we only implement |
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
mmap(exec=true)
should allow one to generate a buffer that is writeable and (with enough precautions taken) can be executed.We only implement
exec=true
for non-file-backedmmap
, in which we request a new file handle from the OS, as otherwise we would have to adjust permissions on whatever file handle we received, which might not be possible in all cases.MWE. Don't try this at home
buf
is markedconst
orbuf
initialization is moved intomyidentity
?