Fix the wrong EmulateByNameResult::NotSupported in syscall shim

This commit is contained in:
hyd-dev 2021-06-11 11:13:16 +08:00
parent 83dd2d7b1f
commit 4f3718ef85
No known key found for this signature in database
GPG key ID: 74FA7FD5B8DA14B8
3 changed files with 15 additions and 1 deletions

View file

@ -185,7 +185,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
}
id => {
this.handle_unsupported(format!("can't execute syscall with ID {}", id))?;
return Ok(EmulateByNameResult::NotSupported);
return Ok(EmulateByNameResult::AlreadyJumped);
}
}
}

View file

@ -0,0 +1,12 @@
// ignore-windows: No libc on Windows
// ignore-macos: `syscall` is not supported on macOS
// compile-flags: -Zmiri-panic-on-unsupported
#![feature(rustc_private)]
extern crate libc;
fn main() {
unsafe {
libc::syscall(0);
}
}

View file

@ -0,0 +1,2 @@
thread 'main' panicked at 'unsupported Miri functionality: can't execute syscall with ID 0', $DIR/unsupported_syscall.rs:10:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace