Skip to content

Commit b655795

Browse files
committed
Auto merge of rust-lang#2687 - RalfJung:getrandom, r=RalfJung
ensure current getrandom works with strict provenance
2 parents 435faf0 + c2f872e commit b655795

File tree

7 files changed

+69
-49
lines changed

7 files changed

+69
-49
lines changed

test_dependencies/Cargo.lock

Lines changed: 54 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test_dependencies/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ edition = "2021"
1111
# all dependencies (and their transitive ones) listed here can be used in `tests/`.
1212
tokio = { version = "1.0", features = ["full"] }
1313
libc = "0.2"
14-
page_size = "0.4.1"
14+
page_size = "0.5"
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]

tests/fail/crates/tokio_mvp.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: unsupported operation: can't call foreign function: epoll_create1
22
--> CARGO_REGISTRY/.../epoll.rs:LL:CC
33
|
4-
LL | syscall!(epoll_create1(flag)).map(|ep| Selector {
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: epoll_create1
4+
LL | let res = syscall!(epoll_create1(libc::EPOLL_CLOEXEC));
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: epoll_create1
66
|
77
= help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
88
= note: BACKTRACE:

tests/pass-dep/getrandom_1.rs

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+
}

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)