-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
mknod: fix SELinux cleanup when context setting fails #10582
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
mknod: fix SELinux cleanup when context setting fails #10582
Conversation
|
GNU testsuite comparison: |
|
It looks like CI failed in an unrelated Happy to rebase or rerun CI if needed. |
|
Can you make a regression test for this in test_mknod.rs? |
|
test_selinux_invalid in tests/by-util/test_mkdir.rs is almost identical You can use arg("p") for FIFO and at.file_exists() instead of at.dir_exists() |
|
GNU testsuite comparison: |
|
can you run cargo fmt? |
I ran cargo fmt and cargo fmt --check locally — both complete successfully with no changes. |
|
The error in the CI https://github.com/uutils/coreutils/actions/runs/21542607295/job/62082424264?pr=10582 is That is good feedback though, I think there should be a way that we can change the settings to make it so that no matter what platform you're on it can fix this errors. I'm assuming you're on a windows or mac? |
|
GNU testsuite comparison: |
I noticed other test files end with a newline, so I added one here as well. Yes, i am on mac |
|
Thanks for the contribution! |
Summary
Fixes SELinux cleanup logic in
mknodwhen setting the security context fails.Previously, uutils attempted to clean up a partially created device node using
std::fs::remove_dir, which does not work for device nodes or FIFOs. This could leave behind a mislabeled node on SELinux-enforcing systems.Changes
std::fs::remove_dirwithstd::fs::remove_filefor proper cleanupTest / Reproduction Steps