[PATCH] D64166: [ASan] Use __sanitizer_fill_shadow for FastPoisonShadow on Fuchsia

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 00:31:35 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL365739: [ASan] Use __sanitizer_fill_shadow for FastPoisonShadow on Fuchsia (authored by phosek, committed by ).
Herald added a subscriber: delcypher.

Changed prior to commit:
  https://reviews.llvm.org/D64166?vs=209132&id=209134#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64166/new/

https://reviews.llvm.org/D64166

Files:
  compiler-rt/trunk/lib/asan/asan_poisoning.h


Index: compiler-rt/trunk/lib/asan/asan_poisoning.h
===================================================================
--- compiler-rt/trunk/lib/asan/asan_poisoning.h
+++ compiler-rt/trunk/lib/asan/asan_poisoning.h
@@ -15,6 +15,7 @@
 #include "asan_internal.h"
 #include "asan_mapping.h"
 #include "sanitizer_common/sanitizer_flags.h"
+#include "sanitizer_common/sanitizer_platform.h"
 
 namespace __asan {
 
@@ -38,6 +39,10 @@
 ALWAYS_INLINE void FastPoisonShadow(uptr aligned_beg, uptr aligned_size,
                                     u8 value) {
   DCHECK(!value || CanPoisonMemory());
+#if SANITIZER_FUCHSIA
+  __sanitizer_fill_shadow(aligned_beg, aligned_size, value,
+                          common_flags()->clear_shadow_mmap_threshold);
+#else
   uptr shadow_beg = MEM_TO_SHADOW(aligned_beg);
   uptr shadow_end = MEM_TO_SHADOW(
       aligned_beg + aligned_size - SHADOW_GRANULARITY) + 1;
@@ -46,10 +51,6 @@
   // probably provide higher-level interface for these operations.
   // For now, just memset on Windows.
   if (value || SANITIZER_WINDOWS == 1 ||
-      // TODO(mcgrathr): Fuchsia doesn't allow the shadow mapping to be
-      // changed at all.  It doesn't currently have an efficient means
-      // to zero a bunch of pages, but maybe we should add one.
-      SANITIZER_FUCHSIA == 1 ||
       // RTEMS doesn't have have pages, let alone a fast way to zero
       // them, so default to memset.
       SANITIZER_RTEMS == 1 ||
@@ -72,6 +73,7 @@
       ReserveShadowMemoryRange(page_beg, page_end - 1, nullptr);
     }
   }
+#endif // SANITIZER_FUCHSIA
 }
 
 ALWAYS_INLINE void FastPoisonShadowPartialRightRedzone(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64166.209134.patch
Type: text/x-patch
Size: 1638 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190711/3886d2c7/attachment.bin>


More information about the llvm-commits mailing list