You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fs origin: a FIFO swapped in between resolve and open still blocks a blocking-pool thread #2802
FilesystemOrigin::resolve_regular stats the canonical path and refuses anything that is not a regular file, before any read opens it. The readers then open the path with plain tokio::fs::File::open, which opens read-only without O_NONBLOCK. If someone with write access to cache.origin.path renames a FIFO into place between that stat and the open, the open blocks until a writer appears. fetch and fetch_outboard re-check the type on the opened file, but that check runs after the open returns. fetch_range_data does not re-check.
Cost:within_origin_timeout ends the request, but the blocking-pool thread stays stuck in open(2). An attacker who keeps swapping a file and a FIFO can pin one thread per race they win, and enough wins exhaust tokio's blocking pool. The same window lets a symlink swapped in after canonicalize point outside the base. The fstat does not re-check containment.
Fix options:
Open with O_NONBLOCK through std::os::unix::fs::OpenOptionsExt::custom_flags, then clear it, or rely on the fstat is_file check that follows, since regular-file reads ignore O_NONBLOCK.
Open the canonical path with O_NOFOLLOW so a swapped-in symlink fails, which closes the containment half too. openat2(RESOLVE_BENEATH) on Linux closes it fully.
Both need a libc constant (or rustix). The workspace has no libc dependency today; crates/common/src/identity.rs defers an O_NOFOLLOW open for the same reason. This issue decides whether the cache crate takes that dependency.
Done when a FIFO or symlink swapped in after the resolve cannot block or escape any filesystem-origin read, with a test that renames a FIFO into place and asserts each read returns within a bound.
Since PR #2815, FilesystemOrigin::size() opens the file too, so the probe and rescan paths reach the same race. The fix for this issue must cover size() as well as fetch, fetch_range_data and fetch_outboard.
Activity
fix(cache,node): review follow-ups for #2631/#2801 — fault-cause fide…
yigitdot commentedon Nov 1, 2026
Since PR #2815,
FilesystemOrigin::size()opens the file too, so the probe and rescan paths reach the same race. The fix for this issue must coversize()as well asfetch,fetch_range_dataandfetch_outboard.🤖 Generated with Claude Code
fix(node,cache): capability intake/expiry visibility and fs origin fa…