● Zion Boggan
repos/Cyclops V2/oracle/triage_new_crashes.sh
zionboggan.com ↗
25 lines · bash
History for this file →
1
W=/opt/cyclops-v2/oracle/work/llamacpp
2
BIN="$W/fuzz_deep"
3
SEEN="$W/deep/seen.txt"; touch "$SEEN"
4
CRASHDIR="$W/deep/crashes"
5
[ -d "$CRASHDIR" ] || exit 0
6
for c in "$CRASHDIR"/d-* "$CRASHDIR"/crash-* "$CRASHDIR"/oom-* "$CRASHDIR"/leak-*; do
7
  [ -f "$c" ] || continue
8
  b=$(basename "$c")
9
  grep -qx "$b" "$SEEN" && continue
10
  echo "$b" >> "$SEEN"
11
  out=$(ASAN_OPTIONS=detect_leaks=0:abort_on_error=0:exitcode=88 timeout 30 "$BIN" "$c" 2>&1)
12
  sig=$(echo "$out" | grep -oE "heap-buffer-overflow|stack-buffer-overflow|global-buffer-overflow|heap-use-after-free|double-free|WRITE of size [0-9]+|stack-overflow|FPE|division by zero|out-of-memory|allocator is out of memory|GGML_ASSERT|GGML_ABORT|SEGV on unknown" | head -1)
13
  case "$sig" in
14
    heap-buffer-overflow|stack-buffer-overflow|global-buffer-overflow|heap-use-after-free|double-free|"WRITE of size"*)
15
      loc=$(echo "$out" | grep -oE "gguf.cpp:[0-9]+|ggml[-a-z]*\.c:[0-9]+|ggml\.c:[0-9]+" | head -1)
16
      echo "HIGH $b :: $sig @ ${loc:-?}" ;;
17
    "SEGV on unknown")
18
      loc=$(echo "$out" | grep -oE "gguf.cpp:[0-9]+|ggml[-a-z]*\.c:[0-9]+" | head -1)
19
      echo "REVIEW $b :: SEGV @ ${loc:-?}" ;;
20
    FPE|"division by zero"|stack-overflow|out-of-memory|"allocator is out of memory"|GGML_ASSERT|GGML_ABORT)
21
      : ;;
22
    *)
23
      [ -n "$out" ] && echo "REVIEW $b :: unclassified" || : ;;
24
  esac
25
done