Skip to content

Commit 6b4dbdb

Browse files
committed
Be more precise about mmap and undefined behavior.
`mmap` doesn't *always* cause undefined behavior; it depends on the details of how you use it.
1 parent 1f8a450 commit 6b4dbdb

File tree

1 file changed

+3
-3
lines changed
  • library/std/src/os/unix/io

1 file changed

+3
-3
lines changed

library/std/src/os/unix/io/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
//! other code using that file descriptor.
3333
//! This list doesn't include `mmap`, since `mmap` does do a proper borrow of
3434
//! its file descriptor argument. That said, `mmap` is unsafe for other
35-
//! reasons: it operates on raw pointers, and it has undefined behavior if the
36-
//! underlying storage is mutated. Mutations may come from other processes, or
37-
//! from the same process if the API provides `BorrowedFd` access, since as
35+
//! reasons: it operates on raw pointers, and it can have undefined behavior if
36+
//! the underlying storage is mutated. Mutations may come from other processes,
37+
//! or from the same process if the API provides `BorrowedFd` access, since as
3838
//! mentioned earlier, `BorrowedFd` values may be used in APIs which provide
3939
//! safe access to any system call. Consequently, code using `mmap` and
4040
//! presenting a safe API must take full responsibility for ensuring that safe

0 commit comments

Comments
 (0)