[compiler-rt] r327337 - [asan] poison_heap=0 should not disable __asan_handle_no_return.
Evgeniy Stepanov via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 12 14:46:55 PDT 2018
Author: eugenis
Date: Mon Mar 12 14:46:55 2018
New Revision: 327337
URL: http://llvm.org/viewvc/llvm-project?rev=327337&view=rev
Log:
[asan] poison_heap=0 should not disable __asan_handle_no_return.
Reviewers: kcc, alekseyshl, vitalybuka
Subscribers: kubamracek, llvm-commits
Differential Revision: https://reviews.llvm.org/D44339
Added:
compiler-rt/trunk/test/asan/TestCases/handle_noreturn_bug.cc
Modified:
compiler-rt/trunk/lib/asan/asan_poisoning.cc
compiler-rt/trunk/lib/asan/asan_poisoning.h
Modified: compiler-rt/trunk/lib/asan/asan_poisoning.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_poisoning.cc?rev=327337&r1=327336&r2=327337&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_poisoning.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_poisoning.cc Mon Mar 12 14:46:55 2018
@@ -32,7 +32,7 @@ bool CanPoisonMemory() {
}
void PoisonShadow(uptr addr, uptr size, u8 value) {
- if (!CanPoisonMemory()) return;
+ if (value && !CanPoisonMemory()) return;
CHECK(AddrIsAlignedByGranularity(addr));
CHECK(AddrIsInMem(addr));
CHECK(AddrIsAlignedByGranularity(addr + size));
Modified: compiler-rt/trunk/lib/asan/asan_poisoning.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_poisoning.h?rev=327337&r1=327336&r2=327337&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_poisoning.h (original)
+++ compiler-rt/trunk/lib/asan/asan_poisoning.h Mon Mar 12 14:46:55 2018
@@ -38,7 +38,7 @@ void PoisonShadowPartialRightRedzone(upt
// performance-critical code with care.
ALWAYS_INLINE void FastPoisonShadow(uptr aligned_beg, uptr aligned_size,
u8 value) {
- DCHECK(CanPoisonMemory());
+ DCHECK(!value || CanPoisonMemory());
uptr shadow_beg = MEM_TO_SHADOW(aligned_beg);
uptr shadow_end = MEM_TO_SHADOW(
aligned_beg + aligned_size - SHADOW_GRANULARITY) + 1;
Added: compiler-rt/trunk/test/asan/TestCases/handle_noreturn_bug.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/handle_noreturn_bug.cc?rev=327337&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/handle_noreturn_bug.cc (added)
+++ compiler-rt/trunk/test/asan/TestCases/handle_noreturn_bug.cc Mon Mar 12 14:46:55 2018
@@ -0,0 +1,13 @@
+// Regression test: __asan_handle_no_return should unpoison stack even with poison_heap=0.
+// RUN: %clangxx_asan -O0 %s -o %t && \
+// RUN: %env_asan_opts=poison_heap=1 %run %t && \
+// RUN: %env_asan_opts=poison_heap=0 %run %t
+
+#include <sanitizer/asan_interface.h>
+
+int main(int argc, char **argv) {
+ int x[2];
+ int * volatile p = &x[0];
+ __asan_handle_no_return();
+ int volatile z = p[2];
+}
More information about the llvm-commits
mailing list