summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-11-14 00:50:23 +0000
committerKostya Serebryany <kcc@google.com>2015-11-14 00:50:23 +0000
commitfb484cedb4f095fc43285b14f2d6c3a209922fa7 (patch)
treee1bb0180e413cf90195b6b8320027e3d918454a8 /compiler-rt/lib
parent09a134eca3960d16325090631428b3dbc535ce4b (diff)
downloadbcm5719-llvm-fb484cedb4f095fc43285b14f2d6c3a209922fa7.tar.gz
bcm5719-llvm-fb484cedb4f095fc43285b14f2d6c3a209922fa7.zip
[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.
llvm-svn: 253108
Diffstat (limited to 'compiler-rt/lib')
-rw-r--r--compiler-rt/lib/asan/asan_flags.inc1
-rw-r--r--compiler-rt/lib/asan/asan_rtl.cc2
2 files changed, 3 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/asan_flags.inc b/compiler-rt/lib/asan/asan_flags.inc
index 406c494ddc7..c0ae0270512 100644
--- a/compiler-rt/lib/asan/asan_flags.inc
+++ b/compiler-rt/lib/asan/asan_flags.inc
@@ -75,6 +75,7 @@ ASAN_FLAG(bool, check_malloc_usable_size, true,
"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.")
diff --git a/compiler-rt/lib/asan/asan_rtl.cc b/compiler-rt/lib/asan/asan_rtl.cc
index 65e04972e44..c22add53d75 100644
--- a/compiler-rt/lib/asan/asan_rtl.cc
+++ b/compiler-rt/lib/asan/asan_rtl.cc
@@ -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;
OpenPOWER on IntegriCloud