diff options
-rw-r--r-- | runsc/boot/BUILD | 1 | ||||
-rw-r--r-- | runsc/boot/compat.go | 25 |
2 files changed, 20 insertions, 6 deletions
diff --git a/runsc/boot/BUILD b/runsc/boot/BUILD index 4984231d7..daa197437 100644 --- a/runsc/boot/BUILD +++ b/runsc/boot/BUILD @@ -46,6 +46,7 @@ go_library( "//pkg/sentry/fs/tty", "//pkg/sentry/inet", "//pkg/sentry/kernel", + "//pkg/sentry/kernel:uncaught_signal_go_proto", "//pkg/sentry/kernel/auth", "//pkg/sentry/kernel/kdefs", "//pkg/sentry/limits", diff --git a/runsc/boot/compat.go b/runsc/boot/compat.go index 572b5b472..37d0c31fd 100644 --- a/runsc/boot/compat.go +++ b/runsc/boot/compat.go @@ -26,6 +26,7 @@ import ( "gvisor.googlesource.com/gvisor/pkg/log" "gvisor.googlesource.com/gvisor/pkg/sentry/arch" rpb "gvisor.googlesource.com/gvisor/pkg/sentry/arch/registers_go_proto" + ucspb "gvisor.googlesource.com/gvisor/pkg/sentry/kernel/uncaught_signal_go_proto" "gvisor.googlesource.com/gvisor/pkg/sentry/strace" spb "gvisor.googlesource.com/gvisor/pkg/sentry/unimpl/unimplemented_syscall_go_proto" ) @@ -73,12 +74,18 @@ func newCompatEmitter(logFD int) (*compatEmitter, error) { } // Emit implements eventchannel.Emitter. -func (c *compatEmitter) Emit(msg proto.Message) (hangup bool, err error) { - // Only interested in UnimplementedSyscall, skip the rest. - us, ok := msg.(*spb.UnimplementedSyscall) - if !ok { - return false, nil +func (c *compatEmitter) Emit(msg proto.Message) (bool, error) { + switch m := msg.(type) { + case *spb.UnimplementedSyscall: + c.emitUnimplementedSyscall(m) + case *ucspb.UncaughtSignal: + c.emitUncaughtSignal(m) } + + return false, nil +} + +func (c *compatEmitter) emitUnimplementedSyscall(us *spb.UnimplementedSyscall) { regs := us.Registers.GetArch().(*rpb.Registers_Amd64).Amd64 c.mu.Lock() @@ -113,7 +120,13 @@ func (c *compatEmitter) Emit(msg proto.Message) (hangup bool, err error) { c.sink.Infof("Unsupported syscall: %s, regs: %+v", c.nameMap.Name(uintptr(sysnr)), regs) tr.onReported(regs) } - return false, nil +} + +func (c *compatEmitter) emitUncaughtSignal(msg *ucspb.UncaughtSignal) { + sig := syscall.Signal(msg.SignalNumber) + c.sink.Infof( + "Uncaught signal: %q (%d), PID: %d, TID: %d, fault addr: %#x", + sig, msg.SignalNumber, msg.Pid, msg.Tid, msg.FaultAddr) } // Close implements eventchannel.Emitter. |