Repository navigation
fix(metadata): force am_root=false under fake-super (#1926) - #3547
Merged
Merged
Conversation
Mirrors upstream rsync 3.4.1's am_root tri-state semantics: when --fake-super (or daemon `fake super = yes`) is active, the receiver must demote am_root to the negative sentinel that routes privileged operations (chown, mknod, mkfifo) through the user.rsync.%stat xattr placeholder branch instead of attempting real syscalls. Extracts an `effective_am_root(super_mode, fake_super) -> bool` helper covering the full truth table and rewires `LocalCopyOptions::am_root()` through it. Updates the two combined-flag tests that previously asserted the un-demoted behavior, and adds dedicated truth-table tests at the helper. upstream: options.c:89 - am_root tri-state, -1 is "fake-super" upstream: clientserver.c:1102-1105 - daemon fake super = yes forces -1 upstream: syscall.c do_mknod() - am_root<0 substitutes 0600 placeholder Refs #1926.
oferchen
force-pushed
the
fix/fake-super-am-root-gate-1926
branch
from
May 2, 2026 01:28
d37e402 to
6e48d9b
Compare
oferchen
marked this pull request as ready for review
May 2, 2026 03:42
oferchen
added a commit
that referenced
this pull request
May 5, 2026
Mirrors upstream rsync 3.4.1's am_root tri-state semantics: when --fake-super (or daemon `fake super = yes`) is active, the receiver must demote am_root to the negative sentinel that routes privileged operations (chown, mknod, mkfifo) through the user.rsync.%stat xattr placeholder branch instead of attempting real syscalls. Extracts an `effective_am_root(super_mode, fake_super) -> bool` helper covering the full truth table and rewires `LocalCopyOptions::am_root()` through it. Updates the two combined-flag tests that previously asserted the un-demoted behavior, and adds dedicated truth-table tests at the helper. upstream: options.c:89 - am_root tri-state, -1 is "fake-super" upstream: clientserver.c:1102-1105 - daemon fake super = yes forces -1 upstream: syscall.c do_mknod() - am_root<0 substitutes 0600 placeholder Refs #1926.
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.
Summary
Closes #1926.
When the receiver has
fake_superactive (CLI--fake-superor daemon modulefake super = yes), forceam_root = falsesemantics in the privilege-decision branches that gate ownership and special-file creation, matching upstream rsync 3.4.1.Upstream uses an
am_roottri-stateint:0- regular user1- real root2---super-1---fake-super/ daemonfake super = yesA negative
am_rootis the sentinel that routes privileged operations (chown,mknod,mkfifo) through theuser.rsync.%statxattr placeholder path instead of attempting real syscalls. Seeoptions.c:89,clientserver.c:1102-1105, andsyscall.c do_mknod()(theam_root < 0branch substitutes a 0600 regular file).Changes
effective_am_root(super_mode, fake_super) -> boolhelper incrates/engine/src/local_copy/options/metadata/accessors.rs. It returnsfalsewheneverfake_superis set, otherwise honourssuper_modefalling back to the effective UID check.LocalCopyOptions::am_root()through the helper so every privilege-decision call site sees the demotion uniformly.tests/execute_super.rsthat previously asserted the un-demoted behavior; add upstream citations to the rewritten assertions.super_mode = Nonecases).The helper is
pub(super)so internal call sites can be grown later (special-file executors, daemon hand-off path) without re-deriving the rule.Test plan
cargo fmt --all(clean).cargo clippy -p engine --all-features --all-targets -- -D warnings(clean).Upstream references
target/interop/upstream-src/rsync-3.4.1/options.c:89-am_roottri-state declaration.target/interop/upstream-src/rsync-3.4.1/options.c:653---fake-supersetsam_root = -1.target/interop/upstream-src/rsync-3.4.1/clientserver.c:1102-1105- daemonfake super = yesforcesam_root = -1.target/interop/upstream-src/rsync-3.4.1/syscall.c:90-174-do_mknod()am_root < 0placeholder substitution.