about summary refs log tree commit diff
path: root/library/std/src/os/unix/io/mod.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-09-22 08:47:51 +0000
committerbors <bors@rust-lang.org>2023-09-22 08:47:51 +0000
commit5a4e47ebedb4132168c1b22262f21f0d3a2a96df (patch)
tree401ffc2bca0a4f6e300109cd5d73fd46a8344131 /library/std/src/os/unix/io/mod.rs
parent8759de0a4935e677fdce99a849addea2d5318da9 (diff)
parent1290cd432ddc3bf935cbd1d585b5999a38a103bc (diff)
downloadrust-5a4e47ebedb4132168c1b22262f21f0d3a2a96df.tar.gz
rust-5a4e47ebedb4132168c1b22262f21f0d3a2a96df.zip
Auto merge of #114780 - RalfJung:io-safety, r=Amanieu
add more explicit I/O safety documentation

Fixes https://github.com/rust-lang/unsafe-code-guidelines/issues/434
Cc https://github.com/rust-lang/rust/issues/114167
Cc `@Manishearth` `@sunfishcode` `@joshtriplett`
Diffstat (limited to 'library/std/src/os/unix/io/mod.rs')
-rw-r--r--library/std/src/os/unix/io/mod.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/library/std/src/os/unix/io/mod.rs b/library/std/src/os/unix/io/mod.rs
index 25b5dbff14f..c12d89ed637 100644
--- a/library/std/src/os/unix/io/mod.rs
+++ b/library/std/src/os/unix/io/mod.rs
@@ -6,7 +6,7 @@
 //!
 //! This module provides three types for representing file descriptors,
 //! with different ownership properties: raw, borrowed, and owned, which are
-//! analogous to types used for representing pointers:
+//! analogous to types used for representing pointers. These types reflect the Unix version of [I/O safety].
 //!
 //! | Type               | Analogous to |
 //! | ------------------ | ------------ |
@@ -65,15 +65,16 @@
 //! to be opened and read from or written must be `unsafe`. Rust's safety guarantees
 //! only cover what the program itself can do, and not what entities outside
 //! the program can do to it. `/proc/self/mem` is considered to be such an
-//! external entity, along with debugging interfaces, and people with physical access to
-//! the hardware. This is true even in cases where the program is controlling
-//! the external entity.
+//! external entity, along with `/proc/self/fd/*`, debugging interfaces, and people with physical
+//! access to the hardware. This is true even in cases where the program is controlling the external
+//! entity.
 //!
 //! If you desire to comprehensively prevent programs from reaching out and
 //! causing external entities to reach back in and violate memory safety, it's
 //! necessary to use *sandboxing*, which is outside the scope of `std`.
 //!
 //! [`BorrowedFd<'a>`]: crate::os::unix::io::BorrowedFd
+//! [I/O safety]: crate::io#io-safety
 
 #![stable(feature = "rust1", since = "1.0.0")]