mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Initialize MountNamespace before calling methods that depend on it.
PiperOrigin-RevId: 477281632
This commit is contained in:
committed by
gVisor bot
parent
f18c6daa56
commit
6f20a7c12c
@@ -249,6 +249,17 @@ func (l *Lifecycle) StartContainer(args *StartContainerArgs, _ *uint32) error {
|
||||
}
|
||||
initArgs.FDTable = fdTable
|
||||
|
||||
// VFS2 is supported in multi-container mode by default.
|
||||
l.mu.RLock()
|
||||
mntns, ok := l.MountNamespacesMap[initArgs.ContainerID]
|
||||
if !ok {
|
||||
l.mu.RUnlock()
|
||||
return fmt.Errorf("mount namespace is nil for %s", initArgs.ContainerID)
|
||||
}
|
||||
initArgs.MountNamespaceVFS2 = mntns
|
||||
l.mu.RUnlock()
|
||||
initArgs.MountNamespaceVFS2.IncRef()
|
||||
|
||||
if args.ResolveBinaryPath {
|
||||
resolved, err := user.ResolveExecutablePath(ctx, &initArgs)
|
||||
if err != nil {
|
||||
@@ -265,17 +276,6 @@ func (l *Lifecycle) StartContainer(args *StartContainerArgs, _ *uint32) error {
|
||||
initArgs.Envv = envVars
|
||||
}
|
||||
|
||||
// VFS2 is supported in multi-container mode by default.
|
||||
l.mu.RLock()
|
||||
mntns, ok := l.MountNamespacesMap[initArgs.ContainerID]
|
||||
if !ok {
|
||||
l.mu.RUnlock()
|
||||
return fmt.Errorf("mount namespace is nil for %s", initArgs.ContainerID)
|
||||
}
|
||||
initArgs.MountNamespaceVFS2 = mntns
|
||||
l.mu.RUnlock()
|
||||
initArgs.MountNamespaceVFS2.IncRef()
|
||||
|
||||
fds, err := fd.NewFromFiles(args.Files)
|
||||
if err != nil {
|
||||
return fmt.Errorf("duplicating payload files: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user