fspy_preload_unix: execl with 32+ arguments aborts on an out-of-bounds NULL terminator write
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 78/100
Direzione di ricerca
Inizia da with_argv.rs e dal ramo dell'heap raggiunto quando argc è almeno 32; riproduci il limite usando cargo test --offline -p fspy --test execl_many_args -- --nocapture. Verifica che il percorso di preload gestisca 31, 32 e 33 voci non-NULL per execl, execlp ed execle senza interrompersi, quindi esegui i casi di regressione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
When fspy tracks a Unix child process that calls execl, execlp, or execle with at least 32 non-NULL argv entries (including arg0), the preload interposer aborts the child process.
In with_argv, the heap branch creates a slice with exactly argc elements, then writes the required NULL terminator at out[argc]:
let ptr = libc::malloc(argc * size_of::<*const c_char>());
let out = slice::from_raw_parts_mut(ptr.cast(), argc);
// ...
out[argc].write(core::ptr::null());
The valid indices are 0..argc, so this deterministically panics. Because the panic occurs inside an extern "C" interposer, it cannot unwind and the process aborts.
Reproduction
Reproduced against 44186c8 on macOS through the real fspy preload path. A temporary fspy integration test called libc::execl("/usr/bin/true", ...) from inside track_fn! and was run with:
cargo test --offline -p fspy --test execl_many_args -- --nocapture
Non-NULL argv entries, including arg0 |
Result |
|---|---|
| 31 | Passes; uses the fixed 32-slot stack storage |
| 32 | Aborts; heap slice has length 32 and writes index 32 |
Observed failure:
with_argv.rs:52:5:
index out of bounds: the len is 32 but the index is 32
panic in a function that cannot unwind
thread caused non-unwinding panic. aborting.
Trigger flow
cached/auto-tracked task
-> fspy preload is injected into a child process
-> the tracked native process calls execl/execlp/execle
-> with_argv rebuilds argv
-> argc >= 32 selects heap storage
-> out[argc] writes past the slice boundary
-> non-unwinding panic aborts the child
This is not triggered merely because a command has 32 arguments: the tracked program must use one of the variadic execl* APIs. Calls through execv/execve, posix_spawn, and most common high-level process APIs do not use this path. That makes the scenario uncommon, but deterministic for native tools that invoke execl* with sufficiently many arguments.
Suggested coverage
Allocate space for argc + 1 entries and add real preload regression cases at the 31/32/33 boundary for execl, execlp, and execle.
- Lingua principale
- Rust
- Stelle
- 466
- Fork
- 42
- Merge medio
- 2g 6h
- PR unite (30g)
- 30
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di voidzero-dev/vite-task
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
voidzero-dev/vite-task#738 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
voidzero-dev/vite-task#719 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
voidzero-dev/vite-task#717 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
voidzero-dev/vite-task#700 · 2 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 65/100
voidzero-dev/vite-task#692 ·
Tutte le issue di voidzero-dev/vite-task
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
TheLarkInn/aipm#2413 ·
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
alexgorbatchev/simple-ptt#15 ·
-
tooling
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
todo:ticket
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
taikoxyz/taiko-mono#22168 · 1 commento ·