@@ -47,21 +47,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
47
47
this. read_scalar ( len) ?,
48
48
) ?;
49
49
}
50
- "getrandom" => {
51
- let [ ptr, len, flags] =
52
- this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
53
- let ptr = this. read_pointer ( ptr) ?;
54
- let len = this. read_target_usize ( len) ?;
55
- let _flags = this. read_scalar ( flags) ?. to_i32 ( ) ?;
56
- // flags on freebsd does not really matter
57
- // in practice, GRND_RANDOM does not particularly draw from /dev/random
58
- // since it is the same as to /dev/urandom.
59
- // GRND_INSECURE is only an alias of GRND_NONBLOCK, which
60
- // does not affect the RNG.
61
- // https://man.freebsd.org/cgi/man.cgi?query=getrandom&sektion=2&n=1
62
- this. gen_random ( ptr, len) ?;
63
- this. write_scalar ( Scalar :: from_target_usize ( len, this) , dest) ?;
64
- }
65
50
66
51
// File related shims
67
52
// For those, we both intercept `func` and `call@FBSD_1.0` symbols cases
@@ -90,7 +75,22 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
90
75
this. write_scalar ( result, dest) ?;
91
76
}
92
77
93
- // errno
78
+ // Miscellaneous
79
+ "getrandom" => {
80
+ let [ ptr, len, flags] =
81
+ this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
82
+ let ptr = this. read_pointer ( ptr) ?;
83
+ let len = this. read_target_usize ( len) ?;
84
+ let _flags = this. read_scalar ( flags) ?. to_i32 ( ) ?;
85
+ // flags on freebsd does not really matter
86
+ // in practice, GRND_RANDOM does not particularly draw from /dev/random
87
+ // since it is the same as to /dev/urandom.
88
+ // GRND_INSECURE is only an alias of GRND_NONBLOCK, which
89
+ // does not affect the RNG.
90
+ // https://man.freebsd.org/cgi/man.cgi?query=getrandom&sektion=2&n=1
91
+ this. gen_random ( ptr, len) ?;
92
+ this. write_scalar ( Scalar :: from_target_usize ( len, this) , dest) ?;
93
+ }
94
94
"__error" => {
95
95
let [ ] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
96
96
let errno_place = this. last_error_place ( ) ?;
0 commit comments