diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-03-25 12:32:02 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-03-25 12:32:02 +0000 |
commit | 9c2b23171805126e9464a32d20faafe9a9f61098 (patch) | |
tree | b1b15d9075830bd60f4e5587c8d9f27f4bcba29f /libfuzzer/FuzzerUtilPosix.cpp | |
parent | 6ef352c644106bdf993c1a4fcc0a253716b92780 (diff) | |
parent | 4e031b3a08a06e36fa74d66192dac5250ad69131 (diff) | |
download | libfuzzer-sys-9c2b23171805126e9464a32d20faafe9a9f61098.tar.gz |
Snap for 8358640 from 4e031b3a08a06e36fa74d66192dac5250ad69131 to mainline-go-cellbroadcast-releaseaml_go_cbr_330912000android13-mainline-go-cellbroadcast-release
Change-Id: Ic3682978db6b184b0b28c622a3bc71522bace2bb
Diffstat (limited to 'libfuzzer/FuzzerUtilPosix.cpp')
-rw-r--r-- | libfuzzer/FuzzerUtilPosix.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libfuzzer/FuzzerUtilPosix.cpp b/libfuzzer/FuzzerUtilPosix.cpp index afb7334..0446d73 100644 --- a/libfuzzer/FuzzerUtilPosix.cpp +++ b/libfuzzer/FuzzerUtilPosix.cpp @@ -77,10 +77,13 @@ static void SetSigaction(int signum, return; } - sigact = {}; - sigact.sa_flags = SA_SIGINFO; - sigact.sa_sigaction = callback; - if (sigaction(signum, &sigact, 0)) { + struct sigaction new_sigact = {}; + // Address sanitizer needs SA_ONSTACK (causing the signal handler to run on a + // dedicated stack) in order to be able to detect stack overflows; keep the + // flag if it's set. + new_sigact.sa_flags = SA_SIGINFO | (sigact.sa_flags & SA_ONSTACK); + new_sigact.sa_sigaction = callback; + if (sigaction(signum, &new_sigact, nullptr)) { Printf("libFuzzer: sigaction failed with %d\n", errno); exit(1); } |