You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The "validate" function tries to write data to a pipe from a pointer of unknown validity.
Unfortunately, the function tries to convert the possibly-invalid pointer to a slice, this is unsound and with recent rustc leads to the testsuite panicing
thread 'addr_validate::test::failed_validate' panicked at library/core/src/panicking.rs:220:5:
unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX`
In Debian I fixed this by using libc::write directly instead of nix::unistd::write
@plugwash , do you have any other case that could trigger the panic on validate? As far as I know, even though the test suite panic; however, no one will use it like this way (pass a constant address), isn't it?
Yes. I think validate(-1_i32 as usize as *const libc::c_void) is expected to return false here; however, it panic due to precondition check in from_raw_parts.
Related to #232
The "validate" function tries to write data to a pipe from a pointer of unknown validity.
Unfortunately, the function tries to convert the possibly-invalid pointer to a slice, this is unsound and with recent rustc leads to the testsuite panicing
In Debian I fixed this by using libc::write directly instead of nix::unistd::write
https://salsa.debian.org/rust-team/debcargo-conf/-/blob/master/src/pprof/debian/patches/use-libc-write-for-validation.patch
The text was updated successfully, but these errors were encountered: