[compiler-rt] 5695fa9 - [asan] Also allow for SIGBUS in high-address-dereference.c
Alex Richardson via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 04:21:48 PDT 2020
Author: Alex Richardson
Date: 2020-08-25T12:20:33+01:00
New Revision: 5695fa9190595e6c82d14c830060538d227622c9
URL: https://github.com/llvm/llvm-project/commit/5695fa9190595e6c82d14c830060538d227622c9
DIFF: https://github.com/llvm/llvm-project/commit/5695fa9190595e6c82d14c830060538d227622c9.diff
LOG: [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
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp
compiler-rt/test/asan/TestCases/Posix/high-address-dereference.c
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp
index 964d7e7ff66a..b8b75c20d9f9 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp
@@ -293,7 +293,7 @@ uptr SignalContext::GetAddress() const {
bool SignalContext::IsMemoryAccess() const {
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 {
diff --git a/compiler-rt/test/asan/TestCases/Posix/high-address-dereference.c b/compiler-rt/test/asan/TestCases/Posix/high-address-dereference.c
index 78503302891b..845e126d3f89 100644
--- a/compiler-rt/test/asan/TestCases/Posix/high-address-dereference.c
+++ b/compiler-rt/test/asan/TestCases/Posix/high-address-dereference.c
@@ -25,8 +25,8 @@ int main(int argc, const char *argv[]) {
// ZERO: SEGV on unknown address 0x000000000000 (pc
// LOW1: SEGV on unknown address 0x000000000fff (pc
// LOW2: SEGV on unknown address 0x000000001000 (pc
-// HIGH: SEGV on unknown address (pc
-// MAX: SEGV on unknown address (pc
+// HIGH: {{BUS|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: Hint: address points to the zero page.
@@ -40,8 +40,8 @@ int main(int argc, const char *argv[]) {
// ZERO: SCARINESS: 10 (null-deref)
// LOW1: SCARINESS: 10 (null-deref)
// LOW2: SCARINESS: 20 (wild-addr-read)
-// HIGH: SCARINESS: 20 (wild-addr-read)
-// MAX: SCARINESS: 20 (wild-addr-read)
+// HIGH: SCARINESS: {{(20 \(wild-addr-read\))|(60 \(wild-jump\))}}
+// MAX: SCARINESS: {{(20 \(wild-addr-read\))|(60 \(wild-jump\))}}
// TODO: Currently, register values are only printed on Mac. Once this changes,
// remove the 'TODO_' prefix in the following lines.
More information about the llvm-commits
mailing list