Skip to content

feat(fspy): replace Linux LD_PRELOAD and seccomp_unotify with freestanding ELF/SIGSYS tracker - #1029

Open
wan9chi wants to merge 2 commits into
fspy-linux/3-elf-loader-sigsysfrom
fspy-linux/4-linux-elf-sigsys-tracker
Open

wan9chi wants to merge 2 commits into
fspy-linux/3-elf-loader-sigsysfrom
fspy-linux/4-linux-elf-sigsys-tracker

Conversation

@wan9chi

@wan9chi wan9chi commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Motivation

On Linux, fspy previously maintained two separate tracking backends: LD_PRELOAD for dynamically linked glibc binaries and seccomp_unotify for static/musl binaries, leaving gaps for direct-syscall runtimes (such as Bun), preexisting LD_PRELOAD interference, and out-of-process supervisor complexity. Switching Linux to a single freestanding target_os = "none" ELF/SIGSYS launcher (fspy_preload_linux) unifies tracking across glibc, musl, static binaries, and direct-syscall runtimes, eliminates seccomp_unotify, and shares #![no_std] Unix exec/shebang resolution with macOS.

Changes

  • fspy_shared_unix: rewrite Unix exec/shebang/path resolution to #![no_std] shared by fspy_preload_linux and fspy_preload_macos, with unit tests.
  • fspy_preload_linux: add freestanding bare-metal ELF/SIGSYS launcher binary for x86_64-unknown-none and aarch64-unknown-none-softfloat (checked in .github/workflows/ci.yml).
  • fspy_preload_macos: replace fspy_preload_unix and fspy_client_unix with a macOS-only cdylib, and remove fspy_seccomp_unotify.
  • fspy: split src/unix/ into src/linux/ and src/macos/, add tests/linux_hardening.rs, and update tests/untracked_fallback.rs and existing suites.
  • vt_bin: update preexisting_ld_preload snapshot and add 10 JS ecosystem E2E cache fixtures (biome, deno, esbuild, miniflare, oxfmt, rspack, sass-embedded, sharp, tailwindcss-v4, tsx).
  • CHANGELOG.md: add user-facing changelog entry referencing PRs feat(fspy_nostd): add Unix filesystem, I/O, and path-resolution primitives #1026–feat(fspy): replace Linux LD_PRELOAD and seccomp_unotify with freestanding ELF/SIGSYS tracker #1029.

Stack created with GitHub Stacks CLI • Give Feedback 💬


Note

High Risk
This rewrites how tracked processes are spawned on Linux (seccomp, exec chaining, and cache correctness when tracking is incomplete), which is security- and correctness-critical for task caching.

Overview
Replaces Linux automatic file-access tracking that split LD_PRELOAD (glibc) and seccomp_unotify (static/musl/direct syscalls) with a unified in-process path: fspy materializes and execs the freestanding fspy_preload_linux launcher, which loads targets via fspy_elf_loader and records filesystem activity through a SIGSYS / SECCOMP_RET_TRAP filter into the existing IPC channel. Child execve/execveat calls are chained through the same launcher; when seccomp or launcher setup is unavailable, spawn falls back to untracked execution and TrackingIncomplete.

The Unix stack is split by OS: new src/linux/ and src/macos/ replace src/unix/; fspy_preload_macos (renamed from fspy_preload_unix) keeps dyld interposition, while fspy_client_unix, fspy_seccomp_unotify, and related workspace deps are removed. CI cross-clippy now includes fspy_preload_linux; tests add linux_hardening.rs, broaden Bun/static/shebang coverage, and rework untracked-fallback assertions for the new bootstrap model.

Reviewed by Cursor Bugbot for commit 0adff27. Bugbot is set up for automated code reviews on this repo. Configure here.

@socket-security

socket-security Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​tailwindcss/​cli@​4.3.51001007798100
Addednpm/​tsx@​4.23.151001008187100
Addednpm/​@​rspack/​core@​2.3.41001008197100
Addednpm/​tailwindcss@​4.3.51001008498100
Addednpm/​@​rspack/​cli@​2.3.41001008697100
Addednpm/​sass-embedded@​1.108.29810010094100
Addednpm/​@​biomejs/​biome@​2.6.9100100100100100

View full report

@wan9chi
wan9chi added this pull request to stack #1030 November 27, 2026 00:33
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

fspy benchmark

linux

