Skip to content

Conversation

@aristarhoskal
Copy link

Fixes #10020

  • Instead of setting permissions via std::fs::set_permissions mode is passed directly to libc::mkfifo
  • Updated test_create_fifo_permission_denied expecting a "permission denied" error since there is no longer a separate step in setting permissions
  • In order to apply -m mode correctly and ignore umask which is applied automatically with mkfifo, without std::fs::set_permissions we temporarily set umask to 0.

@aristarhoskal aristarhoskal force-pushed the fix_mkfifo_chmod_race branch from c7f5277 to 003e34e Compare January 4, 2026 15:07
@github-actions
Copy link

github-actions bot commented Jan 4, 2026

GNU testsuite comparison:

Congrats! The gnu test tests/printf/printf-surprise is now passing!

@aristarhoskal aristarhoskal force-pushed the fix_mkfifo_chmod_race branch 2 times, most recently from f640c78 to 36253b5 Compare January 4, 2026 15:54
@github-actions
Copy link

github-actions bot commented Jan 4, 2026

GNU testsuite comparison:

Congrats! The gnu test tests/printf/printf-surprise is now passing!

if let Err(e) = fs::set_permissions(&f, fs::Permissions::from_mode(mode)) {
return Err(USimpleError::new(
1,
translate!("mkfifo-error-cannot-set-permissions", "path" => f.quote(), "error" => e),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we want to keep the error display here, no ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are right, we can check errno to see if we cannot set permissions, since permissions are set by mkfifo now.

@aristarhoskal aristarhoskal force-pushed the fix_mkfifo_chmod_race branch from 36253b5 to 36c1a2f Compare January 4, 2026 19:27
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@aristarhoskal aristarhoskal force-pushed the fix_mkfifo_chmod_race branch from 36c1a2f to 7845e90 Compare January 5, 2026 09:54
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mkfifo TOCTOU race via path-based chmod

2 participants