-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
pulley: Ungate memory64 feature #9780
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -290,22 +290,6 @@ impl Memory { | |
// overkill for this purpose. | ||
let absolute_max = 0usize.wrapping_sub(page_size); | ||
|
||
// Sanity-check what should already be true from wasm module validation. | ||
// Note that for 32-bit targets the absolute maximum is `1<<32` during | ||
// compilation, not one-page-less-than-u32::MAX, so need to handle that | ||
// specially here. | ||
let absolute_max64 = if cfg!(target_pointer_width = "32") { | ||
1 << 32 | ||
} else { | ||
u64::try_from(absolute_max).unwrap() | ||
}; | ||
if let Ok(size) = ty.minimum_byte_size() { | ||
assert!(size <= absolute_max64); | ||
} | ||
if let Ok(max) = ty.maximum_byte_size() { | ||
assert!(max <= absolute_max64); | ||
} | ||
Comment on lines
-293
to
-307
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why were these asserts removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They were basically a pain to maintain on 32-bit because I already had to modify the minimum check to use |
||
|
||
// If the minimum memory size overflows the size of our own address | ||
// space, then we can't satisfy this request, but defer the error to | ||
// later so the `store` can be informed that an effective oom is | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should make a note re: Spectre here --
trapnz
internally uses a branch and so one might expect there to be some exposure here. I think we're actually safe because the worst that happens is that the guest accesses an OOB address like0x1_0000_1000
where0x1000
is in-bounds, and gets its own in-bounds data; in other words, this check is layered on top of the actual bounds-check on the lower 32 bits, so there is still not any visibility outside the sandbox in the misspeculated path. But it's... worth noting, if only because the guest might in turn rely on OOBs not to speculatively read valid data (niche but possible).