Skip to content

Commit d39f0c6

Browse files
committed
Auto merge of #1831 - hyd-dev:emulate-by-name-result, r=RalfJung
Fix the wrong `EmulateByNameResult::NotSupported` in `syscall` shim Without the change, the newly added test will fail with: ```diff -thread 'main' panicked at 'unsupported Miri functionality: can't execute syscall with ID 0', $DIR/unsupported_syscall.rs:10:9 +thread 'main' panicked at 'unsupported Miri functionality: can't call foreign function: syscall', $DIR/unsupported_syscall.rs:10:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` cc #1818 (comment)
2 parents 83dd2d7 + 4f3718e commit d39f0c6

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/shims/posix/linux/foreign_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
185185
}
186186
id => {
187187
this.handle_unsupported(format!("can't execute syscall with ID {}", id))?;
188-
return Ok(EmulateByNameResult::NotSupported);
188+
return Ok(EmulateByNameResult::AlreadyJumped);
189189
}
190190
}
191191
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// ignore-windows: No libc on Windows
2+
// ignore-macos: `syscall` is not supported on macOS
3+
// compile-flags: -Zmiri-panic-on-unsupported
4+
#![feature(rustc_private)]
5+
6+
extern crate libc;
7+
8+
fn main() {
9+
unsafe {
10+
libc::syscall(0);
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
thread 'main' panicked at 'unsupported Miri functionality: can't execute syscall with ID 0', $DIR/unsupported_syscall.rs:10:9
2+
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

0 commit comments

Comments
 (0)