runsc: don't redirect SIGURG which is used by Go's runtime scheduler

Go 1.14+ sends SIGURG to Ms to attempt asynchronous preemption of a G. Since it
can't guarantee that a SIGURG is only related to preemption, it continues to
forward them to signal.Notify (see runtime.sighandler).

When runsc is running a container, there are three processes: a parent process
and two children (sandbox and gopher). A parent process sets a signal handler
for all signals and redirect them to the container init process. This logic
should ignore SIGURG signals. We already ignore them in the Sentry, but it will
be better to not notify about them when this is possible.

PiperOrigin-RevId: 300345286
This commit is contained in:
Andrei Vagin
2020-03-11 09:50:06 -07:00
committed by gVisor bot
parent 7bca09107b
commit 2aa9514a06
+4
View File
@@ -83,6 +83,10 @@ func StartSignalForwarding(handler func(linux.Signal)) func() {
// for their handling.
var sigchans []chan os.Signal
for sig := 1; sig <= numSignals+1; sig++ {
// SIGURG is used by Go's runtime scheduler.
if sig == int(linux.SIGURG) {
continue
}
sigchan := make(chan os.Signal, 1)
sigchans = append(sigchans, sigchan)
signal.Notify(sigchan, syscall.Signal(sig))