summaryrefslogtreecommitdiffhomepage
path: root/runsc
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2021-10-18 11:44:11 -0700
committergVisor bot <gvisor-bot@google.com>2021-10-18 11:46:35 -0700
commiteafa3f19e4d2c0a490af78dbe77289c7b5edbb76 (patch)
tree985fdf5d30ba001d5454c6409a87bbd60b2fe01a /runsc
parent4f6cda4d0ed8694a1b09d27a039eb4e57432bc75 (diff)
Mount namespace can be nil after task exits
Updates #1035 PiperOrigin-RevId: 404017795
Diffstat (limited to 'runsc')
-rw-r--r--runsc/boot/loader.go2
-rw-r--r--runsc/container/multi_container_test.go1
2 files changed, 2 insertions, 1 deletions
diff --git a/runsc/boot/loader.go b/runsc/boot/loader.go
index 28dbbcf1f..dbb02fdf4 100644
--- a/runsc/boot/loader.go
+++ b/runsc/boot/loader.go
@@ -950,7 +950,7 @@ func (l *Loader) executeAsync(args *control.ExecArgs) (kernel.ThreadID, error) {
if kernel.VFS2Enabled {
// task.MountNamespaceVFS2() does not take a ref, so we must do so ourselves.
args.MountNamespaceVFS2 = tg.Leader().MountNamespaceVFS2()
- if !args.MountNamespaceVFS2.TryIncRef() {
+ if args.MountNamespaceVFS2 == nil || !args.MountNamespaceVFS2.TryIncRef() {
return 0, fmt.Errorf("container %q has stopped", args.ContainerID)
}
} else {
diff --git a/runsc/container/multi_container_test.go b/runsc/container/multi_container_test.go
index 9d8022e50..a620944a3 100644
--- a/runsc/container/multi_container_test.go
+++ b/runsc/container/multi_container_test.go
@@ -1624,6 +1624,7 @@ func TestMultiContainerGoferKilled(t *testing.T) {
defer cleanup()
conf := testutil.TestConfig(t)
+ conf.VFS2 = true
conf.RootDir = rootDir
sleep := []string{"sleep", "100"}