mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Check for nil task before attempting to return a mount namespace.
If we try to mount something with an empty set of tasks grabbing the mount namespace panics. PiperOrigin-RevId: 597045687
This commit is contained in:
committed by
gVisor bot
parent
88efa359d5
commit
3749bdab65
@@ -1631,13 +1631,13 @@ func (ctx *supervisorContext) Value(key any) any {
|
||||
// The supervisor context is global root.
|
||||
return auth.NewRootCredentials(ctx.Kernel.rootUserNamespace)
|
||||
case vfs.CtxRoot:
|
||||
if ctx.Kernel.globalInit == nil {
|
||||
if ctx.Kernel.globalInit == nil || ctx.Kernel.globalInit.Leader() == nil {
|
||||
return vfs.VirtualDentry{}
|
||||
}
|
||||
root := ctx.Kernel.GlobalInit().Leader().MountNamespace().Root(ctx)
|
||||
return root
|
||||
case vfs.CtxMountNamespace:
|
||||
if ctx.Kernel.globalInit == nil {
|
||||
if ctx.Kernel.globalInit == nil || ctx.Kernel.globalInit.Leader() == nil {
|
||||
return nil
|
||||
}
|
||||
mntns := ctx.Kernel.GlobalInit().Leader().MountNamespace()
|
||||
|
||||
Reference in New Issue
Block a user