Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common Use sys...



details:   https://anonhg.NetBSD.org/src/rev/7621f5a4c481
branches:  trunk
changeset: 1014040:7621f5a4c481
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Sep 11 01:07:53 2020 +0000

description:
Use sysctl to implement GetPageSize()

Cherry-pick code chunk from newer LLVM compiler-rt.

diffstat:

 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc |  8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diffs (18 lines):

diff -r 70803a224b6d -r 7621f5a4c481 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc
--- a/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc   Fri Sep 11 01:07:27 2020 +0000
+++ b/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc   Fri Sep 11 01:07:53 2020 +0000
@@ -1139,6 +1139,14 @@
 // Android post-M sysconf(_SC_PAGESIZE) crashes if called from .preinit_array.
 #if SANITIZER_ANDROID
   return 4096;
+#elif SANITIZER_FREEBSD || SANITIZER_NETBSD
+// Use sysctl as sysconf can trigger interceptors internally.
+  int pz = 0;
+  uptr pzl = sizeof(pz);
+  int mib[2] = {CTL_HW, HW_PAGESIZE};
+  int rv = internal_sysctl(mib, 2, &pz, &pzl, nullptr, 0);
+  CHECK_EQ(rv, 0);
+  return (uptr)pz;
 #elif SANITIZER_LINUX && (defined(__x86_64__) || defined(__i386__))
   return EXEC_PAGESIZE;
 #elif SANITIZER_USE_GETAUXVAL



Home | Main Index | Thread Index | Old Index