CI-safe debug runners: add ASan LD_PRELOAD + UBSan mailbox targets; add asan_preload script; document sanitizer-safe workflows and results in CURRENT_TASK.md (debug complete).

This commit is contained in:
Moe Charm (CI)
2025-11-07 12:09:28 +09:00
parent 25a81713b4
commit 8f3095fb85
3 changed files with 221 additions and 3 deletions

View File

@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -euo pipefail
# Run Larson with AddressSanitizer reliably for 4T by preloading libasan + HAKMEM ASan .so
# Rationale: some environments fail to reserve ASan shadow when running a fully
# sanitized binary for multithread runs. Preloading the ASan runtime and the
# allocator .so while using an unsanitized larson_system binary avoids those
# mapping conflicts while still sanitizing allocator code paths.
threads=${1:-4}
sleep_sec=${2:-10}
min_size=${3:-8}
max_size=${4:-128}
chunks_per_thread=${5:-1024}
rounds=${6:-1}
seed=${7:-12345}
echo "[build] libhakmem_asan.so and larson_system"
make -j asan-shared-alloc larson_system >/dev/null
export LSAN_OPTIONS=${LSAN_OPTIONS:-detect_leaks=0}
# Find libasan from the active toolchain
libasan_path=$(gcc -print-file-name=libasan.so)
if [[ ! -f "$libasan_path" ]]; then
echo "[error] libasan.so not found via gcc -print-file-name" >&2
exit 1
fi
export LD_PRELOAD="${libasan_path}:$PWD/libhakmem_asan.so"
echo "[run] LD_PRELOAD set to: $LD_PRELOAD"
cmd=("./larson_system" "$sleep_sec" "$min_size" "$max_size" "$chunks_per_thread" "$rounds" "$seed" "$threads")
echo "[run] ${cmd[*]}"
"${cmd[@]}"