[asan] Also allow for SIGBUS in high-address-dereference.c

FreeBSD delivers a SIGBUS signal for bad addresses rather than SIGSEGV.

Reviewed By: #sanitizers, vitalybuka, yln

Differential Revision: https://reviews.llvm.org/D85409
This commit is contained in:
Alex Richardson 2020-08-24 18:55:22 +01:00
parent ee2fdedd84
commit 5695fa9190
2 changed files with 5 additions and 5 deletions

View File

@ -293,7 +293,7 @@ uptr SignalContext::GetAddress() const {
bool SignalContext::IsMemoryAccess() const { bool SignalContext::IsMemoryAccess() const {
auto si = static_cast<const siginfo_t *>(siginfo); auto si = static_cast<const siginfo_t *>(siginfo);
return si->si_signo == SIGSEGV; return si->si_signo == SIGSEGV || si->si_signo == SIGBUS;
} }
int SignalContext::GetType() const { int SignalContext::GetType() const {

View File

@ -25,8 +25,8 @@ int main(int argc, const char *argv[]) {
// ZERO: SEGV on unknown address 0x000000000000 (pc // ZERO: SEGV on unknown address 0x000000000000 (pc
// LOW1: SEGV on unknown address 0x000000000fff (pc // LOW1: SEGV on unknown address 0x000000000fff (pc
// LOW2: SEGV on unknown address 0x000000001000 (pc // LOW2: SEGV on unknown address 0x000000001000 (pc
// HIGH: SEGV on unknown address (pc // HIGH: {{BUS|SEGV}} on unknown address (pc
// MAX: SEGV on unknown address (pc // MAX: {{BUS|SEGV}} on unknown address (pc
// HINT-PAGE0-NOT: Hint: this fault was caused by a dereference of a high value address // HINT-PAGE0-NOT: Hint: this fault was caused by a dereference of a high value address
// HINT-PAGE0: Hint: address points to the zero page. // HINT-PAGE0: Hint: address points to the zero page.
@ -40,8 +40,8 @@ int main(int argc, const char *argv[]) {
// ZERO: SCARINESS: 10 (null-deref) // ZERO: SCARINESS: 10 (null-deref)
// LOW1: SCARINESS: 10 (null-deref) // LOW1: SCARINESS: 10 (null-deref)
// LOW2: SCARINESS: 20 (wild-addr-read) // LOW2: SCARINESS: 20 (wild-addr-read)
// HIGH: SCARINESS: 20 (wild-addr-read) // HIGH: SCARINESS: {{(20 \(wild-addr-read\))|(60 \(wild-jump\))}}
// MAX: SCARINESS: 20 (wild-addr-read) // MAX: SCARINESS: {{(20 \(wild-addr-read\))|(60 \(wild-jump\))}}
// TODO: Currently, register values are only printed on Mac. Once this changes, // TODO: Currently, register values are only printed on Mac. Once this changes,
// remove the 'TODO_' prefix in the following lines. // remove the 'TODO_' prefix in the following lines.