Skip to content

refactor(fspy): gate ipc channel module on non-musl targets#328

Merged
branchseer merged 1 commit intomainfrom
claude/gate-ipc-channel-musl
Apr 13, 2026
Merged

refactor(fspy): gate ipc channel module on non-musl targets#328
branchseer merged 1 commit intomainfrom
claude/gate-ipc-channel-musl

Conversation

@branchseer
Copy link
Copy Markdown
Member

Summary

Gate the entire fspy_shared::ipc::channel module behind #[cfg(not(target_env = "musl"))]. The shared-memory IPC channel exists to move path accesses from the preload library to the supervisor, but on musl targets the preload library isn't built (seccomp-only tracking is used). With no senders, the channel produces no data, and creating it on musl just wastes a 4 GiB shared-memory region, a lock file, and a blocking receiver-lock step after the child exits.

Changes

  • fspy_shared::ipc::channel module is now non-musl only
  • fspy::ipc (re-exports OwnedReceiverLockGuard, SHM_CAPACITY) is non-musl only
  • fspy::unix::SpyImpl::spawn skips channel creation on musl
  • PathAccessIterable drops its ipc_receiver_lock_guard field on musl; iter() only yields arena-collected accesses there
  • Fixed latent issue exposed by this PR: Payload::seccomp_payload's struct_field_names #[expect] is now #[cfg_attr(not(target_env = "musl"), ...)] since on musl Payload has only this one field and clippy's struct_field_names lint no longer fires

Windows paths are untouched — they never satisfy target_env = "musl".

Test plan

  • cargo check --workspace --all-features on host (glibc)
  • cargo check --workspace --all-features --target x86_64-unknown-linux-musl
  • cargo clippy --workspace --all-targets --all-features -- -D warnings on host
  • cargo fmt --check
  • RUSTDOCFLAGS='-D warnings' cargo doc --no-deps --document-private-items
  • cargo test -p fspy_shared -p fspy_shared_unix (24 pass)
  • cargo test -p fspy --test node_fs — exercises the full spawn + IPC pipeline (8 pass)

https://claude.ai/code/session_01VqiMHiGeViu1pGhWwJ67Qc

The shared-memory IPC channel is only used to transport path accesses
from the preload library to the supervisor. On musl targets, the
preload library is not built (seccomp-only tracking is used), so the
channel has no senders and produces no data. Gate the entire
`fspy_shared::ipc::channel` module and its downstream users behind
`#[cfg(not(target_env = "musl"))]` so musl builds no longer allocate
the 4 GiB shared-memory region, create the lock file, or wait for
the receiver lock.

- `fspy_shared::ipc::channel` module is now non-musl only
- `fspy::ipc` (which re-exports `OwnedReceiverLockGuard` and
  `SHM_CAPACITY`) is non-musl only
- `fspy::unix::SpyImpl::spawn` no longer creates a channel on musl;
  `PathAccessIterable` drops its `ipc_receiver_lock_guard` field on
  musl and `iter()` only yields arena-collected accesses
- Update `Payload::seccomp_payload`'s `struct_field_names` expect so
  it only applies on non-musl, where `Payload` still has multiple
  fields (on musl it's the only field and the lint no longer fires)

https://claude.ai/code/session_01VqiMHiGeViu1pGhWwJ67Qc
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the IPC layer to avoid creating the shared-memory path-access channel on musl targets, where the preload-based sender is not built and seccomp-only tracking is used instead.

Changes:

  • Gate fspy_shared::ipc::channel and fspy::ipc behind #[cfg(not(target_env = "musl"))].
  • Skip IPC channel creation/locking on musl in fspy::unix::SpyImpl::spawn and only iterate arena-collected accesses there.
  • Make the clippy struct_field_names #[expect] conditional so it only applies on non-musl where the lint actually fires.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
crates/fspy/src/unix/mod.rs Removes musl IPC channel creation/locking and makes path-access iteration musl-aware.
crates/fspy/src/lib.rs Gates the ipc module on non-musl targets.
crates/fspy_shared/src/ipc/mod.rs Gates the ipc::channel module on non-musl targets.
crates/fspy_shared_unix/src/payload.rs Makes the clippy #[expect] conditional to avoid musl-only build failures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@branchseer branchseer merged commit 728413c into main Apr 13, 2026
13 checks passed
@branchseer branchseer deleted the claude/gate-ipc-channel-musl branch April 13, 2026 03:50
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.

3 participants