[asan] Hardcode page size 4096 on Android.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Tue, 26 Jul 2016 21:02:44 +0000 (21:02 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Tue, 26 Jul 2016 21:02:44 +0000 (21:02 +0000)
EXEC_PAGESIZE lies.
sysconf() is broken in .preinit_array.

llvm-svn: 276802

compiler-rt/lib/sanitizer_common/sanitizer_linux.cc

index 5c5a1a6..b8890ea 100644 (file)
@@ -801,8 +801,9 @@ bool ThreadLister::GetDirectoryEntries() {
 
 uptr GetPageSize() {
 // Android post-M sysconf(_SC_PAGESIZE) crashes if called from .preinit_array.
-#if (SANITIZER_LINUX && (defined(__x86_64__) || defined(__i386__))) || \
-    SANITIZER_ANDROID
+#if SANITIZER_ANDROID
+  return 4096;
+#elif SANITIZER_LINUX && (defined(__x86_64__) || defined(__i386__))
   return EXEC_PAGESIZE;
 #else
   return sysconf(_SC_PAGESIZE);  // EXEC_PAGESIZE may not be trustworthy.