[asan] Set flags appropriately for RTEMS
authorWalter Lee <waltl@google.com>
Mon, 7 May 2018 16:38:20 +0000 (16:38 +0000)
committerWalter Lee <waltl@google.com>
Mon, 7 May 2018 16:38:20 +0000 (16:38 +0000)
Disable both unmap_shadow_on_exit and protect_shadow_gap.

Differential Revision: https://reviews.llvm.org/D46461

llvm-svn: 331647

compiler-rt/lib/asan/asan_flags.cc
compiler-rt/lib/asan/asan_flags.inc

index 1c67288..5682ab4 100644 (file)
@@ -160,6 +160,10 @@ void InitializeFlags() {
   CHECK_LE(f->max_redzone, 2048);
   CHECK(IsPowerOfTwo(f->redzone));
   CHECK(IsPowerOfTwo(f->max_redzone));
+  if (SANITIZER_RTEMS) {
+    CHECK(!f->unmap_shadow_on_exit);
+    CHECK(!f->protect_shadow_gap);
+  }
 
   // quarantine_size is deprecated but we still honor it.
   // quarantine_size can not be used together with quarantine_size_mb.
index 1663ae2..5dc8b60 100644 (file)
@@ -86,9 +86,10 @@ ASAN_FLAG(
 ASAN_FLAG(bool, check_malloc_usable_size, true,
           "Allows the users to work around the bug in Nvidia drivers prior to "
           "295.*.")
-ASAN_FLAG(bool, unmap_shadow_on_exit, false,
+ASAN_FLAG(bool, unmap_shadow_on_exit, !SANITIZER_RTEMS,
           "If set, explicitly unmaps the (huge) shadow at exit.")
-ASAN_FLAG(bool, protect_shadow_gap, true, "If set, mprotect the shadow gap")
+ASAN_FLAG(bool, protect_shadow_gap, !SANITIZER_RTEMS,
+          "If set, mprotect the shadow gap")
 ASAN_FLAG(bool, print_stats, false,
           "Print various statistics after printing an error message or if "
           "atexit=1.")