-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Always use mmap instead of posix_memalign in cranelift-jit #4986
Comments
It's I think the reason was that |
Maybe we could make a simple memory allocator ourself? Unlike system allocators it doesn't have to deal with tiny allocations or allocations of fixed sizes, so complexity from that doesn't have to exist and it could be made aware of which page has which memory protection applied so that once a page is made executable it will only consider it allocatable once every function stored in it has been deallocated. This way it is also no longer necessary to allocate multiples of the page size. |
Another advantage of that would be that it allows keeping all code within 2GB even when allocating a lot of memory in between compiling functions. This is necessary to avoid the panics at
|
I'm using a simple mmap-based allocator to work around #4000 (^) here: https://github.com/Mrmaxmeier/wasmtime/commits/cranelift-jit-reserve-vmem-area |
This currently behind the selinux-fix feature flag. SELinux doesn't allow making parts of the heap executable. In addition it seems that there is an issue in multithreaded environments causing permission issues leading to crashes when using posix_memalign instead of mmap. (see #4980) I don't know why using posix_memalign was chosen initially. Maybe there is some advantage to it that I don't know of. If not, I don't see any reason to stay with posix_memalign as default. @sunfishcode do you remember why you used posix_memalign?
The text was updated successfully, but these errors were encountered: