mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Lock around accessing the mount namespace in pivot_root.
Reported-by: syzbot+14315403420bef186ad8@syzkaller.appspotmail.com PiperOrigin-RevId: 513401809
This commit is contained in:
committed by
gVisor bot
parent
a625ba1d0a
commit
807fd0fd27
@@ -954,11 +954,12 @@ retry:
|
||||
// The current root and the new root must be in the context's mount namespace.
|
||||
ns := MountNamespaceFromContext(ctx)
|
||||
defer ns.DecRef(ctx)
|
||||
vfs.mountMu.Lock()
|
||||
if rootVd.mount.ns != ns || newRootVd.mount.ns != ns {
|
||||
vfs.mountMu.Unlock()
|
||||
return linuxerr.EINVAL
|
||||
}
|
||||
|
||||
vfs.mountMu.Lock()
|
||||
// Either the mount point at new_root, or the parent mount of that mount
|
||||
// point, has propagation type MS_SHARED.
|
||||
if newRootParent := newRootVd.mount.parent(); newRootVd.mount.propType == Shared || newRootParent.propType == Shared {
|
||||
|
||||
Reference in New Issue
Block a user