-
Notifications
You must be signed in to change notification settings - Fork 348
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
Miri reports UB in safe code due to address space exhaustion (?) #2769
Comments
Oh fun, I didn't think it was actually possible to exhaust the address space in Miri... However the corresponding arithmetic in |
The base address of the allocation is fine. The problem is that there isn't enough address space after the base address for the size of the allocation. I modified the demo to make it clearer I think: fn main() {
for _ in 0..4 {
let a = [0u8; 1024 * 1024 * 1024];
println!("{:p}", &a[0] as *const u8);
drop(&a[..]);
}
}
|
This code computes the at-the-end address of the allocation: Line 200 in 003f73e
However this seems to be doing a |
miri: fix ICE when running out of address space Fixes rust-lang#2769 r? `@oli-obk` I didn't add a test since that requires oli-obk/ui_test#38 (host must be 64bit and target 32bit). Also the test takes ~30s, so I am not sure if we want to have it in the test suite?
On a 32-bit target, Miri says this program encounters UB:
The program above is a bit slow to execute but it gets the job done without any
unsafe
. UsingVec::with_capacity
is faster.I feel like this shouldn't be possible? Or at least we shouldn't report UB?
The
Vec
version is this:In this case I think it's much more clear that the last allocation should fail
The text was updated successfully, but these errors were encountered: