Skip to content

library: explain TOCTOU races in fs::remove_dir_all #141832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

workingjubilee
Copy link
Member

@workingjubilee workingjubilee commented May 31, 2025

In the previous description it said there was a TOCTOU race but did not explain exactly what the problem was. I sat down with the CVE, reviewed its text, and created this explanation. This context should hopefully help people understand the actual risk as-such.

Incidentally, it also fixes the capitalization on the name of Redox OS.

Original CVE and advisory:

@rustbot
Copy link
Collaborator

rustbot commented May 31, 2025

r? @thomcc

rustbot has assigned @thomcc.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 31, 2025
@rustbot

This comment has been minimized.

@workingjubilee workingjubilee force-pushed the explain-what-toctou-races-are branch from 0cf4f0f to f2d07ee Compare May 31, 2025 20:15
@rustbot rustbot added the O-apple Operating system: Apple (macOS, iOS, tvOS, visionOS, watchOS) label May 31, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 31, 2025

These commits modify compiler targets.
(See the Target Tier Policy.)

@workingjubilee workingjubilee force-pushed the explain-what-toctou-races-are branch from f2d07ee to 993ab7c Compare May 31, 2025 20:18
@thomcc
Copy link
Member

thomcc commented May 31, 2025

Thanks!

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 31, 2025

📌 Commit 993ab7c has been approved by thomcc

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 31, 2025
@workingjubilee workingjubilee force-pushed the explain-what-toctou-races-are branch from 993ab7c to efb1c02 Compare May 31, 2025 20:27
@workingjubilee
Copy link
Member Author

typo fix thanks to jyn

@bors r=thomcc

@bors
Copy link
Collaborator

bors commented May 31, 2025

📌 Commit efb1c02 has been approved by thomcc

It is now in the queue for this repository.

In the previous description it said there was a TOCTOU race but did not
explain exactly what the problem was. I sat down with the CVE, reviewed
its text, and created this explanation. This context should hopefully
help people understand the actual risk as-such.

Incidentally, it also fixes the capitalization on the name of Redox OS.
@workingjubilee workingjubilee force-pushed the explain-what-toctou-races-are branch from efb1c02 to 7f7c415 Compare May 31, 2025 21:05
@workingjubilee workingjubilee added A-io Area: `std::io`, `std::fs`, `std::net` and `std::path` and removed O-apple Operating system: Apple (macOS, iOS, tvOS, visionOS, watchOS) labels May 31, 2025
@workingjubilee
Copy link
Member Author

@bors r-
r? @ChrisDenton

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 31, 2025
@workingjubilee workingjubilee added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 31, 2025
@ChrisDenton
Copy link
Member

Great, thanks!

@bors r=thomcc,ChrisDenton

@bors
Copy link
Collaborator

bors commented May 31, 2025

📌 Commit 7f7c415 has been approved by thomcc,ChrisDenton

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 31, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request May 31, 2025
…-races-are, r=thomcc,ChrisDenton

library: explain TOCTOU races in `fs::remove_dir_all`

In the previous description it said there was a TOCTOU race but did not explain exactly what the problem was. I sat down with the CVE, reviewed its text, and created this explanation. This context should hopefully help people understand the actual risk as-such.

Incidentally, it also fixes the capitalization on the name of Redox OS.

Original CVE and advisory:
- CVE: https://www.cve.org/CVERecord?id=CVE-2022-21658
- security advisory: https://groups.google.com/g/rustlang-security-announcements/c/R1fZFDhnJVQ?pli=1
- github cross-post: GHSA-r9cc-f5pr-p3j2
bors added a commit that referenced this pull request Jun 1, 2025
Rollup of 6 pull requests

Successful merges:

 - #141072 (Stabilize feature `result_flattening`)
 - #141215 (std: clarify Clone trait documentation about duplication semantics)
 - #141277 (Miri CI: test aarch64-apple-darwin in PRs instead of the x86_64 target)
 - #141521 (Add `const` support for float rounding methods)
 - #141812 (Fix "consider borrowing" for else-if)
 - #141832 (library: explain TOCTOU races in `fs::remove_dir_all`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7f306d5 into rust-lang:master Jun 1, 2025
9 checks passed
rust-timer added a commit that referenced this pull request Jun 1, 2025
Rollup merge of #141832 - workingjubilee:explain-what-toctou-races-are, r=thomcc,ChrisDenton

library: explain TOCTOU races in `fs::remove_dir_all`

In the previous description it said there was a TOCTOU race but did not explain exactly what the problem was. I sat down with the CVE, reviewed its text, and created this explanation. This context should hopefully help people understand the actual risk as-such.

Incidentally, it also fixes the capitalization on the name of Redox OS.

Original CVE and advisory:
- CVE: https://www.cve.org/CVERecord?id=CVE-2022-21658
- security advisory: https://groups.google.com/g/rustlang-security-announcements/c/R1fZFDhnJVQ?pli=1
- github cross-post: GHSA-r9cc-f5pr-p3j2
@rustbot rustbot added this to the 1.89.0 milestone Jun 1, 2025
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jun 1, 2025
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#141072 (Stabilize feature `result_flattening`)
 - rust-lang/rust#141215 (std: clarify Clone trait documentation about duplication semantics)
 - rust-lang/rust#141277 (Miri CI: test aarch64-apple-darwin in PRs instead of the x86_64 target)
 - rust-lang/rust#141521 (Add `const` support for float rounding methods)
 - rust-lang/rust#141812 (Fix "consider borrowing" for else-if)
 - rust-lang/rust#141832 (library: explain TOCTOU races in `fs::remove_dir_all`)

r? `@ghost`
`@rustbot` modify labels: rollup
@workingjubilee workingjubilee deleted the explain-what-toctou-races-are branch June 1, 2025 15:39
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Jun 3, 2025
…-races-are, r=thomcc,ChrisDenton

library: explain TOCTOU races in `fs::remove_dir_all`

In the previous description it said there was a TOCTOU race but did not explain exactly what the problem was. I sat down with the CVE, reviewed its text, and created this explanation. This context should hopefully help people understand the actual risk as-such.

Incidentally, it also fixes the capitalization on the name of Redox OS.

Original CVE and advisory:
- CVE: https://www.cve.org/CVERecord?id=CVE-2022-21658
- security advisory: https://groups.google.com/g/rustlang-security-announcements/c/R1fZFDhnJVQ?pli=1
- github cross-post: GHSA-r9cc-f5pr-p3j2
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Jun 3, 2025
Rollup of 6 pull requests

Successful merges:

 - rust-lang#141072 (Stabilize feature `result_flattening`)
 - rust-lang#141215 (std: clarify Clone trait documentation about duplication semantics)
 - rust-lang#141277 (Miri CI: test aarch64-apple-darwin in PRs instead of the x86_64 target)
 - rust-lang#141521 (Add `const` support for float rounding methods)
 - rust-lang#141812 (Fix "consider borrowing" for else-if)
 - rust-lang#141832 (library: explain TOCTOU races in `fs::remove_dir_all`)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-io Area: `std::io`, `std::fs`, `std::net` and `std::path` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants