Skip to content

fix(fspy): run processes untracked when injection fails - #701

Open
lifeiscontent wants to merge 1 commit into
voidzero-dev:mainfrom
lifeiscontent:fix/fspy-untracked-fallback
Open

fix(fspy): run processes untracked when injection fails#701
lifeiscontent wants to merge 1 commit into
voidzero-dev:mainfrom
lifeiscontent:fix/fspy-untracked-fallback

Conversation

@lifeiscontent

Copy link
Copy Markdown

Motivation

Fixes #700.

Cached tasks run under fspy file tracking, which injects a preload library into every spawned process. For statically linked binaries the preload installs a seccomp user-notification filter before exec. In sandboxes that deny the seccomp syscall (rootless bubblewrap under a restrictive outer profile, some CI environments) that install fails with EPERM, and the interposed exec returned the error instead of running the program — every spawn in a cached task failed before the child ran.

Two adjacent failure modes had the same shape: the preload constructor aborted the host process when FSPY_PAYLOAD was missing or malformed (e.g. a leaked LD_PRELOAD in an env-scrubbed sandbox), and vt panicked when the preload library could not be written to the temp dir.

Tracking is observability; it must never break the process being traced.

Changes

  • exec/posix_spawn hooks: when the injection machinery fails, the run's trace is marked incomplete and the operation is executed untracked with the original arguments. Authentic exec failures (missing program, permissions) keep their original errno.
  • New Sender::report_loss on the shm channel sets the CLOSED gate, so a run with an escaped process is treated as untracked and never cached from a partial trace.
  • The preload constructor and channel attach no longer panic; the process runs untracked instead.
  • vt falls back to a plain untracked spawn when the tracked spawn itself fails, reported as "Not cached: file access tracking failed to start" rather than failing the task.

Affected tasks run normally but are not cached; declaring explicit input/output (without auto) restores caching in such environments.

In restricted sandboxes that deny the seccomp syscall, every spawn in a
cached task failed with EPERM: the preload installs a seccomp
user-notification filter before exec'ing a static binary, the install was
refused, and the interposed exec returned the error instead of running
the program.

Tracking must never break the traced process. The exec and posix_spawn
hooks now mark the run's trace incomplete and execute untracked with the
original arguments when injection fails. The preload constructor no
longer aborts the host process on a missing or malformed payload, and vt
falls back to an untracked spawn when the tracked spawn itself fails
(e.g. the preload library cannot be written to a read-only temp dir).

Runs with escaped processes are reported as not cached, never cached
from a partial trace; declaring explicit input/output config (without
auto) still caches in such environments.

Fixes voidzero-dev#700.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cached tasks cannot spawn child processes inside a rootless bubblewrap sandbox (EPERM)

1 participant