Hello,
currently I am looking into how to suppress certain error output
selectively. What I want to achieve here is not to simply hide them, but
to attack each class of errors one by one.
So I stumbled over __asan_set_error_report_callback from the public ASAN
interface. However, it appears that the callback gets notified but
cannot really act on whether it gets shown or not.
Is there a way to achieve this with the public interface?
One class of errors I'd like to suppress for starters have to do with
alignments when accessing typed arrays and coercing the type.
// Oliver
Hello,
currently I am looking into how to suppress certain error output
selectively. What I want to achieve here is not to simply hide them, but
to attack each class of errors one by one.
Bad idea. asan reports serious bugs. If you suppress the first bug report
and go further
your process is already corrupted.
So I stumbled over __asan_set_error_report_callback from the public ASAN
interface. However, it appears that the callback gets notified but
cannot really act on whether it gets shown or not.
Correct.
Is there a way to achieve this with the public interface?
No.
One class of errors I'd like to suppress for starters have to do with
alignments when accessing typed arrays and coercing the type.
Can you give a detailed example?
--kcc
Hi Kostya,
thanks for your response.
Hi Kostya,
thanks for your response.
> Bad idea. asan reports serious bugs. If you suppress the first bug
> report and go further
> your process is already corrupted.
Wait, I'm confused. Let me give you an example.
-------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
int main(int argc, char** argv)
{
size_t i;
uint32_t buf[13];
const size_t bufct = sizeof(buf)/sizeof(buf[0]);
const uint8_t* bbuf = (uint8_t*)buf;
setbuf(stdout, NULL); /* no stdio buffering */
for(i = 0; i < sizeof(buf)/sizeof(buf[0]); i++)
buf[i] = 0xAABBCCDD;
/* provoke an error during the last iteration */
for(i = 0; i < sizeof(buf); i++)
/* type coercion provokes misaligned read */
printf("%08X\n", *((uint32_t*)&bbuf[i]));
return 0;
}
-------------------
The error I would like to see is that the last iterations read the
buffer beyond its limits. The one I get to see before - and which I'd
like to filter - is the one reading:
asan.c:19:20: runtime error: load of misaligned address ...
This is an error coming from -fsanitize=undefined, just drop this flag.
FYI continuing execution after first error was rather successful here (we applied some local patches to GCC).
We have a rather big app (rebuild takes hours) and forcing QA team to attack errors one-by-one would be tremendously inefficient.
-Y