fix(spawner): resolve privileged wrappers to absolute paths + log spawn context #131
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "absolute-spawn-wrappers"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Targets the FreeBSD
colibri-daemonspawnPermission denied (os error 13)(works from shell, fails inside the daemon).Root-cause hypothesis this addresses: the jail spawn path launches its wrapper by bare name (
sudo/jexec/mdo,priv_wrap()) and relies onexecvp+ the daemon's inheritedPATH. Underdaemon(8)/rc thatPATHis often empty or reordered, soexecvpeither misses the binary (ENOENT) or hits a non-executable same-named entry first and returnsEACCES— exactly the observed failure, and exactly why the same command works from an interactive shell.Changes
resolve_program()absolutizes a bare program name against a fixed search list (/usr/local/sbin,/usr/local/bin,/usr/sbin,/usr/bin,/sbin,/bin); first regular executable wins. Slash-bearing paths pass through untouched; nothing-found falls back to the bare name so the OS still reports a real error.spawn_prepared_childnow logs resolved program, requested name, full argv, and PATH before spawning — the old"attempting spawn"log had no spawn-context detail, which is why the failure was opaque.Why it helps even if a MAC policy is also involved: it removes PATH-search
EACCESas a variable, so atruss/ktracerun can attribute any remaining denial to an actual kernel/MAC policy onexecverather than to PATH resolution. Note: capsicum is already ruled out (not used anywhere in the crate, and capability-mode denial returnsECAPMODE, notEACCES).Tests:
resolve_programpass-through, absolutization (sh), and missing-name fallback.cargo clippy -p colibri-daemonclean; spawner tests green.Next step for the FreeBSD host: rebuild, rerun under
truss -f, and read theexecve(...)line — the new log prints the exact resolved path it attempts.🤖 Generated with Claude Code