Don't allow to umount the namespace root mount

Linux does the same thing.

Reported-by: syzbot+6c79385c930c929d1d9e@syzkaller.appspotmail.com
PiperOrigin-RevId: 356854562
This commit is contained in:
Andrei Vagin
2021-02-10 16:32:45 -08:00
committed by gVisor bot
parent 96d3b3188b
commit 97a36d1696
+5
View File
@@ -309,6 +309,11 @@ func (vfs *VirtualFilesystem) UmountAt(ctx context.Context, creds *auth.Credenti
vfs.mountMu.Unlock()
return syserror.EINVAL
}
if vd.mount == vd.mount.ns.root {
vfs.mountMu.Unlock()
return syserror.EINVAL
}
}
// TODO(gvisor.dev/issue/1035): Linux special-cases umount of the caller's