Stream: git-wasmtime

Topic: wasmtime / PR #5204 Fix mprotect failures by enabling cra...


view this post on Zulip Wasmtime GitHub notifications bot (Nov 04 2022 at 17:58):

uweigand opened PR #5204 from mprotect-fix to main:

The sample program in cranelift/filetests/src/function_runner.rs would abort with an mprotect failure under certain circumstances, see https://github.com/bytecodealliance/wasmtime/pull/4453#issuecomment-1303803222

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.

CC @cfallin @afonso360

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Nov 04 2022 at 18:35):

uweigand updated PR #5204 from mprotect-fix to main.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 04 2022 at 19:29):

jameysharp submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 04 2022 at 20:04):

jameysharp submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 04 2022 at 21:01):

abrown submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 04 2022 at 21:01):

abrown merged PR #5204.


Last updated: Nov 22 2024 at 16:03 UTC