[llvm-branch-commits] [compiler-rt] 8a6c047 - Revert "[libfuzzer] use timer_create() instead of setitimer() for linux (#110…"

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Nov 11 19:50:15 PST 2024


Author: Florian Mayer
Date: 2024-11-11T19:50:12-08:00
New Revision: 8a6c047367e258ace4dc5a9416bea088572ca635

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

LOG: Revert "[libfuzzer] use timer_create() instead of setitimer() for linux (#110…"

This reverts commit 3b29a8a00809e868e3df7e687695670ff5077fbd.

Added: 
    

Modified: 
    compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp
index 36a1122c9f7cc8..392c1e5be4eea3 100644
--- a/compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp
@@ -104,19 +104,14 @@ bool ExecuteCommand(const Command &Cmd, std::string *CmdOutput) {
 }
 
 void SetTimer(int Seconds) {
-  timer_t TimerId;
-  struct itimerspec T {
+  struct itimerval T {
     {Seconds, 0}, { Seconds, 0 }
   };
-  SetSigaction(SIGALRM, AlarmHandler);
-  if (timer_create(CLOCK_REALTIME, nullptr, &TimerId) == -1) {
-    Printf("libFuzzer: timer_create failed with %d\n", errno);
-    exit(1);
-  }
-  if (timer_settime(TimerId, 0, &T, nullptr) == -1) {
-    Printf("libFuzzer: timer_settime failed with %d\n", errno);
+  if (setitimer(ITIMER_REAL, &T, nullptr)) {
+    Printf("libFuzzer: setitimer failed with %d\n", errno);
     exit(1);
   }
+  SetSigaction(SIGALRM, AlarmHandler);
 }
 
 void SetSignalHandler(const FuzzingOptions& Options) {


        


More information about the llvm-branch-commits mailing list