Skip to content

Commit c6d183c

Browse files
randall77github-actions[bot]
authored andcommitted
Automerge: 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.
2 parents bfd2b59 + 03372c7 commit c6d183c

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,10 @@ static void SetSigaction(int signum,
7878
}
7979

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

0 commit comments

Comments
 (0)