diff options
author | Michael Pratt <mpratt@google.com> | 2018-12-11 16:11:53 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-12-11 16:12:41 -0800 |
commit | 24c1158b9c21f7f8b7126e810d623a518422052e (patch) | |
tree | 960457b3b0476b1b9c61710f9526db953ba80f17 /runsc/boot/loader.go | |
parent | 2b6df6a2049e839e39717f90c1760f3d410c98f1 (diff) |
Add "trace signal" option
This option is effectively equivalent to -panic-signal, except that the
sandbox does not die after logging the traceback.
PiperOrigin-RevId: 225089593
Change-Id: Ifb1c411210110b6104613f404334bd02175e484e
Diffstat (limited to 'runsc/boot/loader.go')
-rw-r--r-- | runsc/boot/loader.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/runsc/boot/loader.go b/runsc/boot/loader.go index 7cac346c9..a9c549790 100644 --- a/runsc/boot/loader.go +++ b/runsc/boot/loader.go @@ -324,10 +324,14 @@ func New(args Args) (*Loader, error) { // Handle signals by forwarding them to the root container process // (except for panic signal, which should cause a panic). l.startSignalForwarding = sighandling.PrepareHandler(func(sig linux.Signal) { - // Panic signal should cause a panic. + // Tracing signals should cause their respective actions. if args.Conf.PanicSignal != -1 && sig == linux.Signal(args.Conf.PanicSignal) { panic("Signal-induced panic") } + if args.Conf.TraceSignal != -1 && sig == linux.Signal(args.Conf.TraceSignal) { + log.TracebackAll("Signal-induced traceback") + return + } // Otherwise forward to root container. deliveryMode := DeliverToProcess |