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
This is unsound, because the pointer from as_ptr must never be written to
The caller must also ensure that the memory the pointer (non-transitively) points to is never written to (except inside an UnsafeCell) using this pointer or any pointer derived from it. If you need to mutate the contents of the slice, use as_mut_ptr.
IoVec::from_mut_slice
uses as_ptr() to get a mutable pointernix/src/sys/uio.rs
Lines 227 to 233 in 5cd01a1
This is unsound, because the pointer from as_ptr must never be written to
https://doc.rust-lang.org/std/primitive.slice.html#method.as_ptr
The code should use
as_mut_ptr()
instead ofas_ptr()
This problem may be occuring in other parts of the codebase too:
However, I don't know in which of these places the
*mut
pointer is actually written to later.vmsplice
is unsound too. It takesIoVec<&[u8]>
(immutable slice):nix/src/fcntl.rs
Lines 630 to 645 in 5cd01a1
However, the vmsplice syscall can write to the given memory:
https://man7.org/linux/man-pages/man2/vmsplice.2.html
Nix' vmsplice function should probably take
IoVec<&mut [u8]>
insteadThe text was updated successfully, but these errors were encountered: