[compiler-rt] r253108 - [asan] add an experimental flag protect_shadow_gap. If set to false, the shadow gap will not be mprotect-ed and all hell may break loose. But this makes CUDA's cuInit() pass.

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 13 16:50:23 PST 2015


Author: kcc
Date: Fri Nov 13 18:50:23 2015
New Revision: 253108

URL: http://llvm.org/viewvc/llvm-project?rev=253108&view=rev
Log:
[asan] add an experimental flag protect_shadow_gap. If set to false, the shadow gap will not be mprotect-ed and all hell may break loose. But this makes CUDA's cuInit() pass. 

Modified:
    compiler-rt/trunk/lib/asan/asan_flags.inc
    compiler-rt/trunk/lib/asan/asan_rtl.cc

Modified: compiler-rt/trunk/lib/asan/asan_flags.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_flags.inc?rev=253108&r1=253107&r2=253108&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_flags.inc (original)
+++ compiler-rt/trunk/lib/asan/asan_flags.inc Fri Nov 13 18:50:23 2015
@@ -75,6 +75,7 @@ ASAN_FLAG(bool, check_malloc_usable_size
           "295.*.")
 ASAN_FLAG(bool, unmap_shadow_on_exit, false,
           "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, print_stats, false,
           "Print various statistics after printing an error message or if "
           "atexit=1.")

Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=253108&r1=253107&r2=253108&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Fri Nov 13 18:50:23 2015
@@ -326,6 +326,8 @@ static void InitializeHighMemEnd() {
 }
 
 static void ProtectGap(uptr addr, uptr size) {
+  if (!flags()->protect_shadow_gap)
+    return;
   void *res = MmapNoAccess(addr, size, "shadow gap");
   if (addr == (uptr)res)
     return;




More information about the llvm-commits mailing list