Skip to content

fix(fspy): format the fexecve path without allocating - #892

Merged
wan9chi merged 1 commit into
mainfrom
fix/fspy-fexecve-no-alloc
Oct 26, 2026
Merged

wan9chi merged 1 commit into
mainfrom
fix/fspy-fexecve-no-alloc

Conversation

@wan9chi

@wan9chi wan9chi commented Oct 26, 2026

Copy link
Copy Markdown
Member

Motivation

The fexecve interposer (Linux) built /proc/self/fd/{fd} with format!, which goes through libc malloc. Exec may run in the child of fork(), where malloc's lock may be held by a thread that no longer exists, so the exec interposers avoid libc's heap.

Change

Format the path into a stack buffer with the existing proc_fd_path helper from fspy_client_unix::convert, now public. It takes the raw descriptor instead of a BorrowedFd, so -1 still formats as /proc/self/fd/-1 and the real execve reports the error as before.

🤖 Generated with Claude Code

@wan9chi
wan9chi added this pull request to stack #895 October 26, 2026 07:26
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

fspy benchmark

linux

dynamic/launch             change  +0.47%  [ -3.92% ..  +4.98%]  overhead   +54.84%
dynamic/access             change  -1.17%  [-16.21% ..  +2.66%]  overhead   +23.79%
dynamic/access-relative    change  -1.64%  [ -5.00% ..  +1.08%]  overhead   +68.96%
dynamic/access-contended   change  +1.58%  [ -9.79% ..  +8.27%]  overhead    +7.27%
static/launch              change  +0.79%  [ -4.59% ..  +6.36%]  overhead  +194.00%
static/access              change  +0.09%  [ -4.95% ..  +1.95%]  overhead +1364.76%
static/access-relative     change  -0.21%  [ -1.92% ..  +1.23%]  overhead +1855.77%
static/access-contended    change  +0.10%  [ -0.83% ..  +1.12%]  overhead +2020.13%

macos

dynamic/launch             change  +0.11%  [ -3.89% ..  +4.17%]  overhead  +229.11%
dynamic/access             change  -0.70%  [ -3.03% ..  +2.08%]  overhead    +1.70%
dynamic/access-relative    change  -0.43%  [ -5.38% ..  +3.84%]  overhead  +255.46%
dynamic/access-contended   change  -0.99%  [ -4.99% ..  +4.63%]  overhead    +1.66%

windows

dynamic/launch             change  +0.34%  [ -6.72% ..  +7.91%]  overhead   +25.08%
dynamic/access             change  +0.17%  [-11.32% .. +15.71%]  overhead    +1.92%
dynamic/access-relative    change  -0.13%  [-12.35% .. +10.89%]  overhead    +0.25%
dynamic/access-contended   change  +1.72%  [-14.63% .. +13.08%]  overhead    +4.20%

Base automatically changed from fix/fspy-execl-bump-alloc to main October 26, 2026 07:37
The fexecve interposer built `/proc/self/fd/{fd}` with `format!`, which
goes through libc malloc. Exec may run in the child of fork(), where
malloc's lock may be held by a thread that no longer exists. Format it
into a stack buffer with the existing `proc_fd_path` helper instead,
which now takes the raw descriptor so `-1` formats as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wan9chi
wan9chi force-pushed the fix/fspy-fexecve-no-alloc branch from 2ae07e9 to 6e283d4 Compare October 26, 2026 07:37
@wan9chi
wan9chi merged commit 6184d9d into main Oct 26, 2026
20 checks passed
@wan9chi
wan9chi deleted the fix/fspy-fexecve-no-alloc branch October 26, 2026 09:06
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