Repository navigation
fix(daemon): keep a dead name converter apart from an unknown name - #7629
Merged
Merged
Conversation
oferchen
force-pushed
the
fix/daemon-name-converter-fail-closed
branch
2 times, most recently
from
September 2, 2026 15:07
3cb5870 to
9ad6c29
Compare
The daemon's `name converter` query returned `Option<String>`, so five situations reached the caller as the same `None`: a usable answer's absence, an empty answer, a name refused for carrying a control byte, a request too long to frame, and a converter whose request/answer stream had broken. Upstream can afford a bare `BOOL` because two of those never return - `namecvt_call()` calls `exit_cleanup(RERR_UNSUPPORTED)` on an over-long request (clientserver.c:1324-1327) and `exit_cleanup(RERR_SOCKETIO)` on a failed write (:1329-1334) - so its `False` only ever means "the converter answered, and the answer is no id" (:1317-1319, :1345-1354). Merging those two classes fails open. An operator configures `name converter` precisely to take ownership decisions away from the peer; a converter that has died then reports every name as unresolved, and uidlist.c:273-282 keeps the SENDER's numeric id for each one - silently restoring the mapping the directive exists to prevent. Model the four outcomes instead of the sentinel: Resolved(v) a usable answer clientserver.c:1355-1359 True Unknown an empty or malformed answer clientserver.c:1345-1354 False Refused a control byte in the name clientserver.c:1317-1319 False Failed(err) over-long request / dead pipe clientserver.c:1326, :1333 exit `ConverterOutcome` carries them out of `NameConverterCallbacks`, and the converter's own liveness lives in its type - the pipes are a `Result<ConverterStream, ConverterDeath>`, so a stream that has broken cannot be spoken to again and reported as "no such name". `LookupError` then keeps the two back ends' failures apart at the lookup API, because upstream treats them differently: a `getpwnam()` that yields nothing is "no id" (uidlist.c:160-163), a converter failure ends the session. Callers that used to write `.ok().flatten()` go through `no_id_unless_converter_failed()`, which is that asymmetry written once, and `IdList::read()`'s resolver became fallible so the receiver's name-to-id pass propagates it. Also add the empty-name guard to the non-Unix lookups (uidlist.c:146-147, :172-173), where upstream decides an empty name before consulting any back end; the Unix half already had it, but its test used a converter that answered "unknown" and so passed with the guard removed. It now uses one that fails every query, which makes reaching the converter observable.
oferchen
force-pushed
the
fix/daemon-name-converter-fail-closed
branch
from
September 2, 2026 15:42
9ad6c29 to
22921f5
Compare
oferchen
added a commit
that referenced
this pull request
Sep 2, 2026
… merged PRs (#7634) * docs(rustdoc): reach the public items rustdoc could not see, and gate the class Two halves of the same question - is what a public item says actually reachable from `cargo doc`? Half 1: seven `//` comment blocks documented a `pub` item, so their text never reached the generated docs. Found positionally, not by content: a `//` run whose next non-attribute line declares a `pub` item. A census keyed on comment CONTENT is false-positive dominated; this one is mechanical. Nine sites matched; two are DELIBERATELY left as `//`, because they document the `#[cfg_attr]` / `#[allow]` attribute directly beneath them rather than the item - `local_copy/overrides.rs` and `local_copy/plan/report.rs`. Promoting those would attach a lint rationale to a public surface as if it described the surface. Text is preserved verbatim, upstream citations included (`generator.c:2149` on the obstacle module). The only rewrite is `socket_options/consts.rs`, where one group note covered two constants: split per item, matching the file's own house style where every other const already carries `///`. Half 2: five intra-doc links could not resolve in a DEFAULT build, and the existing gate is structurally unable to see them. crates/fast_io/src/lib.rs, ewma.rs (x4) -> `adaptive_dispatch`, gated by the off-by-default `adaptive-basis-dispatch` feature crates/rsync_io/.../sync_bridge.rs -> `crate::channel_adapter`, gated by the off-by-default `async-ssh` feature crates/fast_io/src/confinement.rs -> `PinnedRoot`, a PRIVATE struct plus one already on the branch in `module_list/types.rs`, where the link was `Transport::Quic` (the `quic` feature) and its surrounding prose still described the variant as unbuilt. Every crate denies `rustdoc::broken_intra_doc_links`, so each of these is a hard `cargo doc` failure, not a warning. MEASURED on the pristine base: cargo doc --no-deps --workspace -> 7 errors, `fast_io` and `rsync_io` could not be documented cargo doc --no-deps --workspace --all-features -> clean That gap is the whole point. Under `--all-features` the gated items EXIST, so the link resolves and the gate is green; in a default build the item is not compiled at all. `ci.yml`'s `rustdoc-links` job runs only `--all-features`, deliberately mirroring `pages.yml` - which is right for the question Pages asks and cannot ask this one. So the fix is paired with a SECOND step on default features, and neither subsumes the other: `crates/fast_io/src/io_uring` is `cfg(all(target_os = "linux", feature = "io_uring"))` and only the all-features run compiles it. The names stay in backticks with the reason stated at each site, rather than being deleted or the links made conditional - the prose still says what it said, and the next reader learns why it is not a link. After: both invocations document all 25 crates cleanly, 0 errors. fmt clean; clippy on the five touched crates reports no new diagnostics. * docs(changelog): record the ten pull requests merged since the last sweep #7624 brought the Unreleased section up to #7620 and then stopped being true: #7621-#7632 landed after it, of which #7624 is itself that changelog pass and #7628 was never merged. Ten entries were missing. Each is placed in the subsection its change belongs to rather than appended in number order, and #7625 is SPLIT across two, because it is two changes: wiring `--force` is a receiver fix, and the synthetic-transfer-root guard that wiring made necessary is a peer-supplied input bound. Filing it once under either heading would have hidden whichever half the reader was looking for. Security / peer-supplied input bounds #7625 (guard half), #7630 Fixed / transfer and receiver #7622, #7625 (--force half), #7627 Fixed / daemon #7629 Testing and CI #7621, #7623, #7632 Documentation #7626, #7631 Wording is taken from each merge commit's own body, not from its title - the titles compress away the part a reader needs. #7629's title says "keep a dead name converter apart from an unknown name"; what makes it worth an entry is that five outcomes collapsed into one `None` and the merge failed OPEN on exactly the mechanism an operator installs to take ownership decisions away from the peer.
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.
Residuals from the daemon name-converter work (task 751), following the request-side newline-injection fix in #7346.
What was wrong
NameConverter::query()returnedOption<String>. Five situations arrived at the caller as oneNone:namecvt_call, clientserver.c:1311)True(:1355-1359)Some(line)False(:1345-1346)NoneFalse(:1347-1354)NoneFalse(:1317-1319), nothing writtenNoneexit_cleanup(RERR_UNSUPPORTED)(:1324-1327)Noneexit_cleanup(RERR_SOCKETIO)(:1329-1334)NoneFalse(:1336-1337), then the next request's write exits at :1333NoneUpstream gets away with a bare
BOOLbecause the two fatal rows never return.Falsetherefore only ever means "the converter answered, and the answer is no id". Merging the fatal rows into it fails open: a daemon module configuresname converterto take ownership decisions away from the peer, and a converter that has died then reports every name as unresolved - at which pointrecv_add_id()(uidlist.c:273-282) keeps the sender's numeric id for each one.What changed
The four outcomes are a type.
ConverterOutcome<T>=Resolved/Unknown/Refused/Failed(io::Error), returned byNameConverterCallbacks, with each arm carrying its upstream citation. The converter's own liveness is in its type too: the pipes are aResult<ConverterStream, ConverterDeath>, so a stream that has broken cannot be spoken to again and reported as "no such name".Fail closed at the lookup API.
LookupErrorsplitsDatabasefromConverter, because upstream treats them differently - agetpwnam()that yields nothing is "no id" (uidlist.c:160-163), a converter failure ends the session.no_id_unless_converter_failed()is that asymmetry written once; the call sites that used.ok().flatten()now go through it, andIdList::read()'s resolver became fallible so the receiver's name-to-id pass propagates a converter failure instead of keeping the sender's ids.Empty-name guard on the non-Unix lookups (uidlist.c:146-147, :172-173), where upstream decides an empty name before consulting any back end.
Refuted / corrected
nss.rs) and is not new here. What was missing is the non-Unix half - and, more usefully, its Unix test could not see the guard: it installed a converter that answered "unknown", solookup_user_by_name(b"")returnedNonewhether or not the guard existed. Removing the guard did not redden it. The test now installs a converter that fails every query, which makes reaching the converter observable; both halves are now mutation-killed.strdup("")s it (clientserver.c:1357). The two are wire-equivalent (an empty name is written with length 0 and read back as no name), and "unknown" is the arm the CVE-2026-53798 fix asks for.Mutation results
Each production change was reverted individually;
passed + failed == runon every row, so no kill list was truncated.Failedmaps toOk(None)ininto_lookupUnknownIdList::readswallows the resolver's errorno_id_unless_converter_failedtolerates the converter toonss_stubiscfg(not(unix)); its test runs in the Windows jobBaseline after every revert: 39/39 green.
Verification
Rebased onto master
023b695fa; head22921f56b. Every number below was measured on that head, not on the original base.cargo fmt --all -- --check: exit 0.cargo nextest run -p metadata -p protocol -p daemon -p transfer -p batch: 11395 passed, 0 failed.cargo nextest run --workspace: 32597 run, 32595 passed, 2 failed - neither in a crate this branch touches:xtask ... backdated_tree_populates_and_backdates_the_rootshells out totouch -d @epoch, a GNU-ism BSDtouchrejects, so it fails on macOS regardless of this branch.bandwidth limiter::tests::convergence::debt_decreases_toward_zero_over_steady_stateis a timing convergence assertion; it passes 3/3 in isolation, and this branch changes zero files incrates/bandwidth.engine execute_sparse_with_multiple_hole_patterns,core run_client_sparse_copy_creates_holes, then this one), each passing on isolated re-run and each in a crate outside this diff - host noise, not a footprint.cargo clippy --locked --workspace --all-targets --all-features --no-deps: exit 0, 0 errors. Thecollapsible_ifwarnings in touched files (idlist/mod.rs:222,name_cache.rs:60/87,nss.rs:301) all sit outside this diff's hunks.python3 tools/ci/citation_drift_audit.py --ratchet(the gate strengthened by fix(sender): skip a directory operand when xfer_dirs is off #7627): ratchet OK. This branch adds 9 citations to the scanned population (5263 vs master's 5254) and 0 new suspected-drift findings (374 on both). The advisorytransfer improved 6 -> 4; lower the baselinenote reproduces on pristine master, so it is pre-existing baseline slack, not this branch's doing.cargo check --target x86_64-pc-windows-gnu -p metadata -p daemon -p transfer -p batch(incl.--all-targetsfor metadata) clean, since the non-Unix lookups and the Windows converter both changed shape.into_lookup4 RED,eof_unknown2,not_sticky1,idlist_swallow1,receiver_tolerates1,nss_empty_name1; baseline 39/39 after every revert, andpassed + failed == runon every row.Rebase collision check
86a549bbf(#7612) restructured the resumable walk and collapsed the parallel NDX fields intoNdxMap, touching two files this branch also touches. The rebase replayed with no conflict and the overlap is genuinely disjoint: master's edits are inassign_hardlink_indices/send_file_list's sub-list push, this branch's incollect_id_mappings/collect_acl_id_mappings. Both survive in the rebased tree (ndx_map.first_ndx_start()still athardlinks.rs:40andprotocol_io.rs:747); the restructure added no new callers of the two functions whose signature changed, and no newIdList::readcall sites. Master carries none of this work (git grepforConverterOutcome|LookupError|no_id_unless_converter_failed|ConverterDeathonorigin/masteris empty, and master'squery()still returnsOption<String>), so nothing here regresses it.Known residuals (not addressed here)
invalid name-converter token: %sto FERROR (clientserver.c:1318); theRefusedarm here is silent, because the converter holds no log sink. Routing one in is a separate change.id_lookup::cache::map_uid_uncached()and the--usermap/--groupmapACL mappers still fold a lookup error into "keep the id". They run after the id-list pass that now aborts, so a dead converter no longer reaches them, but they are not themselves fail-closed.engine/src/local_copy/executor/directory/recursive/batch.rs:98,103still uses.ok().flatten(). That is the local-copy executor, where no name converter is ever installed (only the daemon session thread installs one), so it stays tolerant by construction rather than by oversight.