You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(fspy-shared): make the payload a borrowed view
The payload and its channel configuration are now views over storage
their producer owns, the model the Windows preload already had with its
static Detours page:
- ChannelConf borrows its path; channel() returns only the Receiver,
and Receiver::conf() derives the configuration from the C string the
receiver's keeper owns. sender() decodes the path transiently from a
caller-provided allocator and drops the decoded string before
returning — a bump allocator gets the space back, since the block is
its most recent allocation.
- The unix Payload and EncodedPayload borrow every path and the encoded
string. The supervisor lends its session paths per spawn instead of
cloning boxes. seccomp_payload stays owned until fspy_seccomp_unotify
grows borrowed types.
- encode_payload and decode_payload_from_env are symmetric: both take
the allocator by value, leak the strings the payload views borrow
into it, and A: 'a bounds the result. The supervisor encodes into
Global — a few hundred leaked bytes per tracked child, reclaimed at
supervisor exit — instead of assembling EncodedPayload by hand from
a scope-owned BString.
- The attach is safe code end to end, with no lifetime promotion
anywhere: the preload ctor houses one page-backed bump in a
static_cell::StaticCell, so its borrow is 'static by construction
and from_env simply instantiates Client<'a> at 'static. Send + Sync
assertions on EncodedPayload and Client seal the view-only design —
a retained allocator handle is interior-mutable and would fail
them — and the bump's own !Sync keeps its handle unstorable beyond
the ctor. The redundant macOS manual Send/Sync impls on Client are
deleted, and page_bump() returns the nameable PageBump so the static
can be declared. One mapping serves the whole attach unless the
payload outgrows the chunk, nothing comes from the global allocator,
and nothing borrows the mutable process environment.
- The Windows preload deserializes its payload zero-copy from the
static page and forwards those original bytes to children instead of
re-serializing per spawn.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
0 commit comments