Files
codebase-memory-mcp/docs
Martin Vogel 6eb33534f6 fix(daemon): explain foreign-owned cache ancestors and warn on network filesystems (#1717)
A cache root whose resolved path runs through a directory owned by another
non-root account (typical on shared/HPC filesystems where ~/.cache is a
symlink into a shared tree) is refused by the private-directory walk. The
refusal itself is correct: the owner of an ancestor can rename or replace
everything below it after the walk, so it could redirect the cache. But
posix_directory_transition_secure() set no validation detail, so the caller
printed "ancestry component validation failed (errno 17)" -- a stale EEXIST
from mkdirat() that named neither the directory nor the reason.

- The refusal now names the directory, its owner uid and account name, the
  caller's uid, and the remedy (a location with a self/root-owned ancestry,
  e.g. via CBM_CACHE_DIR). The path is shortened from the left so the
  remedy always fits the 384-byte detail buffer.
- On Linux the account name is read from /etc/passwd, not getpwuid(). The
  release binary is statically linked against glibc, and getpwuid() there
  loads the host's NSS modules at runtime, which can crash on a glibc
  version mismatch (a real risk on sssd/LDAP cluster hosts). Accounts that
  exist only in a directory service are shown by uid.
- New advice-only check: on Linux, a cache root on NFS, CIFS, SMB2, Lustre
  or GPFS (statfs f_type) logs one daemon.cache_root_network_fs warning per
  process. SQLite WAL is unreliable on network filesystems. Nothing is
  refused.
- docs/CONFIGURATION.md gains a "Shared / HPC filesystems" section.

The ownership policy is unchanged, and there is still no override (same
stance as #1830).

Test seams: one seam reports a directory (matched by dev/ino) as
foreign-owned, and another supplies the statfs magic. The refusal, the
message and the once-per-process warning are therefore testable without
root and on every platform.

Refs #1717

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-09-30 23:33:54 +02:00
..