include/strawberry/platform_process.hpp answers what /proc answers on Linux: running PIDs (proc_listallpids), executable path (proc_pidpath), parent and start time (sysctl KERN_PROC_PID, readable for every process), argv (KERN_PROCARGS2) and a boot id (kern.bootsessionuuid). A process is identified by its start time in microseconds since the epoch plus the boot id, so node ids survive PID reuse as on Linux. It is header-only, so the per-test source lists stay as they are. Users on macOS: resolve_process_ref (default root), the pipeline's image hashing and exec-decision actor, and YaraScanner::scan_process (scans the image by path). A synthetic procfs root still takes the procfs code, so the existing procfs tests run on macOS too. The resource governor samples Mach/sysctl on macOS: own CPU from getrusage, RSS from task_info, load from getloadavg, available memory from host_statistics64 (free + inactive + purgeable + speculative). The behavior engine knows macOS debuggers (debugserver, dtrace) and kext loaders (kernelmanagerd, kmutil), and macOS temp and Downloads paths count as drop locations. The Linux lists are unchanged. The KERN_PROCARGS2 parser is portable: a property test (exact argv recovery, truncation never invents data, total on junk) and the fuzz_procargs target run on every platform. test_platform_process checks the live helpers against this process; the daemon test reads the stopped state through sysctl on macOS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.7 KiB
Bash
Executable file
31 lines
1.7 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Run each libFuzzer target for N seconds (default 60), one at a time, at low
|
|
# priority with a memory cap, keeping corpora in build/fuzz-corpus/<target>.
|
|
# Crashes land in build/fuzz-artifacts/<target>/ and fail the run.
|
|
set -uo pipefail
|
|
SECONDS_EACH="${1:-60}"
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
BUILD="${FUZZ_BUILD:-$ROOT/build/fuzz}"
|
|
status=0
|
|
for target in fuzz_io_faults fuzz_ioc_list fuzz_policy_apply fuzz_governor_parsers fuzz_status_snapshot fuzz_config fuzz_record_decoder fuzz_block_decoder fuzz_segment_reader fuzz_manifest fuzz_evidence_records fuzz_legacy_kv fuzz_procargs fuzz_mcp_handle; do
|
|
bin="$BUILD/fuzz/$target"
|
|
[ -x "$bin" ] || { echo "skip $target (not built)"; continue; }
|
|
corpus="$ROOT/build/fuzz-corpus/$target"
|
|
artifacts="$ROOT/build/fuzz-artifacts/$target/"
|
|
mkdir -p "$corpus" "$artifacts"
|
|
seeds="$ROOT/fuzz/seeds/$target"
|
|
echo "== $target (${SECONDS_EACH}s)"
|
|
# LeakSanitizer needs ptrace, which yama ptrace_scope >= 2 forbids for
|
|
# non-root; leak checks are off here (ASan/UBSan stay on).
|
|
ASAN_OPTIONS="${ASAN_OPTIONS:-detect_leaks=0}" nice -n 19 "$bin" -max_total_time="$SECONDS_EACH" -rss_limit_mb=1024 -malloc_limit_mb=512 -timeout=10 \
|
|
-artifact_prefix="$artifacts" -print_final_stats=1 "$corpus" $( [ -d "$seeds" ] && echo "$seeds" ) \
|
|
> "$ROOT/build/fuzz-artifacts/$target.log" 2>&1
|
|
rc=$?
|
|
grep -E "^stat::number_of_executed_units|^stat::peak_rss_mb|cov: " "$ROOT/build/fuzz-artifacts/$target.log" | tail -3
|
|
if [ $rc -ne 0 ]; then
|
|
echo "FAIL $target (exit $rc): see build/fuzz-artifacts/$target.log"
|
|
grep -E "ERROR|SUMMARY|runtime error" "$ROOT/build/fuzz-artifacts/$target.log" | head -5
|
|
status=1
|
|
fi
|
|
done
|
|
exit $status
|