Mount namespace can be nil after task exits

Updates #1035

PiperOrigin-RevId: 404017795
This commit is contained in:
Fabricio Voznika
2021-10-18 11:46:35 -07:00
committed by gVisor bot
parent 4f6cda4d0e
commit eafa3f19e4
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -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 {
+1
View File
@@ -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"}