[compiler-rt] cb9f2de - Revert "[fuzzer] Don't hard-code page size in FuzzerUtil.h"

Jason Molenda via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 18:06:03 PDT 2023


Author: Jason Molenda
Date: 2023-05-25T18:05:10-07:00
New Revision: cb9f2de2e80292c0445c99be754fcc78b94b0f16

URL: https://github.com/llvm/llvm-project/commit/cb9f2de2e80292c0445c99be754fcc78b94b0f16
DIFF: https://github.com/llvm/llvm-project/commit/cb9f2de2e80292c0445c99be754fcc78b94b0f16.diff

LOG: Revert "[fuzzer] Don't hard-code page size in FuzzerUtil.h"

This reverts commit a2b677e8153758997a9043360cf51333eecc3c44.

reverting

Differential Revision: https://reviews.llvm.org/D140607

because <sys/auxv.h> and getauxval() are not available on macOS;
this change is breaking the mac CI bots.

Added: 
    

Modified: 
    compiler-rt/lib/fuzzer/FuzzerUtil.cpp
    compiler-rt/lib/fuzzer/FuzzerUtil.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/fuzzer/FuzzerUtil.cpp b/compiler-rt/lib/fuzzer/FuzzerUtil.cpp
index 4872463bc5c29..aeab70f20c28e 100644
--- a/compiler-rt/lib/fuzzer/FuzzerUtil.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerUtil.cpp
@@ -19,7 +19,6 @@
 #include <signal.h>
 #include <sstream>
 #include <stdio.h>
-#include <sys/auxv.h>
 #include <sys/types.h>
 #include <thread>
 
@@ -235,9 +234,4 @@ uint64_t SimpleFastHash(const void *Data, size_t Size, uint64_t Initial) {
   return Res;
 }
 
-size_t PageSize() {
-  static size_t PageSizeCached = getauxval(AT_PAGESZ);
-  return PageSizeCached;
-}
-
 }  // namespace fuzzer

diff  --git a/compiler-rt/lib/fuzzer/FuzzerUtil.h b/compiler-rt/lib/fuzzer/FuzzerUtil.h
index 5296e7784b3f5..71d49097e559a 100644
--- a/compiler-rt/lib/fuzzer/FuzzerUtil.h
+++ b/compiler-rt/lib/fuzzer/FuzzerUtil.h
@@ -94,8 +94,7 @@ inline size_t Log(size_t X) {
   return static_cast<size_t>((sizeof(unsigned long long) * 8) - Clzll(X) - 1);
 }
 
-size_t PageSize();
-
+inline size_t PageSize() { return 4096; }
 inline uint8_t *RoundUpByPage(uint8_t *P) {
   uintptr_t X = reinterpret_cast<uintptr_t>(P);
   size_t Mask = PageSize() - 1;


        


More information about the llvm-commits mailing list