[PATCH] Do not sanitize kernel area on 32-bit targets
Kostya Serebryany
kcc at google.com
Mon Mar 24 00:39:09 PDT 2014
================
Comment at: lib/sanitizer_common/sanitizer_posix.cc:45
@@ -39,3 +44,3 @@
// of the address space, so simply checking the stack address is not enough.
- return (1ULL << 44) - 1; // 0x00000fffffffffffUL
+ res = (1ULL << 44) - 1; // 0x00000fffffffffffUL
# elif defined(__aarch64__)
----------------
please don't change the 64-bit code path
================
Comment at: lib/sanitizer_common/sanitizer_posix.cc:53
@@ +52,3 @@
+ res = (1ULL << 32) - 1; // 0xffffffff;
+# if SANITIZER_LINUX
+ // Take care of unusable kernel area in top gigabyte
----------------
Move this logic into a separate function.
Provide a unit test for it, that will work on both 64-bit machine and 32-bit machine (differently, of course).
================
Comment at: lib/asan/asan_mapping.h:112
@@ -111,2 +111,3 @@
: kZeroBaseShadowStart)
-#define kShadowGapEnd ((kMidMemBeg ? kMidShadowBeg : kHighShadowBeg) - 1)
+#define kShadowGapEnd ((kMidMemBeg ? kMidShadowBeg \
+ : MEM_TO_SHADOW(kHighShadowEnd + 1)) - 1)
----------------
please extend the comment around "Default Linux/i386 mapping"
(add one more section that reflects the different of mapping on 32- and 64-bit OS)
================
Comment at: lib/asan/asan_rtl.cc:485
@@ -484,1 +484,3 @@
ProtectGap(kShadowGapBeg, kShadowGapEnd - kShadowGapBeg + 1);
+ // Allow accesses to unprotected part of address space
+ if (kShadowGapEnd != kHighShadowBeg - 1)
----------------
this is weird... This should not be required... hm.. Let me see your comments first.
http://llvm-reviews.chandlerc.com/D3119
More information about the llvm-commits
mailing list