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
{{ message }}
Repository navigation
Commit 6d1a6b2
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(fspy): collect execl arguments in the call's bump allocator (#891)
## Motivation
`execl`, `execlp` and `execle` pass their arguments as a variadic list,
so the interposer has to build an argv array before it can handle the
exec. It used a 32-slot stack array, fell back to libc `malloc` for
longer lists, and failed with `E2BIG` past a hardcoded 4096 arguments.
That split is where #865's out-of-bounds write lived, and the `malloc`
fallback isn't async-signal-safe: exec may run in the child of `fork()`,
where malloc's lock may be held by a thread that no longer exists.
## Change
- A small `collect_argv` pushes `arg` and the variadic arguments, up to
and including the NULL, into an `allocator_api2::vec::Vec` in the call's
`pooled_bump()`, and leaves the `VaList` where `execle` reads `envp`.
- Each of the three interposers creates one bump and passes it to both
`collect_argv` and `handle_exec`, as `execveat` already does.
- `with_argv.rs` is removed along with the stack/heap split and the
4096-argument limit; the real `execve` reports `E2BIG` instead.
The rest of the exec path still allocates through libc `malloc`
(`RawExec::to_exec`/`from_exec`, `fexecve`); the PR stacked on this one
removes that.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
0 commit comments