Skip to content

Commit 568dca4

Browse files
committed
Show the memory of uninit reads
1 parent 98f175b commit 568dca4

28 files changed

+82
-77
lines changed

tests/fail-dep/concurrency/libc_pthread_cond_double_destroy.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
//@ignore-target: windows # No pthreads on Windows
2+
//@ normalize-stderr-test: "(\n)ALLOC \(.*\) \{\n(.*\n)*\}(\n)" -> "${1}ALLOC DUMP${3}"
3+
//@ normalize-stderr-test: "\[0x[0-9a-z]..0x[0-9a-z]\]" -> "[0xX..0xY]"
24

35
/// Test that destroying a pthread_cond twice fails, even without a check for number validity
46

tests/fail-dep/concurrency/libc_pthread_cond_double_destroy.stderr

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: reading memory at ALLOC[0x0..0x4], but memory is uninitialized at [0x0..0x4], and this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0xX..0xY], but memory is uninitialized at [0xX..0xY], and this operation requires initialized memory
22
--> tests/fail-dep/concurrency/libc_pthread_cond_double_destroy.rs:LL:CC
33
|
44
LL | libc::pthread_cond_destroy(cond.as_mut_ptr());
@@ -9,12 +9,8 @@ LL | libc::pthread_cond_destroy(cond.as_mut_ptr());
99
= note: BACKTRACE:
1010
= note: inside `main` at tests/fail-dep/concurrency/libc_pthread_cond_double_destroy.rs:LL:CC
1111

12-
Uninitialized memory occurred at ALLOC[0x0..0x4], in this allocation:
13-
ALLOC (stack variable, size: 48, align: 8) {
14-
0x00 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
15-
0x10 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
16-
0x20 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
17-
}
12+
Uninitialized memory occurred at ALLOC[0xX..0xY], in this allocation:
13+
ALLOC DUMP
1814

1915
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
2016

tests/fail-dep/concurrency/libc_pthread_condattr_double_destroy.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//@ignore-target: windows # No pthreads on Windows
22
//@ignore-target: apple # Our macOS condattr don't have any fields so we do not notice this.
3+
//@ normalize-stderr-test: "(\n)ALLOC \(.*\) \{\n(.*\n)*\}(\n)" -> "${1}ALLOC DUMP${3}"
4+
//@ normalize-stderr-test: "\[0x[0-9a-z]..0x[0-9a-z]\]" -> "[0xX..0xY]"
35

46
/// Test that destroying a pthread_condattr twice fails, even without a check for number validity
57

tests/fail-dep/concurrency/libc_pthread_condattr_double_destroy.stderr

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: reading memory at ALLOC[0x0..0x4], but memory is uninitialized at [0x0..0x4], and this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0xX..0xY], but memory is uninitialized at [0xX..0xY], and this operation requires initialized memory
22
--> tests/fail-dep/concurrency/libc_pthread_condattr_double_destroy.rs:LL:CC
33
|
44
LL | libc::pthread_condattr_destroy(attr.as_mut_ptr());
@@ -9,10 +9,8 @@ LL | libc::pthread_condattr_destroy(attr.as_mut_ptr());
99
= note: BACKTRACE:
1010
= note: inside `main` at tests/fail-dep/concurrency/libc_pthread_condattr_double_destroy.rs:LL:CC
1111

12-
Uninitialized memory occurred at ALLOC[0x0..0x4], in this allocation:
13-
ALLOC (stack variable, size: 4, align: 4) {
14-
__ __ __ __ │ ░░░░
15-
}
12+
Uninitialized memory occurred at ALLOC[0xX..0xY], in this allocation:
13+
ALLOC DUMP
1614

1715
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1816

tests/fail-dep/concurrency/libc_pthread_mutex_double_destroy.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
//@ignore-target: windows # No pthreads on Windows
2+
//@ normalize-stderr-test: "(\n)ALLOC \(.*\) \{\n(.*\n)*\}(\n)" -> "${1}ALLOC DUMP${3}"
3+
//@ normalize-stderr-test: "\[0x[0-9a-z]..0x[0-9a-z]\]" -> "[0xX..0xY]"
24

35
/// Test that destroying a pthread_mutex twice fails, even without a check for number validity
46

