Surface AddressSanitizer reports in resource usage profiles, structured logging, summary.jsonl and the error summary
Categories
(Testing :: Mozbase, enhancement)
Tracking
(firefox162 fixed)
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | fixed |
People
(Reporter: marco, Assigned: benoit.goupilleau)
References
Details
Attachments
(3 external files)
On ASan builds, an AddressSanitizer memory error report (SEGV, use-after-free, buffer overflow, ...) only exists in the test log as raw process output: a ==<pid>==ERROR: AddressSanitizer: <kind> ... header, the stack, and a SUMMARY: AddressSanitizer: <kind> ... / ==<pid>==ABORTING trailer. When the report comes from a child process, or from a process that is shutting down, there is often no minidump and therefore no crash action either. As a result:
- the only thing that notices the report is the mozharness regex
ERROR: (Address|Leak)SanitizerinBaseHarnessErrorList, which turns the task red; - the error summary (
wpt_errorsummary.logand friends) has no failure line for it, and every group is reported asOK, so tools relying on the error summary to find the failing group see a failed task with no failures; - the resource usage profile turns every line of the report into a generic "output" marker;
- summary.jsonl carries nothing about it.
Example: task API1mBw0TliOa1gieirQWw (test-linux2404-64-asan/opt-web-platform-tests-34) failed with exit status 2 because two content processes hit ERROR: AddressSanitizer: SEGV on unknown address in SpeculationRules::RemoveLink during the shutdown cycle collection. wptrunner logged TEST-OK for the running test and Got 0 unexpected results, and the error summary lists all groups as OK.
ThreadSanitizer (bug 2043574, tsan_error) and UndefinedBehaviorSanitizer (bug 2072610, ubsan_error) reports already have a structured path. It would be useful to do the same for ASan: an asan_error mozlog action carrying the kind, message, pid and the stack, emitted by a shared parser fed with the process output of the harnesses (wptrunner already feeds every output line to mozleak.LSANLeaks, as do mochitest and reftest, so mozleak may be a convenient home for it), and handled by the error summary formatter so the report is attributed to the test or group that was running and the group is marked as failed.
An AddressSanitizer report is often the only trace of a crash: when it
comes from a child process or from a process that is shutting down there
is no minidump, hence no crash action, and the task is only red because
mozharness greps the raw lines. mozleak.ASanErrorParser assembles the
header, the stacks and the SUMMARY line of a report out of a process
output stream, keeping it open across the lines of other processes that
interleave while the stack is symbolized, and emits one asan_error action
per report. It lives in mozleak rather than next to the UBSan parser in
moztest because wptrunner only depends on mozleak.
ErrorSummaryFormatter writes the action as a crash of the test that was
running (the one the action names, else the last one started), with an
"AddressSanitizer: <kind> [@ <function>]" signature, and fails its group
unless the run will be retried. TestSummaryFormatter keeps the action
with its pid and stacks. The TBPL formatter stays silent so the failure
summary keeps showing the original lines only.
Updated•25 days ago
|
The asan_error action becomes an ASanError marker carrying the kind,
message, pid, SUMMARY location and stack, red unless the run will be
retried. Harnesses that only log the raw lines still get the marker from
a line-based fallback fed with process_output lines, which the action
supersedes when both arrive, as for UBSan reports. mozharness and the
mozlog resource handler forward the action to the monitor.
wptrunner creates the parser next to its LSan handler on ASan builds and
feeds it every Firefox output line, ahead of the LSan handler which drops
SUMMARY lines. The running test is not known there, so the error summary
attributes the report to the last test started. mochitest and xpcshell
feed it like the UBSan parser, with the test that is running, quietly
when a crash is expected or the run will be retried. reftest wires no
sanitizer parser today, so its output handler gets this one, with the
running test and manifest from the harness.
The xpcshell selftest replays a synthetic report, so it runs on every
build type.
Patches: D339052 adds the asan_error mozlog action and mozleak.ASanErrorParser, with the mach, summary.jsonl and errorsummary formatter support; D339053 records the reports as ASanError markers in the resource usage profiles; D339054 feeds the parser from wptrunner, mochitest, xpcshell and reftest.
Try, with DO NOT LAND witness tests on linux2404-64-asan (a copy of the report from comment 0 printed by a content process, a real content-process abort in wpt, a real xpcshell abort):
https://treeherder.mozilla.org/jobs?repo=try&revision=aec83c1409480f0c4cbdcfc2909debde2ce06af1
https://treeherder.mozilla.org/jobs?repo=try&revision=5e11b71b9dea74d206032e29459d3fab89b31851
In every task the report becomes one crash line in *_errorsummary.log, signature "AddressSanitizer: SEGV [@ GetInnerWindow]" (or "[@ MOZ_CrashSequence]" for the real aborts), attributed to the running test and its group, and the group_result is ERROR. summary.jsonl gets an asan_error record with the crashing pid, the SUMMARY location and the stack, and the resource profile shows a red ASanError marker instead of generic output markers. The raw lines are still logged once, so the mozharness error regex and the failure summary do not change.
Notes:
- wptrunner has no current test on the output thread, so a report without a test is attributed to the most recently started running test (Linux fission wpt runs with --processes=1); the record carries the group scope.
- xpcshell mirrors crash.quiet: the report of a first attempt that will be retried is quiet (crash line written, group untouched); the retried attempt fails the group.
- A report printed by a passing xpcshell test is not seen: the harness only replays buffered output when a test fails, as for the UBSan and assertion parsers, and the raw log does not show it either.
- Follow-ups: rendering asan_error records in Treeherder's Summary tab, a mozleak release on PyPI so upstream wpt picks up the parser, and the Android harnesses.
Comment 6•14 days ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/9e51a7095bc1
https://hg.mozilla.org/mozilla-central/rev/c5e06ae3b07c
https://hg.mozilla.org/mozilla-central/rev/e030ee8d5a1e
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/65202 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Description
•