Skip to content

Commit a01f36d

Browse files
committed
Add some documentation about why we do extra checking for /proc paths.
1 parent fc756ba commit a01f36d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/io/procfs.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
//! This module does a considerable amount of work to determine whether `/proc`
66
//! is mounted, with actual `procfs`, and without any additional mount points
77
//! on top of the paths we open.
8+
//!
9+
//! Why all the effort to detect bind mount points? People are doing all kinds
10+
//! of things with Linux containers these days, with many different privilege
11+
//! schemes, and we want to avoid making any unnecessary assumptions. Rustix
12+
//! and its users will sometimes use procfs *implicitly* (when Linux gives them
13+
//! no better options), in ways that aren't obvious from their public APIs.
14+
//! These filesystem accesses might not be visible to someone auditing the main
15+
//! code of an application for places which may be influenced by the filesystem
16+
//! namespace. So with the checking here, they may fail, but they won't be able
17+
//! to succeed with bogus results.
818
919
use crate::fd::{AsFd, BorrowedFd};
1020
use crate::ffi::ZStr;

0 commit comments

Comments
 (0)