-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 with opt-level 4 in code that should not have UB #111422
Labels
A-mir-opt
Area: MIR optimizations
I-unsound
Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
requires-nightly
This issue requires a nightly compiler in some way.
Comments
Cc @rust-lang/wg-mir-opt |
$ cat test.rs
#![crate_type = "lib"]
pub fn mut_raw_then_mut_shr() -> (i32, i32) {
let mut x = 2;
let xref = &mut x;
let xraw = &mut *xref as *mut _;
let xshr = &*xref;
let a = *xshr;
unsafe {
*xraw = 4;
}
(a, x)
}
$ rustc +master -Zdump-mir=all test.rs -Zmir-opt-level=0 -Zmir-enable-passes=+ReferencePropagation -Cdebug-assertions=no With storage statements and some other crap removed, this: _1 = const 2_i32;
_2 = &mut _1;
_5 = &mut (*_2);
_4 = &raw mut (*_5);
_3 = _4;
_6 = &(*_2);
_7 = (*_6);
(*_3) = const 4_i32;
_10 = _1; Is turned into: _1 = const 2_i32;
_2 = &mut _1;
_5 = &mut _1;
_4 = &raw mut (*_2);
_3 = _4;
_6 = &_1;
_7 = (*_2);
(*_5) = const 4_i32;
_10 = _1; The logic that checks for complete replacement of I have not checked the other test. |
jyn514
added
regression-from-stable-to-nightly
Performance or correctness regression from stable to nightly.
I-unsound
Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
requires-nightly
This issue requires a nightly compiler in some way.
A-mir-opt
Area: MIR optimizations
labels
May 10, 2023
Is there any way to enable mir-opt-level=4 on stable? |
I believe there is not |
oli-obk
removed
the
regression-from-stable-to-nightly
Performance or correctness regression from stable to nightly.
label
May 11, 2023
Dylan-DPC
added a commit
to Dylan-DPC/rust
that referenced
this issue
May 11, 2023
Verify copies of mutable pointers in 2 stages in ReferencePropagation Fixes rust-lang#111422 In the first stage, we mark the copies as reborrows, to be checked later. In the second stage, we walk the reborrow chains to verify that all stages are fully replacable. The replacement itself mirrors the check, and iterates through the reborrow chain. r? `@RalfJung` cc `@JakobDegen`
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
May 11, 2023
Verify copies of mutable pointers in 2 stages in ReferencePropagation Fixes rust-lang#111422 In the first stage, we mark the copies as reborrows, to be checked later. In the second stage, we walk the reborrow chains to verify that all stages are fully replacable. The replacement itself mirrors the check, and iterates through the reborrow chain. r? ``@RalfJung`` cc ``@JakobDegen``
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
May 11, 2023
Verify copies of mutable pointers in 2 stages in ReferencePropagation Fixes rust-lang#111422 In the first stage, we mark the copies as reborrows, to be checked later. In the second stage, we walk the reborrow chains to verify that all stages are fully replacable. The replacement itself mirrors the check, and iterates through the reborrow chain. r? ```@RalfJung``` cc ```@JakobDegen```
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
May 11, 2023
Verify copies of mutable pointers in 2 stages in ReferencePropagation Fixes rust-lang#111422 In the first stage, we mark the copies as reborrows, to be checked later. In the second stage, we walk the reborrow chains to verify that all stages are fully replacable. The replacement itself mirrors the check, and iterates through the reborrow chain. r? `````@RalfJung````` cc `````@JakobDegen`````
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
May 11, 2023
Verify copies of mutable pointers in 2 stages in ReferencePropagation Fixes rust-lang#111422 In the first stage, we mark the copies as reborrows, to be checked later. In the second stage, we walk the reborrow chains to verify that all stages are fully replacable. The replacement itself mirrors the check, and iterates through the reborrow chain. r? ````@RalfJung```` cc ````@JakobDegen````
Merged
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
May 12, 2023
update Miri and run mir-opt-level=4 tests in rustc CI so issues like rust-lang#111422 are caught before they land. r? `@oli-obk` due to the bootstrap changes
RalfJung
pushed a commit
to RalfJung/miri
that referenced
this issue
May 13, 2023
update Miri and run mir-opt-level=4 tests in rustc CI so issues like rust-lang/rust#111422 are caught before they land. r? `@oli-obk` due to the bootstrap changes
spikespaz
pushed a commit
to spikespaz/dotwalk-rs
that referenced
this issue
Aug 29, 2024
update Miri and run mir-opt-level=4 tests in rustc CI so issues like rust-lang/rust#111422 are caught before they land. r? `@oli-obk` due to the bootstrap changes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-mir-opt
Area: MIR optimizations
I-unsound
Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
requires-nightly
This issue requires a nightly compiler in some way.
Given the timing I would guess this is caused by #106285 -- Cc @cjgillot
The text was updated successfully, but these errors were encountered: