diff --git a/src/shims/posix/linux/foreign_items.rs b/src/shims/posix/linux/foreign_items.rs index 68ae704fb04..178b82f6131 100644 --- a/src/shims/posix/linux/foreign_items.rs +++ b/src/shims/posix/linux/foreign_items.rs @@ -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); } } } diff --git a/tests/run-pass/panic/unsupported_syscall.rs b/tests/run-pass/panic/unsupported_syscall.rs new file mode 100644 index 00000000000..854f179392c --- /dev/null +++ b/tests/run-pass/panic/unsupported_syscall.rs @@ -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); + } +} diff --git a/tests/run-pass/panic/unsupported_syscall.stderr b/tests/run-pass/panic/unsupported_syscall.stderr new file mode 100644 index 00000000000..49796ee2021 --- /dev/null +++ b/tests/run-pass/panic/unsupported_syscall.stderr @@ -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