Use getrandom() syscall number from libc

This commit is contained in:
Aaron Hill 2019-04-07 19:57:14 -04:00
parent 312f938e79
commit dddeda7f7d
No known key found for this signature in database
GPG key ID: B4087E510E98B164
2 changed files with 3 additions and 2 deletions

View file

@ -46,6 +46,7 @@ shell-escape = "0.1.4"
rustc-workspace-hack = "1.0.0"
hex = "0.3.2"
rand = "0.6.5"
libc = "0.2.51"
[build-dependencies]
vergen = "3"

View file

@ -216,8 +216,8 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
//
// `libc::syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(), GRND_NONBLOCK)`
// is called if a `HashMap` is created the regular way.
match this.read_scalar(args[0])?.to_usize(this)? {
318 | 511 => {
match this.read_scalar(args[0])?.to_usize(this)? as i64 {
libc::SYS_getrandom => {
match this.machine.rng.as_ref() {
Some(rng) => {
let ptr = this.read_scalar(args[1])?.to_ptr()?;