Skip to content
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

Fix mprotect failures by enabling cranelift-jit selinux-fix #5204

Merged
merged 1 commit into from Nov 4, 2022

Commits on Nov 4, 2022

  1. Fix mprotect failures by enabling cranelift-jit selinux-fix

    The sample program in cranelift/filetests/src/function_runner.rs
    would abort with an mprotect failure under certain circumstances,
    see bytecodealliance#4453 (comment)
    
    Root cause was that enabling PROT_EXEC on the main process heap
    may be prohibited, depending on Linux distro and version.
    
    This only shows up in the doc test sample program because the main
    clif-util is multi-threaded and therefore allocations will happen
    on glibc's per-thread heap, which is allocated via mmap, and not
    the main process heap.
    
    Work around the problem by enabling the "selinux-fix" feature of
    the cranelift-jit crate dependency in the filetests.  Note that
    this didn't compile out of the box, so a separate fix is also
    required and provided as part of this PR.
    
    Going forward, it would be preferable to always use mmap to allocate
    the backing memory for JITted code.
    uweigand committed Nov 4, 2022
    Configuration menu
    Copy the full SHA
    fec18b5 View commit details
    Browse the repository at this point in the history