-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pipe shim ICEs when testing ciborium #3839
Comments
This might be caused by these four lines: miri/src/shims/unix/unnamed_socket.rs Lines 379 to 382 in cb55919
When I only run the first 2 lines: let pipefd0 = Scalar::from_int(3, pipefd.layout.size);
this.write_scalar(pipefd0, &pipefd)?; It shows the exact ICE as described. But when I only run the last 2 lines, let pipefd1 = Scalar::from_int(4, pipefd.layout.size);
this.write_scalar(pipefd1, &pipefd.offset(pipefd.layout.size, pipefd.layout, this)?)?; miri will throw UB error: error: Undefined Behavior: memory access failed: expected a pointer to 8 bytes of memory, but got alloc1145+0x8 which is at or beyond the end of the allocation of size 8 bytes
--> ./tests/pass-dep/libc/libc-pipe.rs:104:25
|
104 | assert_eq!(unsafe { pipe(&mut fds) }, 0);
| ^^^^^^^^^^^^^^ memory access failed: expected a pointer to 8 bytes of memory, but got alloc1145+0x8 which is at or beyond the end of the allocation of size 8 bytes
|
= 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 |
Fix is up at #3840. We really need to always use |
#3841 tracks fixing the remaining cases of this. What I am not sure is how to avoid people re-introducing more |
fix calling pipe, pipe2, socketpair with a pointer-to-array Fixes rust-lang/miri#3839
From https://github.com/enarx/ciborium/blob/b88768015e5664e41634c094966ac989057bffca/ciborium/tests/fuzz.rs#L22-L29
ICEs with
The text was updated successfully, but these errors were encountered: