Revert "[libFuzzer] always install signal handler with SA_ONSTACK" (#153114)

Reverts llvm/llvm-project#147422

Seems to be causing problems with tracebacks. Probably the trackback
code doesn't know how to switch back to the regular stack after it gets
to the top of the signal stack.
This commit is contained in:
Keith Randall 2025-08-12 08:52:58 -07:00 committed by GitHub
parent 6abbfcae6e
commit 03372c7782
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -78,14 +78,10 @@ static void SetSigaction(int signum,
} }
struct sigaction new_sigact = {}; struct sigaction new_sigact = {};
// SA_ONSTACK is required for certain runtimes that use small stacks, for // Address sanitizer needs SA_ONSTACK (causing the signal handler to run on a
// instance the Go runtime. // dedicated stack) in order to be able to detect stack overflows; keep the
// See https://github.com/golang/go/issues/49075 // flag if it's set.
// Address sanitizer also wants SA_ONSTACK, and the fuzzer and sanitizer new_sigact.sa_flags = SA_SIGINFO | (sigact.sa_flags & SA_ONSTACK);
// often run together.
// SA_ONSTACK is a no-op unless someone also calls sigaltstack. That is left
// up to code that needs it.
new_sigact.sa_flags = SA_SIGINFO | SA_ONSTACK;
new_sigact.sa_sigaction = callback; new_sigact.sa_sigaction = callback;
if (sigaction(signum, &new_sigact, nullptr)) { if (sigaction(signum, &new_sigact, nullptr)) {
Printf("libFuzzer: sigaction failed with %d\n", errno); Printf("libFuzzer: sigaction failed with %d\n", errno);