more informative error message for user namespace exhaustion

PiperOrigin-RevId: 511815341
This commit is contained in:
Kevin Krakauer
2023-02-23 10:05:07 -08:00
committed by gVisor bot
parent 2f9fabe0ac
commit 6c236a236c
+5 -1
View File
@@ -198,7 +198,11 @@ func startInNS(cmd *exec.Cmd, nss []specs.LinuxNamespace) ([]func() error, error
deferFuncs = append(deferFuncs, restoreNS)
}
return deferFuncs, cmd.Start()
err := cmd.Start()
if err != nil && cmd.SysProcAttr.Cloneflags&unix.CLONE_NEWUSER != 0 {
err = fmt.Errorf("%v: check whether /proc/sys/user/max_user_namespaces is set too low (gvisor.dev/issue/5964)", err)
}
return deferFuncs, err
}
// SetUIDGIDMappings sets the given uid/gid mappings from the spec on the cmd.