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

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 19:51:08 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Florian Mayer (fmayer)

<details>
<summary>Changes</summary>

Reverts llvm/llvm-project#<!-- -->110274

Buildbots broke

---
Full diff: https://github.com/llvm/llvm-project/pull/115811.diff


1 Files Affected:

- (modified) compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp (+4-9) 


``````````diff
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) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/115811


More information about the llvm-commits mailing list