summaryrefslogtreecommitdiff
path: root/lib/asan
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
commitde01ea1f543e5dc31c1ea908b8061268ab325546 (patch)
treebbe93a6dda5a8535371dd36fb8203e1098a954c5 /lib/asan
parent8f5633c1a7812ec4c8b549c67675b98c1dade82a (diff)
[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.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253108 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan')
-rw-r--r--lib/asan/asan_flags.inc1
-rw-r--r--lib/asan/asan_rtl.cc2
2 files changed, 3 insertions, 0 deletions
diff --git a/lib/asan/asan_flags.inc b/lib/asan/asan_flags.inc
index 406c494dd..c0ae02705 100644
--- a/lib/asan/asan_flags.inc
+++ b/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/lib/asan/asan_rtl.cc b/lib/asan/asan_rtl.cc
index 65e04972e..c22add53d 100644
--- a/lib/asan/asan_rtl.cc
+++ b/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;