diff options
| author | Damien Neil <dneil@google.com> | 2024-11-19 09:04:11 -0800 |
|---|---|---|
| committer | Damien Neil <dneil@google.com> | 2024-11-19 19:40:27 +0000 |
| commit | 944df9a7516021f0405cd8adb1e6894ae9872cb5 (patch) | |
| tree | be71a783bdfd559617e6ab51222d49c800d663d0 /src/runtime | |
| parent | 7e6b38e0529fbcff585fd741e011f5128cbcd8a5 (diff) | |
| download | go-944df9a7516021f0405cd8adb1e6894ae9872cb5.tar.xz | |
runtime: use indirect call in adjustSignalStack to avoid nosplit overflow
Avoids a nosplit stack overflow on OpenBSD after CL 591997
increases the adjustSignalStack stack by 16 bytes.
Change-Id: I2c990de6c7cd8d2aca6e6b98133da120c8a4174b
Reviewed-on: https://go-review.googlesource.com/c/go/+/629696
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/signal_unix.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index a056e21a2f..96628d6baa 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -584,15 +584,23 @@ func adjustSignalStack(sig uint32, mp *m, gsigStack *gsignalStack) bool { } // sp is not within gsignal stack, g0 stack, or sigaltstack. Bad. + // Call indirectly to avoid nosplit stack overflow on OpenBSD. + adjustSignalStack2Indirect(sig, sp, mp, st.ss_flags&_SS_DISABLE != 0) + return false +} + +var adjustSignalStack2Indirect = adjustSignalStack2 + +//go:nosplit +func adjustSignalStack2(sig uint32, sp uintptr, mp *m, ssDisable bool) { setg(nil) needm(true) - if st.ss_flags&_SS_DISABLE != 0 { + if ssDisable { noSignalStack(sig) } else { sigNotOnStack(sig, sp, mp) } dropm() - return false } // crashing is the number of m's we have waited for when implementing |
