When dump_instruction_bytes=1 and the instruction pointer doesn't point to the zero page, ASan prints 16 bytes starting at the instruction point.
When the instruction pointer points to the zero page, print a warning about that.
Also allow deadly signals to be received in signal handlers (previously ASan would just crash upon the second SEGV)
Details
Diff Detail
Event Timeline
What if instruction pc points to is not in the zero page, but is inaccessible? It would be sad to crash the program while printing ASan error report in this case.
lib/asan/asan_report.cc | ||
---|---|---|
162 | You may check that pc < GetPageSizeCached() here. | |
656 | We print pc above... do you really need this? | |
lib/asan/asan_rtl.cc | ||
234 | Wait, where is the default value for this flag? | |
lib/sanitizer_common/sanitizer_posix_libcdep.cc | ||
151 | Can this go as a separate change? |
What if instruction pc points to is not in the zero page, but is inaccessible? It would be sad to crash the program while printing ASan error report in this case.
What if instruction pc points to is not in the zero page, but is inaccessible? It would be sad to crash the program while printing ASan error report in this case.
If pc points to inaccessible page, then we're in a SEGV handler caused by this. We can't print anything meaningful besides the stack, and _Unwind_Backtrace() will crash on this pc right away.
lib/asan/asan_report.cc | ||
---|---|---|
162 | Done. | |
656 | Many people do not understand that this is just a SEGV handler, so they keep asking whether this crash is a false positive and why ASan doesn't print more info about it. | |
lib/asan/asan_rtl.cc | ||
234 | Done. | |
lib/sanitizer_common/sanitizer_posix_libcdep.cc | ||
151 | Done. |
Alright, let's do this if you feel it would improve user experience in certain cases.
I take back my argument about crashes in _Unwind_Backtrace.
Apparently at least on OSX unwinding the stack from the unmapped page doesn't necessarily crash the unwinder. Thus we probably need to unprotect the faulting page before trying to dump instruction bytes.
Call IsAccessibleMemoryRange() to make sure we don't step on unaccessible memory.
Disable the test on ARM.
You may check that pc < GetPageSizeCached() here.