Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

fspy_preload_unix: execl with 32+ arguments aborts on an out-of-bounds NULL terminator write

オープン
#699 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
tooling

調査の方向性

with_argv.rs と、argc が 32 以上の場合に到達する heap ブランチから始め、cargo test --offline -p fspy --test execl_many_args -- --nocapture を使って境界を再現します。preload パスが execl、execlp、execle の 31、32、33 個の非 NULL エントリを中断せずに処理できることを確認し、その後に回帰ケースを実行します。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Rust
スター
468
フォーク
42
平均マージ
2日 31分
マージ済み PR(30日)
46

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

voidzero-dev/vite-task のほかの issue

voidzero-dev/vite-task の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。