Reproduced on Debian 5.19.11:
use nix::sched::{clone, CloneFlags};
fn main() {
let mut bytes = [0u8; 1024];
let cb = Box::new(|| 0isize) as Box<dyn FnMut() -> isize>;
let _ = clone(cb, &mut bytes[1024..], CloneFlags::CLONE_VM, None);
for byte in bytes {
assert_eq!(byte, 0);
}
}
Output:
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `48`,
right: `0`', src/main.rs:8:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
*** stack smashing detected ***: terminated
Segmentation fault
This function should be unsafe to call. Related: #360