[compiler-rt] r258706 - [asan] Don't use sysconf(_SC_PAGESIZE) on Android.
Evgeniy Stepanov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 25 11:25:20 PST 2016
Author: eugenis
Date: Mon Jan 25 13:25:20 2016
New Revision: 258706
URL: http://llvm.org/viewvc/llvm-project?rev=258706&view=rev
Log:
[asan] Don't use sysconf(_SC_PAGESIZE) on Android.
This is broken in the current (post-MNC) master branch.
Use EXEC_PAGESIZE instead, the same as on x86 Linux.
This change fixes startup crashes in the existing tests on AOSP
master.
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=258706&r1=258705&r2=258706&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Mon Jan 25 13:25:20 2016
@@ -710,7 +710,9 @@ bool ThreadLister::GetDirectoryEntries()
}
uptr GetPageSize() {
-#if SANITIZER_LINUX && (defined(__x86_64__) || defined(__i386__))
+// Android post-M sysconf(_SC_PAGESIZE) crashes if called from .preinit_array.
+#if (SANITIZER_LINUX && (defined(__x86_64__) || defined(__i386__))) || \
+ SANITIZER_ANDROID
return EXEC_PAGESIZE;
#else
return sysconf(_SC_PAGESIZE); // EXEC_PAGESIZE may not be trustworthy.
More information about the llvm-commits
mailing list