Skip to content

Commit c7d2aba

Browse files
committed
Auto merge of #140596 - matthiaskrgr:rollup-s7tzr34, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #140485 (Optimize the codegen for `Span::from_expansion`) - #140509 (transmutability: merge contiguous runs with a common destination) - #140519 (Use select in projection lookup in `report_projection_error`) - #140521 (interpret: better error message for out-of-bounds pointer arithmetic and accesses) - #140536 (Rename `*Guard::try_map` to `filter_map`.) - #140550 (Stabilize `select_unpredictable`) - #140563 (extend the list of registered dylibs on `test::prepare_cargo_test`) - #140572 (Add useful comments on `ExprKind::If` variants.) - #140574 (Add regression test for 133065) r? `@ghost` `@rustbot` modify labels: rollup
2 parents f60e51c + 9416cf9 commit c7d2aba

File tree

62 files changed

+106
-106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+106
-106
lines changed

src/borrow_tracker/stacked_borrows/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ trait EvalContextPrivExt<'tcx, 'ecx>: crate::MiriInterpCxExt<'tcx> {
594594
) -> InterpResult<'tcx, Option<Provenance>> {
595595
let this = self.eval_context_mut();
596596
// Ensure we bail out if the pointer goes out-of-bounds (see miri#1050).
597-
this.check_ptr_access(place.ptr(), size, CheckInAllocMsg::InboundsTest)?;
597+
this.check_ptr_access(place.ptr(), size, CheckInAllocMsg::Dereferenceable)?;
598598

599599
// It is crucial that this gets called on all code paths, to ensure we track tag creation.
600600
let log_creation = |this: &MiriInterpCx<'tcx>,

src/borrow_tracker/tree_borrows/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ trait EvalContextPrivExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
197197
// Make sure the new permission makes sense as the initial permission of a fresh tag.
198198
assert!(new_perm.initial_state.is_initial());
199199
// Ensure we bail out if the pointer goes out-of-bounds (see miri#1050).
200-
this.check_ptr_access(place.ptr(), ptr_size, CheckInAllocMsg::InboundsTest)?;
200+
this.check_ptr_access(place.ptr(), ptr_size, CheckInAllocMsg::Dereferenceable)?;
201201

202202
// It is crucial that this gets called on all code paths, to ensure we track tag creation.
203203
let log_creation = |this: &MiriInterpCx<'tcx>,

src/shims/unix/android/thread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn prctl<'tcx>(
4242
ecx.check_ptr_access(
4343
name.to_pointer(ecx)?,
4444
Size::from_bytes(TASK_COMM_LEN),
45-
CheckInAllocMsg::MemoryAccessTest,
45+
CheckInAllocMsg::MemoryAccess,
4646
)?;
4747
let res = ecx.pthread_getname_np(thread, name, len, /* truncate*/ false)?;
4848
assert_eq!(res, ThreadNameResult::Ok);

src/shims/unix/fd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
226226
trace!("Reading from FD {}, size {}", fd_num, count);
227227

228228
// Check that the *entire* buffer is actually valid memory.
229-
this.check_ptr_access(buf, Size::from_bytes(count), CheckInAllocMsg::MemoryAccessTest)?;
229+
this.check_ptr_access(buf, Size::from_bytes(count), CheckInAllocMsg::MemoryAccess)?;
230230

231231
// We cap the number of read bytes to the largest value that we are able to fit in both the
232232
// host's and target's `isize`. This saves us from having to handle overflows later.
@@ -292,7 +292,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
292292
// Isolation check is done via `FileDescription` trait.
293293

294294
// Check that the *entire* buffer is actually valid memory.
295-
this.check_ptr_access(buf, Size::from_bytes(count), CheckInAllocMsg::MemoryAccessTest)?;
295+
this.check_ptr_access(buf, Size::from_bytes(count), CheckInAllocMsg::MemoryAccess)?;
296296

