-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Tracking Issue for directory handles #120426
Copy link
Copy link
Open
Labels
A-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`Area: `std::io`, `std::fs`, `std::net` and `std::path`C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCO-fuchsiaOperating system: FuchsiaOperating system: FuchsiaT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`Area: `std::io`, `std::fs`, `std::net` and `std::path`C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCO-fuchsiaOperating system: FuchsiaOperating system: FuchsiaT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
View all comments
Feature gate:
#![feature(dirfd)]This is a tracking issue for directory handles. Such handles provide a stable reference to an underlying filesystem object (typically directories) that are less vulnerable to TOCTOU attacks and similar races. These security properties will be platform-dependent. Platforms that don't provide the necessary primitives will fall back to operations on absolute paths.
Additionally they may also provide performance benefits by avoiding repeated path lookups when performing many operations on a directory.
Sandboxing is a non-goal. If a platform supports upwards path traversal via
..or symlinks then directory handles will not prevent that. ProvidingO_BENEATH-style traversal is left to 3rd-party crates or future extensions.Public API
Steps / History
getdentsto get free conversion between dirfds andReadDir*atcallsUnresolved Questions
AdRawFdcan only be implemented on platforms that usedirfd, not allfdplatforms. Is this fine?Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