Strange Miri behaviour
⚓ Rust 📅 2025-09-13 👤 surdeus 👁️ 13Hello! I tried to run simple winit example with miri and got this error:
error: unsupported operation: can't call foreign function `socket` on OS `linux`
--> /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/net/connection/socket/unix.rs:93:34
|
93 | let fd = cvt(libc::socket(fam, ty | libc::SOCK_CLOEXEC, 0))?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsupported operation occurred here
|
= help: this means the program tried to do something Miri does not support; it does not indicate a bug in the program
Than I passed glibc as allowed external binding (MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-native-lib=/lib/x86_64-linux-gnu/libc.so.6") and got this:
error: Undefined Behavior: pointer not dereferenceable: pointer must point to some allocation, but got 0x7fc43f91bad0[noalloc] which is a dangling pointer (it has no provenance)
--> /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.38.44/src/backend/libc/thread/syscalls.rs:309:5
|
309 | / weak_or_syscall! {
310 | | fn gettid() via SYS_gettid -> c::pid_t
311 | | }
| |_____^ Undefined Behavior occurred here
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Is this Miri or Rustix crate bug or is this intentional? Am I getting something wrong?
2 posts - 2 participants
🏷️ Rust_feed