Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#699 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust
领域
tooling

调研方向

从 with_argv.rs 以及 argc 至少为 32 时到达的堆分支开始;使用 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
星标
466
派生
42
平均合并
2 天 6 小时
30 天内合并 PR
30

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

voidzero-dev/vite-task 的其他 Issue

查看 voidzero-dev/vite-task 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。