Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 09e2283

Browse files
committedFeb 10, 2025
Update toolchain to 2/5
- Regression for delayed UB for slices: rust-lang/rust#135265
1 parent bf7f55b commit 09e2283

File tree

5 files changed

+28
-20
lines changed

5 files changed

+28
-20
lines changed
 

‎rust-toolchain.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
# SPDX-License-Identifier: Apache-2.0 OR MIT
33

44
[toolchain]
5-
channel = "nightly-2025-02-04"
5+
channel = "nightly-2025-02-05"
66
components = ["llvm-tools", "rustc-dev", "rust-src", "rustfmt"]

‎tests/expected/uninit/delayed-ub/expected renamed to ‎tests/expected/uninit/delayed-ub/delayed-ub.expected

+1-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ delayed_ub_trigger_copy.assertion.\
22
- Status: FAILURE\
33
- Description: "Undefined Behavior: Reading from an uninitialized pointer of type `u128`"\
44

5-
delayed_ub_slices.assertion.\
6-
- Status: FAILURE\
7-
- Description: "Undefined Behavior: Reading from an uninitialized pointer of type `[u128; 4]`"
8-
95
delayed_ub_structs.assertion.\
106
- Status: FAILURE\
117
- Description: "Undefined Behavior: Reading from an uninitialized pointer of type `U`"
@@ -44,7 +40,6 @@ delayed_ub.assertion.\
4440

4541
Summary:
4642
Verification failed for - delayed_ub_trigger_copy
47-
Verification failed for - delayed_ub_slices
4843
Verification failed for - delayed_ub_structs
4944
Verification failed for - delayed_ub_double_copy
5045
Verification failed for - delayed_ub_copy
@@ -54,4 +49,4 @@ Verification failed for - delayed_ub_laundered
5449
Verification failed for - delayed_ub_static
5550
Verification failed for - delayed_ub_transmute
5651
Verification failed for - delayed_ub
57-
Complete - 0 successfully verified harnesses, 11 failures, 11 total.
52+
Complete - 0 successfully verified harnesses, 10 failures, 10 total.

‎tests/expected/uninit/delayed-ub/delayed-ub.rs

-13
Original file line numberDiff line numberDiff line change
@@ -170,19 +170,6 @@ fn delayed_ub_structs() {
170170
}
171171
}
172172

173-
/// Delayed UB via mutable pointer write into a slice element.
174-
#[kani::proof]
175-
fn delayed_ub_slices() {
176-
unsafe {
177-
// Create an array.
178-
let mut arr = [0u128; 4];
179-
// Get a pointer to a part of the array.
180-
let ptr = &mut arr[0..2][0..1][0] as *mut _ as *mut (u8, u32);
181-
*ptr = (4, 4);
182-
let arr_copy = arr; // UB: This reads a padding value inside the array!
183-
}
184-
}
185-
186173
/// Delayed UB via mutable pointer copy, which should be the only delayed UB trigger in this case.
187174
#[kani::proof]
188175
fn delayed_ub_trigger_copy() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
delayed_ub_slices.assertion.\
2+
- Status: FAILURE\
3+
- Description: "Undefined Behavior: Reading from an uninitialized pointer of type `[u128; 4]`"
4+
5+
Verification failed for - delayed_ub_slices
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright Kani Contributors
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
// kani-flags: -Z ghost-state -Z uninit-checks
4+
5+
//! Checks that Kani catches instances of delayed UB for slices.
6+
//! This test used to live inside delayed-ub, but the 2/5/2025 toolchain upgrade introduced a regression for this test.
7+
//! Once this test is fixed, move it back into delayed-ub.rs
8+
//! See https://github.com/model-checking/kani/issues/3881 for details.
9+
10+
/// Delayed UB via mutable pointer write into a slice element.
11+
#[kani::proof]
12+
fn delayed_ub_slices() {
13+
unsafe {
14+
// Create an array.
15+
let mut arr = [0u128; 4];
16+
// Get a pointer to a part of the array.
17+
let ptr = &mut arr[0..2][0..1][0] as *mut _ as *mut (u8, u32);
18+
*ptr = (4, 4);
19+
let arr_copy = arr; // UB: This reads a padding value inside the array!
20+
}
21+
}

0 commit comments

Comments
 (0)
Please sign in to comment.