asanbucket groups AddressSanitizer and UBSan crash reports from a fuzzer into bugs. It parses the
report text, normalises each stack (addresses, build roots, sanitizer runtime and libc frames,
inlined frames, template arguments and recursion removed), and buckets by the first N frames or by
position-weighted frame similarity. Buckets are ranked by a severity rule table, matched against
bug keys already filed, and scored against root-cause labels with B-cubed precision and recall.
The depth N is chosen on one night of labelled data and reported on another. The data is
synthetic: a seeded generator writes reports for a fictional image library, libpixa, with
planted root causes.
A nightly fuzz run over an image-decoding library produces about 2,000 ASan reports. Two obvious keys fail in opposite directions:
- The full stack splits one bug into dozens of buckets: different callers, inlined frames, build paths, ASLR addresses and line drift between builds all change the text.
- The crashing function alone merges distinct bugs: every
memcpyoverflow dies inside the__interceptor_memcpyframe, and two bugs in one function look the same.
Engineers then triage duplicates by hand and miss the one heap-buffer-overflow WRITE sitting among hundreds of null-pointer READs. asanbucket makes the grouping measurable: the generator plants each of these failure modes and the evaluation reports how well each setting recovers the root causes.
flowchart LR
A[Raw ASan and UBSan reports] --> B[Parse<br/>header, access, stacks, SUMMARY<br/>malformed files go to rejects]
B --> C[Normalise<br/>drop addresses, build roots,<br/>runtime and libc frames, inlined frames,<br/>templates; collapse recursion]
C --> D{Bucket}
D -->|topn| E[Key = kind, access, via,<br/>first N frames]
D -->|weighted| F[Position-weighted similarity,<br/>single linkage]
E --> G[Severity rule table<br/>and ranking]
F --> G
G --> H[Match filed issues<br/>known or new]
H --> I[buckets.json, diff, show]
C --> J[B-cubed scoring against<br/>the generator's root-cause labels]
E --> J
F --> J
Modules, in pipeline order:
parsereads the error header, theREAD|WRITE of size Nline, the SEGV signal and zero-page hint lines, the crash,allocated byandfreed bystacks, theSUMMARY:line, UBSanruntime error:reports andstack-overflowstacks. Frames may end in clang's(BuildId: ...)suffix, which is ignored. A stack is the run of#Nlines right after its header; frame blocks printed later (for example underAddress ... is located in stack of thread T0) are not added to it. A file that cannot be parsed becomes a reject with a reason and the run continues.normalisedrops__asan_*,__interceptor_*,__sanitizer_*andlibc.so*frames and keeps the first dropped function asvia(via memcpy). It strips configured build roots, C++ template arguments, ABI tags and parameter lists, drops inlined frames (same pc as the next outer frame, different function), and collapses runs of the same function to one. The line number stays on the crash frame only by default (--lines all|crash|none). Frames inviaand the key are the normalised ones;triagerecords the resolved path of its input directory soshowworks from any working directory.bucketinghas two methods.topnkeys on kind, access,viaand the first N in-project frames.weightedcompares frame lists position by position with weightexp(-0.5 * position)and merges buckets with single linkage at--threshold. A bucket id is the first 12 hex characters of the sha256 of the canonical key (topn) or of the smallest member key (weighted).severityis a rule table: heap WRITE overflow, WRITE use-after-free and double-free arehigh; heap or global READ overflows and READ use-after-free aremedium; null dereference (address below 0x1000), recursion stack-overflow and UBSan arelow; a SEGV READ at a wild non-zero address ismediumand a SEGV WRITE there ishigh. Two rows go beyond the usual table:stack-buffer-overflowWRITE ishighand READ ismedium, andbad-freeismedium. These are triage heuristics for ordering work, not proof that a bug is or is not exploitable.evaluatecomputes B-cubed precision, recall and F1 for N = 1..6 and thresholds 0.5..0.9, picks the best setting on the training night and reports it on the held-out night.
Python 3.11 or newer (CI runs 3.12 and 3.13).
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
asanbucket generate data # two nights of reports, truth.json, issues.json
asanbucket triage data/night1 --out night1.json --issues data/issues.json --top 10
asanbucket eval data/night1 data/night2 --truth data/truth.json
asanbucket triage data/night2 --out night2.json
asanbucket diff night1.json night2.json
asanbucket show a0e1a0d0bacf --buckets night1.json # representative report and membersTriage options: --method topn|weighted, --frames N, --threshold T,
--lines all|crash|none, --build-root PATH (repeatable; replaces the defaults
/src/libpixa and /work/b2/libpixa), --keep-runtime, --issues issues.json. Point triage
at any directory of ASan/UBSan text reports; generate is only needed for the demo data.
issues.json maps an issue id to the bucket key it was filed under; a bucket is known when its
key equals the filed key or extends it by more frames. That prefix rule is lenient: a filed
key of one frame marks every deeper bucket that shares its crash frame as known, so file keys
at the depth you triage with (N frames) to keep new bugs visible.
All of the following came from running the commands above with the default seed.
asanbucket triage data/night1 --out night1.json --issues data/issues.json --top 10
1525 reports parsed, 3 rejected; 14 buckets (topn, N=3, lines=crash)
SEVERITY COUNT BUCKET KIND ACCESS VIA TOP FRAMES REPORT KNOWN
high 9 a0e1a0d0bacf heap-buffer-overflow WRITE - png_unfilter_row <- png_read_row <- png_read_idat report-0963.txt new
high 6 fcd62547f4ce heap-use-after-free WRITE - pixa::webp::blend_frame <- pixa::webp::compose_animation <- pixa::webp::decode_animation report-0731.txt new
medium 150 4dbcccaff953 heap-buffer-overflow READ - webp_decode_alpha <- webp_decode_vp8l <- webp_decode_frame report-0287.txt known: PIXA-1088
medium 120 fba42cb7c2e6 heap-buffer-overflow READ memcpy pixa::jpeg::copy_scanline <- pixa::jpeg::Scan::emit_row <- pixa::jpeg::decode_scan report-1428.txt new
medium 110 39dd72a970ed heap-buffer-overflow READ - pixa_buf_peek <- pixa_buf_get_u32 <- png_text_chunk report-1063.txt new
medium 100 169957053fec heap-buffer-overflow READ - webp_decode_alpha <- webp_decode_vp8l <- webp_decode_frame report-1211.txt new
medium 90 d0239c1d2473 heap-buffer-overflow READ - pixa_buf_peek <- pixa_buf_get_u32 <- icc_parse_tag report-0400.txt new
medium 90 63022f89c7c7 heap-buffer-overflow READ memcpy webp_copy_tile <- webp_decode_tiles <- webp_decode_vp8 report-1242.txt known: PIXA-1063
medium 70 2327c3f42cb6 global-buffer-overflow READ - pixa::jpeg::idct_row <- pixa::jpeg::idct_block <- pixa::jpeg::Scan::finish_mcu report-0635.txt new
medium 60 28573827f06d heap-buffer-overflow READ memcpy icc_copy_curve <- icc_read_tag_data <- icc_parse_profile report-0721.txt new
... 4 more buckets (use --top to show more)
rejected 3 files:
report-empty.txt: empty file
report-timeout.txt: no sanitizer report found
report-truncated.txt: report has no stack frames
wrote night1.json
asanbucket eval data/night1 data/night2 --truth data/truth.json
B-cubed, settings chosen on night1 (14 root causes), reported on night2 (15 root causes)
night1 | night2
setting buckets P R F1 | buckets P R F1
topn N=1 13 0.935 1.000 0.966 | 14 0.933 1.000 0.965
topn N=2 13 0.935 1.000 0.966 | 14 0.933 1.000 0.965
* topn N=3 14 1.000 1.000 1.000 | 15 1.000 1.000 1.000
topn N=4 28 1.000 0.834 0.909 | 32 1.000 0.813 0.897
topn N=5 59 1.000 0.388 0.559 | 59 1.000 0.395 0.566
topn N=6 69 1.000 0.200 0.333 | 69 1.000 0.202 0.337
weighted t=0.5 12 0.856 1.000 0.923 | 13 0.854 1.000 0.921
weighted t=0.6 12 0.856 1.000 0.923 | 13 0.854 1.000 0.921
* weighted t=0.7 14 1.000 1.000 1.000 | 15 1.000 1.000 1.000
weighted t=0.8 25 1.000 0.868 0.929 | 29 1.000 0.843 0.915
weighted t=0.9 57 1.000 0.400 0.571 | 58 1.000 0.410 0.582
topn full stack 69 1.000 0.200 0.333 | 69 1.000 0.202 0.337
topn N=1 runtime frames kept 11 0.821 1.000 0.902 | 12 0.832 1.000 0.908
* = best on night1 (ties go to the setting that merges less)
topn: topn N=3 -> night2 F1 1.000; weighted: weighted t=0.7 -> night2 F1 1.000 (difference +0.000)
full normalised-stack keys: 69 buckets for 15 root causes on night2 (4.6x)
asanbucket diff night1.json night2.json (after asanbucket triage data/night2 --out night2.json)
new buckets: 2
+ b03b144d22ab medium heap-buffer-overflow READ exif_read_makernote <- exif_parse_ifd_entry <- exif_read_tiff_dir (51 reports)
+ 813849499818 high heap-buffer-overflow WRITE webp_build_huffman <- webp_read_huffman_codes <- webp_decode_lossless (12 reports)
vanished buckets: 1
- 2327c3f42cb6 medium global-buffer-overflow READ pixa::jpeg::idct_row <- pixa::jpeg::idct_block <- pixa::jpeg::Scan::finish_mcu (was 70 reports)
count changes: 11 buckets moved, 2 unchanged
~ 4dbcccaff953 medium heap-buffer-overflow READ webp_decode_alpha <- webp_decode_vp8l <- webp_decode_frame 150 -> 174 (+24)
~ 3546dec0a994 low SEGV READ pixa::jpeg::Scan::huff_table <- pixa::jpeg::Scan::decode_mcu <- pixa::jpeg::decode_scan 270 -> 290 (+20)
~ 8d7bc65377d1 low SEGV READ png_read_text <- png_read_chunks <- pixa_png_decode 340 -> 359 (+19)
~ 39dd72a970ed medium heap-buffer-overflow READ pixa_buf_peek <- pixa_buf_get_u32 <- png_text_chunk 110 -> 125 (+15)
~ 28573827f06d medium heap-buffer-overflow READ icc_copy_curve <- icc_read_tag_data <- icc_parse_profile 60 -> 51 (-9)
... 6 more (use --top to show more)
- N is chosen on labelled data, on a different night. N=1 and N=2 merge the two bugs that
crash in the same helper (
pixa_buf_peek) and differ only by their caller two frames up; N=4 and deeper split the root causes whose callers diverge after three frames. Selecting N on night 1 and scoring on night 2 keeps the choice from being tuned to the test. Ties go to the larger N (and higher threshold) because a wrong merge can hide a distinct bug while a wrong split only costs a duplicate. On this synthetic data every stem is at least three frames, so N=3 reaches F1 1.000; real crash corpora will not be this clean and the chosen N will not transfer. Both nights also reuse the same stems and caller chains (the generator seeds chains per root-cause group, not per night), so night 2 differs from night 1 by report counts and two new root causes only; it does not test generalisation to unseen chain shapes. - Runtime and libc frames are dropped, but remembered as
via. Without the drop, N=1 puts the threememcpyoverflows into one bucket (theN=1 runtime frames keptrow). With it,via memcpystays in the key and the first in-project frame separates the three callers. - Line numbers are kept on the crash frame only. Keeping them everywhere splits the callers
that sit in the file whose lines drift between the two builds (
--lines allgives 16 buckets for 14 root causes); dropping them everywhere merges the two bugs in one function at different lines (--lines nonegives 13). The defaultcrashgives 14. The cost is that two genuinely different call sites in the same caller function are not told apart. The generator drifts line numbers in caller frames only, never on the crash frame, so a crash line that moves between builds would split a bucket undercrashand is not exercised here. - Inlined frames are dropped by program counter. A frame that shares its pc with the next outer frame and has a different function is an inline expansion the symbolizer chose to show, so it would make the same bug differ between builds. The crash frame is never dropped, and recursion (same pc, same function) is left to the collapse step. A real inline helper that is a caller is lost from the key.
- Two methods, side by side.
topngives exact, stable keys: ids do not change between nights, sodiffand the known-issue match are exact.weightedneeds no depth choice but its ids come from the smallest member key, so they can change when a bucket gains or loses members, and single linkage can chain unrelated buckets at low thresholds (0.5 and 0.6 merge both pairs of look-alike bugs here). The two score within 0.03 of each other on this data. - The full-stack row is measured on normalised stacks.
topn full stackand the 4.6x figure key on every frame after normalisation, so they count only the splits caused by diverging caller chains. Splits from raw addresses, build roots and inlining are removed before that row is computed and are covered by the normaliser tests, not by the evaluation table. - Bucket severity is the worst member. A bucket that mixes null and wild SEGVs ranks as
medium, so the rare dangerous report is not averaged away.
pytest -q123 tests, offline, no network. They cover the parser against the hand-written reports and the
malformed files, each normalisation rule, the severity table, B-cubed on hand-computed cases, and
the acceptance checks on the generated nights: the memcpy merge and split, bucket counts under
each --lines mode, ids stable across shuffled and renamed files, F1 on the held-out night, the
ranking of the hidden WRITE overflow and the use-after-free, known-issue matching, and diff
against the truth.
src/asanbucket/
model.py Frame, Report, Summary, Reject
parse.py ASan and UBSan text parser, directory loader
normalise.py frame cleaning, via, inlining and recursion rules
bucketing.py topn and weighted bucketing, bucket ids
severity.py rule table
triage.py pipeline, ranking, known-issue match, table and JSON
evaluate.py B-cubed evaluation with train and test nights
metrics.py B-cubed precision, recall, F1
diffing.py night-to-night comparison
generate.py seeded libpixa report generator
cli.py Typer commands: generate, triage, eval, diff, show
tests/ unit and acceptance tests, hand-written fixtures
.github/workflows/ci.yml
MIT. See LICENSE.
