[compiler-rt] f9125dd - Revert "[libfuzzer] use timer_create() instead of setitimer() for linux" (#115811)

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


Author: Florian Mayer
Date: 2024-11-11T19:50:30-08:00
New Revision: f9125ddc1faafaceac9064e889cd9b4a77523677

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

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

Reverts llvm/llvm-project#110274

Buildbots broke

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-commits mailing list