-
Notifications
You must be signed in to change notification settings - Fork 202
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
Extend wasi-emulated-mman with mprotect
#500
Conversation
b55e3e8
to
562e7cc
Compare
This implementation never changes actual memory protection, but it does verify that the address range and flags are valid. The direct motivation is fixing a linker error where LLVM links to `mprotect` in dead code.
Would it make sense if patch LLVM to honor some kind of HAVE_MPROTECT instead/also? |
That's what I've been doing so far, but: a) There is pushback against adding more compiletests, as they are slow and some find them hard to maintain. |
Do they need to be compiletests? Can't it just be something that is hardcoded into the CMakeLists on the LLVM side? something like:
Fair enough, I agree it makes sense to emulate all these mman symbols. However I do think it would be better for llvm to not include the dead code that calls mmap/mprotect at all. It seems like a good in general. Perhaps we can do both things? |
Maybe, but I still don't understand exactly what changes to
It looks like there's currently no way to disable the JIT (which is a little odd to me), which is what probably needs to be done for this. LTO builds don't suffer from this problem, so the code is already statically dead, just not dead enough for non-LTO builds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Thanks! |
This implementation never changes actual memory protection, but it does verify that the address range and flags are valid. The direct motivation is fixing a linker error where LLVM links to
mprotect
in dead code.