Exempt SIGPIPE from sentry signal forwarding.

The sentry may get SIGPIPE from writing to readerless pipes or shutdown
sockets; in these cases, it's incorrect to forward the SIGPIPE to app PID 1.

(It would be correct to send SIGPIPE to the app thread performing the write
instead, but we can't do so with signal forwarding since (1) we can't identify
the correct app thread to signal and (2) Go signal handling with os/signal is
async - the sentry thread that received SIGPIPE continued execution after doing
so, so the app thread may already be running. Having the sentry send SIGPIPE
independently of the host is gvisor.dev/issue/161.)

Updates #7293

PiperOrigin-RevId: 445469810
This commit is contained in:
Jamie Liu
2022-04-29 11:46:33 -07:00
committed by gVisor bot
parent a1aa00f922
commit f9afde9b88
+4
View File
@@ -90,6 +90,10 @@ func StartSignalForwarding(handler func(linux.Signal)) func() {
if sig == int(linux.SIGURG) {
continue
}
// SIGPIPE is received when sending to disconnected host pipes/sockets.
if sig == int(linux.SIGPIPE) {
continue
}
signal.Notify(sigchan, unix.Signal(sig))
}
// Start up our listener.