sanitizers: ignore unknown addresses in reports

In some cases, the sanitizer logs contains addresses marked
as unknown. Here is an exampl ASan report due to an abort signal (ABRT):
 ==528025==ERROR: AddressSanitizer: ABRT on unknown address 0x03e800080e99 (pc ...

These addresses can be different for the same bug (PC and stacktrace are
the same) and as a result breaks error deduplication. Here, we ignore
addresses from the sanitizer reports if the address is markes as
unknown.
This commit is contained in:
Khaled Yakdan
2025-04-19 19:46:06 +02:00
parent 83aa442434
commit 28a553a8d2
+22 -5
View File
@@ -173,13 +173,30 @@ size_t sanitizers_parseReport(run_t* run, pid_t pid, funcs_t* funcs, uint64_t* p
break;
}
headerFound = true;
sscanf(lineptr,
/* Extract the error description */
sscanf(lineptr, "==%*d==ERROR: %" HF_XSTR(HF_STR_LEN_MINUS_1) "[^\n]", description);
/* Extract the crash address and PC. First try the standard "on address" format
*/
int mathchCount = sscanf(lineptr,
"==%*d==ERROR: %*[^:]: %*[^ ] on address 0x%" PRIx64 " at pc 0x%" PRIx64, crashAddr,
pc);
sscanf(lineptr,
"==%*d==ERROR: %*[^:]: %*[^ ] on %*s address 0x%" PRIx64 " (pc 0x%" PRIx64,
crashAddr, pc);
sscanf(lineptr, "==%*d==ERROR: %" HF_XSTR(HF_STR_LEN_MINUS_1) "[^\n]", description);
if (mathchCount != 2) {
/* If we cannot match report headers with "on address", try the format with a descriptor before "address" */
char addressDetail[HF_STR_LEN] = {0};
if (sscanf(lineptr,
"==%*d==ERROR: %*[^:]: %*[^ ] on %" HF_XSTR(
HF_STR_LEN_MINUS_1) "s address 0x%" PRIx64 " (pc 0x%" PRIx64,
addressDetail, crashAddr, pc) == 3) {
/* If the address descriptor is "unknown", set crashAddr to 0 as this would
* break error deduplication*/
if (strncmp(addressDetail, "unknown", 7) == 0) {
*crashAddr = 0;
}
}
}
} else {
char* pLineLC = lineptr;
/* Trim leading spaces */