Skip to content

Commit 859310a

Browse files
committed
ensure current getrandom works with strict provenance
1 parent 105dba7 commit 859310a

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

src/tools/miri/test_dependencies/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ page_size = "0.4.1"
1515
num_cpus = "1.10.1"
1616

1717
getrandom_1 = { package = "getrandom", version = "0.1" }
18-
getrandom_2 = { package = "getrandom", version = "0.2" }
18+
getrandom = { version = "0.2" }
1919
rand = { version = "0.8", features = ["small_rng"] }
2020

2121
[workspace]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// mac-os `getrandom_1` does some pointer shenanigans
2+
//@compile-flags: -Zmiri-permissive-provenance
3+
4+
/// Test old version of `getrandom`.
5+
fn main() {
6+
let mut data = vec![0; 16];
7+
getrandom_1::getrandom(&mut data).unwrap();
8+
}

src/tools/miri/tests/pass-dep/random.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
// mac-os `getrandom_1` does some pointer shenanigans
2-
//@compile-flags: -Zmiri-permissive-provenance
1+
//@compile-flags: -Zmiri-strict-provenance
32
use rand::{rngs::SmallRng, Rng, SeedableRng};
43

54
fn main() {
6-
// Test `getrandom` directly (in multiple different versions).
5+
// Test `getrandom` directly.
76
let mut data = vec![0; 16];
8-
getrandom_1::getrandom(&mut data).unwrap();
9-
getrandom_2::getrandom(&mut data).unwrap();
7+
getrandom::getrandom(&mut data).unwrap();
108

119
// Try seeding with "real" entropy.
1210
let mut rng = SmallRng::from_entropy();

0 commit comments

Comments
 (0)