dynamic/launch             change +43.60%  [+32.27% .. +54.85%]  overhead  +137.56%
dynamic/access             change +388.02%  [+230.72% .. +419.47%]  overhead  +466.31%
dynamic/access-relative    change +281.73%  [+218.08% .. +318.33%]  overhead  +552.10%
dynamic/access-contended   change +116.85%  [+93.52% .. +151.93%]  overhead  +126.37%
static/launch              change +26.04%  [+15.74% .. +33.96%]  overhead  +283.17%
static/access              change -62.66%  [-78.30% .. -60.58%]  overhead  +423.27%
static/access-relative     change -66.06%  [-71.65% .. -56.43%]  overhead  +534.74%
static/access-contended    change -86.37%  [-88.04% .. -82.61%]  overhead  +114.30%

macos

dynamic/launch             change  -7.73%  [-10.09% ..  -5.28%]  overhead  +201.51%
dynamic/access             change  -2.40%  [ -4.80% ..  +0.00%]  overhead    +5.16%
dynamic/access-relative    change  -0.52%  [ -1.77% ..  +2.13%]  overhead  +266.97%
dynamic/access-contended   change  -0.58%  [ -2.62% ..  +1.79%]  overhead    +2.22%

windows

dynamic/launch             change  +0.70%  [ -4.95% ..  +4.47%]  overhead   +26.63%
dynamic/access             change  -0.18%  [ -2.34% ..  +1.47%]  overhead    +1.44%
dynamic/access-relative    change  +0.00%  [ -2.10% ..  +2.81%]  overhead    +1.77%
dynamic/access-contended   change  +0.00%  [ -5.71% ..  +4.83%]  overhead    +1.38%

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread crates/fspy_preload_linux/src/main.rs Resolved
Comment thread crates/fspy_preload_linux/src/main.rs Resolved
wan9chi and others added 2 commits November 27, 2026 08:45
…nding ELF/SIGSYS tracker

Switch Linux file-access tracking from `LD_PRELOAD` + `seccomp_unotify`
to the freestanding `target_os = "none"` ELF launcher + `SIGSYS`
backend (`fspy_preload_linux`), unify Unix exec/shebang resolution in
`no_std` `fspy_shared_unix`, simplify macOS into `fspy_preload_macos`,
and add Linux hardening and JS ecosystem E2E cache tests:

- `fspy_shared_unix`: rewrite exec/shebang/path resolution to `#![no_std]`
  shared across `fspy_preload_linux` and `fspy_preload_macos`, with unit
  tests for Linux, macOS, and `nostd_exec`.
- `fspy_preload_linux`: freestanding bare-metal ELF/`SIGSYS` launcher
  binary built for `x86_64-unknown-none` and
  `aarch64-unknown-none-softfloat` (checked in CI).
- `fspy_preload_macos`: macOS-only `cdylib` replacing `fspy_preload_unix`
  and `fspy_client_unix`; remove `fspy_seccomp_unotify`.
- `fspy`: split `src/unix/` into `src/linux/` and `src/macos/`, add
  `tests/linux_hardening.rs` and update `tests/untracked_fallback.rs` and
  existing suites.
- `vt_bin`: update `preexisting_ld_preload` snapshot and add 10 JS
  ecosystem E2E cache fixtures (`biome`, `deno`, `esbuild`, `miniflare`,
  `oxfmt`, `rspack`, `sass-embedded`, `sharp`, `tailwindcss-v4`, `tsx`).
- `CHANGELOG.md`: add user-facing entry referencing all 4 PRs in the stack.

Co-authored-by: Gemini 4 Neon <noreply@google.com>
Co-authored-by: Gemini 4 Neon <noreply@google.com>
@wan9chi
wan9chi force-pushed the fspy-linux/4-linux-elf-sigsys-tracker branch from e620865 to 0adff27 Compare November 27, 2026 00:46

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0adff27. Configure here.

}
joined.extend_from_slice(raw);
send_path(mode, BStr::new(&joined));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed relative accesses look complete

High Severity

When resolving a relative path or fd for a trapped filesystem syscall fails (fd_path returning None or an error, or a join allocation failing), the interceptor records nothing and still replays the syscall. The kernel can succeed, but the run is still reported as a complete trace, so cache can hit with missing inputs.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0adff27. Configure here.

This branch has not been deployed

No deployments
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.

1 participant