tests/fail-dep/concurrency/libc_pthread_mutex_double_destroy.stderr

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: reading memory at ALLOC[0x0..0x4], but memory is uninitialized at [0x0..0x4], and this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0xX..0xY], but memory is uninitialized at [0xX..0xY], and this operation requires initialized memory
22
--> tests/fail-dep/concurrency/libc_pthread_mutex_double_destroy.rs:LL:CC
33
|
44
LL | libc::pthread_mutex_destroy(mutex.as_mut_ptr());
@@ -9,12 +9,8 @@ LL | libc::pthread_mutex_destroy(mutex.as_mut_ptr());
99
= note: BACKTRACE:
1010
= note: inside `main` at tests/fail-dep/concurrency/libc_pthread_mutex_double_destroy.rs:LL:CC
1111

12-
Uninitialized memory occurred at ALLOC[0x0..0x4], in this allocation:
13-
ALLOC (stack variable, size: 40, align: 8) {
14-
0x00 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
15-
0x10 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
16-
0x20 │ __ __ __ __ __ __ __ __ │ ░░░░░░░░
17-
}
12+
Uninitialized memory occurred at ALLOC[0xX..0xY], in this allocation:
13+
ALLOC DUMP
1814

1915
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
2016

tests/fail-dep/concurrency/libc_pthread_mutexattr_double_destroy.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
//@ignore-target: windows # No pthreads on Windows
2+
//@ normalize-stderr-test: "(\n)ALLOC \(.*\) \{\n(.*\n)*\}(\n)" -> "${1}ALLOC DUMP${3}"
3+
//@ normalize-stderr-test: "\[0x[0-9a-z]..0x[0-9a-z]\]" -> "[0xX..0xY]"
24

35
/// Test that destroying a pthread_mutexattr twice fails, even without a check for number validity
46

tests/fail-dep/concurrency/libc_pthread_mutexattr_double_destroy.stderr

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: reading memory at ALLOC[0x0..0x4], but memory is uninitialized at [0x0..0x4], and this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0xX..0xY], but memory is uninitialized at [0xX..0xY], and this operation requires initialized memory
22
--> tests/fail-dep/concurrency/libc_pthread_mutexattr_double_destroy.rs:LL:CC
33
|
44
LL | libc::pthread_mutexattr_destroy(attr.as_mut_ptr());
@@ -9,10 +9,8 @@ LL | libc::pthread_mutexattr_destroy(attr.as_mut_ptr());
99
= note: BACKTRACE:
1010
= note: inside `main` at tests/fail-dep/concurrency/libc_pthread_mutexattr_double_destroy.rs:LL:CC
1111

12-
Uninitialized memory occurred at ALLOC[0x0..0x4], in this allocation:
13-
ALLOC (stack variable, size: 4, align: 4) {
14-
__ __ __ __ │ ░░░░
15-
}
12+
Uninitialized memory occurred at ALLOC[0xX..0xY], in this allocation:
13+
ALLOC DUMP
1614

1715
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1816

tests/fail-dep/concurrency/libc_pthread_rwlock_double_destroy.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
//@ignore-target: windows # No pthreads on Windows
2+
//@ normalize-stderr-test: "(\n)ALLOC \(.*\) \{\n(.*\n)*\}(\n)" -> "${1}ALLOC DUMP${3}"
3+
//@ normalize-stderr-test: "\[0x[0-9a-z]..0x[0-9a-z]\]" -> "[0xX..0xY]"
24

35
/// Test that destroying a pthread_rwlock twice fails, even without a check for number validity
46

tests/fail-dep/concurrency/libc_pthread_rwlock_double_destroy.stderr

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: reading memory at ALLOC[0x0..0x4], but memory is uninitialized at [0x0..0x4], and this operation requires initialized memory
1+
error: Undefined Behavior: reading memory at ALLOC[0xX..0xY], but memory is uninitialized at [0xX..0xY], and this operation requires initialized memory
22
--> tests/fail-dep/concurrency/libc_pthread_rwlock_double_destroy.rs:LL:CC
33
|
44
LL | libc::pthread_rwlock_destroy(&mut lock);
@@ -9,13 +9,8 @@ LL | libc::pthread_rwlock_destroy(&mut lock);
99
= note: BACKTRACE:
1010
= note: inside `main` at tests/fail-dep/concurrency/libc_pthread_rwlock_double_destroy.rs:LL:CC
1111

12-
Uninitialized memory occurred at ALLOC[0x0..0x4], in this allocation:
13-
ALLOC (stack variable, size: 56, align: 8) {
14-
0x00 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
15-
0x10 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
16-
0x20 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
17-
0x30 │ __ __ __ __ __ __ __ __ │ ░░░░░░░░
18-
}
12+
Uninitialized memory occurred at ALLOC[0xX..0xY], in this allocation:
13+
ALLOC DUMP
1914

2015
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
2116

0 commit comments

Comments
 (0)