You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
self.accessible is not rounded up to the host page size and is instead stored directly. But other places assume that self.accessible is page-aligned, for example:
mprotect requires that its address is page-aligned, and will produce an EINVAL if it isn't.
I think there are likely also places where it panics or possibly even causes UB.
The text was updated successfully, but these errors were encountered:
sunshowers
changed the title
MemoryImageSlot doesn't handle the case where RuntimeLinearMemory::byte_size is not page-aligned
MemoryImageSlot doesn't handle the case where RuntimeLinearMemory::byte_size is not host page-aligned
Nov 22, 2024
* move most of runtime/vm/cow.rs over to aligned byte counts
As part of attempting to move some of these operations over to Mmap instances,
it is nice to have type-level checking for aligned sizes. In upcoming PRs, APIs
like `map_at` will be switched to using `Mmap` instances with aligned counts.
There are a couple of spots where I have questions -- will flag them in review
comments.
* address review comments, incl workaround for #9660
Discovered this while working on #9652.
Looking at
LocalMemory::new
:wasmtime/crates/wasmtime/src/runtime/vm/memory.rs
Lines 484 to 487 in bc656c7
It passes in
alloc.byte_size()
as theaccessible
parameter toMemoryImageSlot::create
:wasmtime/crates/wasmtime/src/runtime/vm/cow.rs
Lines 337 to 345 in bc656c7
self.accessible
is not rounded up to the host page size and is instead stored directly. But other places assume thatself.accessible
is page-aligned, for example:wasmtime/crates/wasmtime/src/runtime/vm/cow.rs
Line 425 in bc656c7
This ends up resolving to
mprotect
:wasmtime/crates/wasmtime/src/runtime/vm/sys/unix/vm.rs
Lines 9 to 11 in bc656c7
mprotect
requires that its address is page-aligned, and will produce anEINVAL
if it isn't.I think there are likely also places where it panics or possibly even causes UB.
The text was updated successfully, but these errors were encountered: