Stream: git-wasmtime

Topic: wasmtime / issue #2807 cranelift-jit reapplies memory pro...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 01 2021 at 21:24):

akirilov-arm labeled issue #2807:

After calling JITModule::finalize_definitions, allocations for code/data are mprotected to be executable/readonly:

https://github.com/bytecodealliance/wasmtime/blob/6b77786a6e758e91da9484a1c80b6fa5f88e1b3d/cranelift/jit/src/memory.rs#L175-L231

However, self.executable is never updated so mprotect is invoked for _all_ allocations, even ones that have the correct permissions. This makes future finalize_definitions slower.

I think it can be fixed by just adding:

self.executable = self.allocations.len();

At the end of each of the protection functions, and fixing any clearing code.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 22 2021 at 12:44):

akirilov-arm closed issue #2807:

After calling JITModule::finalize_definitions, allocations for code/data are mprotected to be executable/readonly:

https://github.com/bytecodealliance/wasmtime/blob/6b77786a6e758e91da9484a1c80b6fa5f88e1b3d/cranelift/jit/src/memory.rs#L175-L231

However, self.executable is never updated so mprotect is invoked for _all_ allocations, even ones that have the correct permissions. This makes future finalize_definitions slower.

I think it can be fixed by just adding:

self.executable = self.allocations.len();

At the end of each of the protection functions, and fixing any clearing code.


Last updated: Dec 23 2024 at 12:05 UTC