-
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
pulley: Ungate memory64 feature #9780
Conversation
note this is currently stacked on #9779 |
Subscribe to Label Actioncc @fitzgen
This issue or pull request has been labeled: "cranelift", "pulley", "wasmtime:api", "wasmtime:config"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
Label Messager: wasmtime:configIt looks like you are changing Wasmtime's configuration options. Make sure to
To modify this label's message, edit the To add new label messages or remove existing label messages, edit the |
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.
Last commit LGTM, with note about Spectre below (happy to discuss further re: how much of an issue and/or how or if to document this).
let high_bits = pos.ins().ushr(index, c32); | ||
let high_bits = pos.ins().ireduce(pointer_ty, high_bits); | ||
pos.ins() | ||
.trapnz(high_bits, ir::TrapCode::HEAP_OUT_OF_BOUNDS); |
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 like 0x1_0000_1000
where 0x1000
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).
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.
LGTM modulo @cfallin's comment
// 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); | ||
} |
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.
Why were these asserts removed?
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.
They were basically a pain to maintain on 32-bit because I already had to modify the minimum check to use 1<<32
rather than absolute_max
(due to absolute_max
being a usize
and not being able to represent 1<<32
) and then this PR uncovered an assertion in the next one where a 64-bit linear memory's maximum size far exceeds 1<<32
as well. Given that these are just debug asserts that are already basically checked in many other places it seemed best to just remove them instead of trying to contort ourselves to keep them in all portable conditions.
This commit is similar to bytecodealliance#9779 in that it's removing a proposal from the "known list of panicking features" for Pulley to allow more tests to run on Pulley. This then fills out a few miscellaneous instructions to get a full suite of tests passing in Pulley related to memory64 and other instructions. prtest:full
47a9046
to
3d22b3d
Compare
This commit is similar to #9779 in that it's removing a proposal from
the "known list of panicking features" for Pulley to allow more tests to
run on Pulley. This then fills out a few miscellaneous instructions to
get a full suite of tests passing in Pulley related to memory64 and
other instructions.
cc #9783