summaryrefslogtreecommitdiffhomepage
path: root/runsc/sandbox/sandbox.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-06-18 22:44:13 +0000
committergVisor bot <gvisor-bot@google.com>2019-06-18 22:44:13 +0000
commit32848221a9de1a6fd7fcc4ef4fb881cf8fe2489c (patch)
tree068b3a1c94715832ce3a97a575292051e2948916 /runsc/sandbox/sandbox.go
parentdfbde70e972d909e0c10d4b85841b908325095be (diff)
parent0e07c94d545aa971bb2a05b738f856181a3ff463 (diff)
Merge 0e07c94d (automated)
Diffstat (limited to 'runsc/sandbox/sandbox.go')
-rw-r--r--runsc/sandbox/sandbox.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/runsc/sandbox/sandbox.go b/runsc/sandbox/sandbox.go
index bf17f62d9..00b0bf659 100644
--- a/runsc/sandbox/sandbox.go
+++ b/runsc/sandbox/sandbox.go
@@ -103,6 +103,10 @@ type Args struct {
// Gcgroup is the cgroup that the sandbox is part of.
Cgroup *cgroup.Cgroup
+
+ // Attached indicates that the sandbox lifecycle is attached with the caller.
+ // If the caller exits, the sandbox should exit too.
+ Attached bool
}
// New creates the sandbox process. The caller must call Destroy() on the
@@ -650,6 +654,11 @@ func (s *Sandbox) createSandboxProcess(conf *boot.Config, args *Args, startSyncF
log.Debugf("Donating FD %d: %q", i+3, f.Name())
}
+ if args.Attached {
+ // Kill sandbox if parent process exits in attached mode.
+ cmd.SysProcAttr.Pdeathsig = syscall.SIGKILL
+ }
+
log.Debugf("Starting sandbox: %s %v", binPath, cmd.Args)
log.Debugf("SysProcAttr: %+v", cmd.SysProcAttr)
if err := specutils.StartInNS(cmd, nss); err != nil {