[compiler-rt] Revert "[libfuzzer] use timer_create() instead of setitimer() for linux" (PR #115811)
Florian Mayer via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 11 19:50:32 PST 2024
https://github.com/fmayer created https://github.com/llvm/llvm-project/pull/115811
Reverts llvm/llvm-project#110274
Buildbots broke
>From 8a6c047367e258ace4dc5a9416bea088572ca635 Mon Sep 17 00:00:00 2001
From: Florian Mayer <florian.mayer at bitsrc.org>
Date: Mon, 11 Nov 2024 19:50:12 -0800
Subject: [PATCH] =?UTF-8?q?Revert=20"[libfuzzer]=20use=20timer=5Fcreate()?=
=?UTF-8?q?=20instead=20of=20setitimer()=20for=20linux=20(#110=E2=80=A6"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 3b29a8a00809e868e3df7e687695670ff5077fbd.
---
compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
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