297297
// We cap the number of written bytes to the largest value that we are able to fit in both the
298298
// host's and target's `isize`. This saves us from having to handle overflows later.

tests/fail-dep/libc/affinity.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: memory access failed: expected a pointer to 129 bytes of memory, but got ALLOC which is only 128 bytes from the end of the allocation
1+
error: Undefined Behavior: memory access failed: attempting to access 129 bytes, but got ALLOC which is only 128 bytes from the end of the allocation
22
--> tests/fail-dep/libc/affinity.rs:LL:CC
33
|
44
LL | let err = unsafe { sched_setaffinity(PID, size_of::<cpu_set_t>() + 1, &cpuset) };
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 129 bytes of memory, but got ALLOC which is only 128 bytes from the end of the allocation
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: attempting to access 129 bytes, but got ALLOC which is only 128 bytes from the end of the allocation
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail-dep/libc/memchr_null.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: out-of-bounds pointer use: expected a pointer to some allocation, but got a null pointer
1+
error: Undefined Behavior: pointer not dereferenceable: pointer must point to some allocation, but got null pointer
22
--> tests/fail-dep/libc/memchr_null.rs:LL:CC
33
|
44
LL | libc::memchr(ptr::null(), 0, 0);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: expected a pointer to some allocation, but got a null pointer
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer not dereferenceable: pointer must point to some allocation, but got null pointer
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail-dep/libc/memcmp_null.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: out-of-bounds pointer use: expected a pointer to some allocation, but got a null pointer
1+
error: Undefined Behavior: pointer not dereferenceable: pointer must point to some allocation, but got null pointer
22
--> tests/fail-dep/libc/memcmp_null.rs:LL:CC
33
|
44
LL | libc::memcmp(ptr::null(), ptr::null(), 0);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: expected a pointer to some allocation, but got a null pointer
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer not dereferenceable: pointer must point to some allocation, but got null pointer
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail-dep/libc/memcmp_zero.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: out-of-bounds pointer use: expected a pointer to some allocation, but got 0x2a[noalloc] which is a dangling pointer (it has no provenance)
1+
error: Undefined Behavior: pointer not dereferenceable: pointer must point to some allocation, but got 0x2a[noalloc] which is a dangling pointer (it has no provenance)
22
--> tests/fail-dep/libc/memcmp_zero.rs:LL:CC
33
|
44
LL | libc::memcmp(ptr.cast(), ptr.cast(), 0);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: expected a pointer to some allocation, but got 0x2a[noalloc] which is a dangling pointer (it has no provenance)
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer not dereferenceable: pointer must point to some allocation, but got 0x2a[noalloc] which is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail-dep/libc/memcpy_zero.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: out-of-bounds pointer use: expected a pointer to some allocation, but got 0x17[noalloc] which is a dangling pointer (it has no provenance)
1+
error: Undefined Behavior: pointer not dereferenceable: pointer must point to some allocation, but got 0x17[noalloc] which is a dangling pointer (it has no provenance)
22
--> tests/fail-dep/libc/memcpy_zero.rs:LL:CC
33
|
44
LL | libc::memcpy(to.cast(), from.cast(), 0);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: expected a pointer to some allocation, but got 0x17[noalloc] which is a dangling pointer (it has no provenance)
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer not dereferenceable: pointer must point to some allocation, but got 0x17[noalloc] which is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail-dep/libc/memrchr_null.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: out-of-bounds pointer use: expected a pointer to some allocation, but got a null pointer
1+
error: Undefined Behavior: pointer not dereferenceable: pointer must point to some allocation, but got null pointer
22
--> tests/fail-dep/libc/memrchr_null.rs:LL:CC
33
|
44
LL | libc::memrchr(ptr::null(), 0, 0);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: expected a pointer to some allocation, but got a null pointer
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer not dereferenceable: pointer must point to some allocation, but got null pointer
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

0 commit comments

Comments
 (0)