summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-12-22 14:18:32 -0500
committerTavian Barnes <tavianator@tavianator.com>2024-12-22 14:20:59 -0500
commit9a02b87dc137ee146bca5a0545201b4f27591405 (patch)
tree01d9decd410590d417fee31ec6fa4520d47b33e4 /src
parent9c1effd20effd4833042c46b51e4ce787c120c52 (diff)
downloadbfs-main.tar.xz
sighook: Always re-raise faults on macOSHEADmain
macOS always fills in si_code for SIG{BUS,ILL,SEGV} as if it were a real hardware fault, so returning from the handler is not guaranteed to re- trigger the signal. Fixes: aecdabb ("sighook: Return instead of re-raising for faults") Link: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2386463/4/util/posix/signals_test.cc Link: https://github.com/chromium/crashpad/commit/e0d8a0aa01ac176804077f1f128ccc894c098f79
Diffstat (limited to 'src')
-rw-r--r--src/sighook.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/sighook.c b/src/sighook.c
index 6fd4c86..e74bb78 100644
--- a/src/sighook.c
+++ b/src/sighook.c
@@ -452,9 +452,16 @@ static void sigdispatch(int sig, siginfo_t *info, void *context) {
// to die "correctly" (e.g. with a core dump pointing at the faulting
// instruction, not reraise()).
if (is_fault(info)) {
+ // On macOS, we cannot reliably distinguish between faults and
+ // asynchronous signals. For example, pkill -SEGV bfs will
+ // result in si_code == SEGV_ACCERR. So we always re-raise the
+ // signal, because just returning would cause us to ignore
+ // asynchronous SIG{BUS,ILL,SEGV}.
+#if !__APPLE__
if (signal(sig, SIG_DFL) != SIG_ERR) {
return;
}
+#endif
reraise(sig);
}