Skip to content

Commit

Permalink
Update toolchain to 2/5
Browse files Browse the repository at this point in the history
- Regression for delayed UB for slices: rust-lang/rust#135265
  • Loading branch information
carolynzech committed Feb 10, 2025
1 parent bf7f55b commit 09e2283
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 20 deletions.
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT

[toolchain]
channel = "nightly-2025-02-04"
channel = "nightly-2025-02-05"
components = ["llvm-tools", "rustc-dev", "rust-src", "rustfmt"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ delayed_ub_trigger_copy.assertion.\
- Status: FAILURE\
- Description: "Undefined Behavior: Reading from an uninitialized pointer of type `u128`"\

delayed_ub_slices.assertion.\
- Status: FAILURE\
- Description: "Undefined Behavior: Reading from an uninitialized pointer of type `[u128; 4]`"

delayed_ub_structs.assertion.\
- Status: FAILURE\
- Description: "Undefined Behavior: Reading from an uninitialized pointer of type `U`"
Expand Down Expand Up @@ -44,7 +40,6 @@ delayed_ub.assertion.\

Summary:
Verification failed for - delayed_ub_trigger_copy
Verification failed for - delayed_ub_slices
Verification failed for - delayed_ub_structs
Verification failed for - delayed_ub_double_copy
Verification failed for - delayed_ub_copy
Expand All @@ -54,4 +49,4 @@ Verification failed for - delayed_ub_laundered
Verification failed for - delayed_ub_static
Verification failed for - delayed_ub_transmute
Verification failed for - delayed_ub
Complete - 0 successfully verified harnesses, 11 failures, 11 total.
Complete - 0 successfully verified harnesses, 10 failures, 10 total.
13 changes: 0 additions & 13 deletions tests/expected/uninit/delayed-ub/delayed-ub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,6 @@ fn delayed_ub_structs() {
}
}

/// Delayed UB via mutable pointer write into a slice element.
#[kani::proof]
fn delayed_ub_slices() {
unsafe {
// Create an array.
let mut arr = [0u128; 4];
// Get a pointer to a part of the array.
let ptr = &mut arr[0..2][0..1][0] as *mut _ as *mut (u8, u32);
*ptr = (4, 4);
let arr_copy = arr; // UB: This reads a padding value inside the array!
}
}

/// Delayed UB via mutable pointer copy, which should be the only delayed UB trigger in this case.
#[kani::proof]
fn delayed_ub_trigger_copy() {
Expand Down
5 changes: 5 additions & 0 deletions tests/expected/uninit/delayed-ub/slices_fixme.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
delayed_ub_slices.assertion.\
- Status: FAILURE\
- Description: "Undefined Behavior: Reading from an uninitialized pointer of type `[u128; 4]`"

Verification failed for - delayed_ub_slices
21 changes: 21 additions & 0 deletions tests/expected/uninit/delayed-ub/slices_fixme.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
// kani-flags: -Z ghost-state -Z uninit-checks

//! Checks that Kani catches instances of delayed UB for slices.
//! This test used to live inside delayed-ub, but the 2/5/2025 toolchain upgrade introduced a regression for this test.
//! Once this test is fixed, move it back into delayed-ub.rs
//! See https://github.com/model-checking/kani/issues/3881 for details.
/// Delayed UB via mutable pointer write into a slice element.
#[kani::proof]
fn delayed_ub_slices() {
unsafe {
// Create an array.
let mut arr = [0u128; 4];
// Get a pointer to a part of the array.
let ptr = &mut arr[0..2][0..1][0] as *mut _ as *mut (u8, u32);
*ptr = (4, 4);
let arr_copy = arr; // UB: This reads a padding value inside the array!
}
}

0 comments on commit 09e2283

Please sign in to comment.