Repository navigation
Conversation
The FICLONE path (taken on filesystems which support it, e.g. XFS and BTRFS) does a manual fchown operation after cloning the data. This causes the kernel to drop SUID and SGID bits, even when the caller is root or the ownership is already correct. Thus, binaries that typically have these bits (e.g. /usr/bin/mount) lose them when being installed into the initramfs on these filesystems. Reapply the original mode after chowning to prevent this.
There was a problem hiding this comment.
🔵 Needs a closer look
Because the change affects preservation of privileged SUID/SGID bits in initramfs files without a focused dracut-install clone-mode test, filesystem and privilege behavior still requires human validation.
No open issues 🎉
What changed in this PR
This PR preserves SUID and SGID permission bits when dracut-install uses the FICLONE path, preventing cloned executables from losing their special modes after ownership changes.
Changes:
- Reapply the source file’s mode with
fchmod()afterfchown(). - Log
fchmod()failures with the existing privilege-aware severity distinction.
| File | Description |
|---|---|
| src/install/dracut-install.c | Restores the cloned file’s original permission mode, including SUID/SGID bits, after ownership updates. |
Review effort: Lite
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The FICLONE path (taken on filesystems which support it, e.g. XFS and BTRFS) does a manual fchown operation after cloning the data. This causes the kernel to drop SUID and SGID bits, even when the caller is root or the ownership is already correct. Thus, binaries that typically have these bits (e.g. /usr/bin/mount) lose them when being installed into the initramfs on these filesystems.
Reapply the original mode after chowning to prevent this.
Checklist