Skip to content

feat(fspy_nostd): add Unix filesystem, I/O, and path-resolution primitives - #1026

Open
wan9chi wants to merge 2 commits into
mainfrom
fspy-linux/1-nostd-primitives
Open

wan9chi wants to merge 2 commits into
mainfrom
fspy-linux/1-nostd-primitives

Conversation

@wan9chi

@wan9chi wan9chi commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Motivation

Replacing Linux LD_PRELOAD and seccomp_unotify with an in-process freestanding (target_os = "none") ELF/SIGSYS launcher requires no_std Unix filesystem, I/O, and allocator-backed path-resolution primitives shared between the freestanding Linux launcher and the macOS preload library.

Changes

  • fspy_nostd: add Error::ACCES (plus .typos.toml), pread, faccessat, stat/fstat, getcwd, readlinkat/fcntl_getpath, and OwnedFd::from_raw_fd, with unit tests.
  • fspy_nostd_alloc: add allocator-backed getcwd, fd_path, resolve_path_at, and PooledBump helpers, with unit tests.
  • vt_ipc_str: expose IpcStr::as_bytes for Unix and target_os = "none".
  • fspy_shared: gate host dev-dependencies on not(target_os = "none") for bare-metal builds.

Stack created with GitHub Stacks CLI • Give Feedback 💬


Note

Medium Risk
Large expansion of low-level syscall/fs and path-resolution code used in constrained (SIGSYS/preload) contexts; logic errors could mis-resolve paths or mishandle fds, though changes are well-tested.

Overview
Expands fspy_nostd Unix surface for freestanding/macOS preload: more Error errno constants (including ACCES), pread, faccessat with AccessFlags, richer Stat / is_regular_file(), extra OFlags, Linux fcntl dup/CLOEXEC helpers, and public OwnedFd::from_raw_fd, each covered by new tests.

fspy_nostd_alloc adds allocator-backed fd_path (CWD, /proc/self/fd, or macOS fcntl_getpath) and resolve_path_at for joining paths relative to a dirfd, plus a PooledBump wrapper that uses inline(never) on allocator methods in debug builds to avoid stack blowups on tight signal/vfork stacks.

Smaller follow-ons: IpcStr::as_bytes on Unix/none, fspy_shared dev-deps gated off bare metal, tempfile as alloc-crate dev-dep, and .typos.toml allow ACCES.

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

…tives

Add low-level `no_std` filesystem, I/O, and allocator-backed path
resolution primitives needed by the freestanding Linux ELF/SIGSYS
tracker and shared Unix exec resolver:

- `fspy_nostd`: `Error::ACCES`, `pread`, `faccessat`, `stat`/`fstat`,
  `getcwd`, `readlinkat`/`fcntl_getpath`, plus unit tests.
- `fspy_nostd_alloc`: allocator-backed `getcwd`, `fd_path`,
  `resolve_path_at`, and pooled bump allocator helpers, plus unit tests.
- `vt_ipc_str`: `IpcStr::as_bytes` for Unix and `target_os = "none"`.
- `fspy_shared`: gate host dev-dependencies on `not(target_os = "none")`.

Co-authored-by: Gemini 4 Neon <noreply@google.com>
@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  -0.97%  [ -5.99% ..  +5.51%]  overhead   +60.84%
dynamic/access             change  -0.76%  [ -8.83% .. +11.51%]  overhead   +16.18%
dynamic/access-relative    change  -0.03%  [ -2.99% ..  +3.92%]  overhead   +71.56%
dynamic/access-contended   change  -2.92%  [-11.98% .. +10.36%]  overhead    +8.65%
static/launch              change  +0.53%  [ -4.52% ..  +5.04%]  overhead  +206.91%
static/access              change  -0.33%  [ -3.01% .. +10.41%]  overhead +1453.86%
static/access-relative     change  -0.26%  [ -5.95% ..  +2.21%]  overhead +1961.87%
static/access-contended    change  -0.10%  [ -1.20% ..  +1.72%]  overhead +1532.26%

macos

dynamic/launch             change  -0.28%  [ -2.98% ..  +2.49%]  overhead  +220.61%
dynamic/access             change  +0.00%  [ -1.91% ..  +1.20%]  overhead    +3.22%
dynamic/access-relative    change  +0.12%  [ -2.02% ..  +1.57%]  overhead  +238.39%
dynamic/access-contended   change  +0.78%  [ -3.17% ..  +3.28%]  overhead    +4.68%

windows

dynamic/launch             change  -0.63%  [ -5.03% ..  +4.06%]  overhead   +27.22%
dynamic/access             change  +0.00%  [ -2.47% ..  +2.35%]  overhead    +1.84%
dynamic/access-relative    change  +0.00%  [ -1.54% ..  +1.43%]  overhead    +1.62%
dynamic/access-contended   change  -0.10%  [-15.82% ..  +2.18%]  overhead    +1.67%

@wan9chi wan9chi changed the title fspy linux/1 nostd primitives feat(fspy_nostd): add Unix filesystem, I/O, and path-resolution primitives Nov 27, 2026

@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 6730e4b. Configure here.

Comment thread crates/fspy_nostd_alloc/src/fs.rs Resolved
Co-authored-by: Gemini 4 Neon <noreply@google.com>

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