summaryrefslogtreecommitdiffstats
path: root/libgo
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-08-30 17:30:07 +0200
committerIan Lance Taylor <iant@golang.org>2022-04-18 15:16:35 -0700
commit208b7d85d73cbd166e207f0e062cccbdfbf52bb3 (patch)
tree9ad7aa0d2479624e6a39cca53959dcd5219d4804 /libgo
parentlibstdc++: Micro-optimize __from_chars_pow2_base (diff)
downloadgcc-208b7d85d73cbd166e207f0e062cccbdfbf52bb3.tar.gz
gcc-208b7d85d73cbd166e207f0e062cccbdfbf52bb3.tar.bz2
gcc-208b7d85d73cbd166e207f0e062cccbdfbf52bb3.tar.xz
runtime: add special handling for signal 34
The musl libc uses signal 34 internally for setgid (similar to how glibc uses signal 32 and signal 33). For this reason, special handling is needed for this signal in the runtime. The gc implementation already handles the signal accordingly. As such, this commit intends to simply copy the behavior of the Google Go implementation to libgo. See https://go.dev/issues/39343 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/400594
Diffstat (limited to 'libgo')
-rw-r--r--libgo/go/runtime/signal_gccgo.go3
-rw-r--r--libgo/mksigtab.sh4
2 files changed, 5 insertions, 2 deletions
diff --git a/libgo/go/runtime/signal_gccgo.go b/libgo/go/runtime/signal_gccgo.go
index 2eece687e35..82e6996ab7e 100644
--- a/libgo/go/runtime/signal_gccgo.go
+++ b/libgo/go/runtime/signal_gccgo.go
@@ -106,7 +106,8 @@ func getsig(i uint32) uintptr {
106 if sigaction(i, nil, &sa) < 0 { 106 if sigaction(i, nil, &sa) < 0 {
107 // On GNU/Linux glibc rejects attempts to call 107 // On GNU/Linux glibc rejects attempts to call
108 // sigaction with signal 32 (SIGCANCEL) or 33 (SIGSETXID). 108 // sigaction with signal 32 (SIGCANCEL) or 33 (SIGSETXID).
109 if GOOS == "linux" && (i == 32 || i == 33) { 109 // On musl signal 34 (SIGSYNCCALL) also needs to be treated accordingly.
110 if GOOS == "linux" && (i == 32 || i == 33 || i == 34) {
110 return _SIG_DFL 111 return _SIG_DFL
111 } 112 }
112 throw("sigaction read failure") 113 throw("sigaction read failure")
diff --git a/libgo/mksigtab.sh b/libgo/mksigtab.sh
index 11e4ec436bd..cdf6fcd823f 100644
--- a/libgo/mksigtab.sh
+++ b/libgo/mksigtab.sh
@@ -95,10 +95,12 @@ checksig _SIGLOST ' {_SigNotify, "SIGLOST: resource lost (Sun); server died (G
95 95
96# Special handling of signals 32 and 33 on GNU/Linux systems, 96# Special handling of signals 32 and 33 on GNU/Linux systems,
97# because they are special to glibc. 97# because they are special to glibc.
98# Signal 34 is additionally special to Linux systems with musl.
98if test "${GOOS}" = "linux"; then 99if test "${GOOS}" = "linux"; then
99 SIGLIST=$SIGLIST"_32__33_" 100 SIGLIST=$SIGLIST"_32__33__34_"
100 echo ' 32: {_SigSetStack + _SigUnblock, "signal 32"}, /* SIGCANCEL; see issue 6997 */' 101 echo ' 32: {_SigSetStack + _SigUnblock, "signal 32"}, /* SIGCANCEL; see issue 6997 */'
101 echo ' 33: {_SigSetStack + _SigUnblock, "signal 33"}, /* SIGSETXID; see issues 3871, 9400, 12498 */' 102 echo ' 33: {_SigSetStack + _SigUnblock, "signal 33"}, /* SIGSETXID; see issues 3871, 9400, 12498 */'
103 echo ' 34: {_SigSetStack + _SigUnblock, "signal 34"}, /* musl SIGSYNCCALL; see issue 39343 */'
102fi 104fi
103 105
104if test "${GOOS}" = "aix"; then 106if test "${GOOS}" = "aix"; then