oci: fix segfault when cgroup cannot be configured
avoid a segfault if the cgroup hierarchy could not be configured.
It happens every time with rootless mode as we cannot configure
cgroups, but it is not restricted to rootless.
Closes:
@@ -36,6 +36,7 @@ func (r *runtimeOCI) createContainerPlatform(c *Container, cgroupParent string,
logrus.Warnf("Failed to add conmon to cgroupfs sandbox cgroup: %v", err)
}
+ if control != nil {
// Here we should defer a crio-connmon- cgroup hierarchy deletion, but it will
// always fail as conmon's pid is still there.
// Fortunately, kubelet takes care of deleting this for us, so the leak will
@@ -46,6 +47,7 @@ func (r *runtimeOCI) createContainerPlatform(c *Container, cgroupParent string,
logrus.Warnf("Failed to add conmon to cgroupfs sandbox cgroup: %v", err)
}
}
+}
func sysProcAttrPlatform() *syscall.SysProcAttr {
return &syscall.SysProcAttr{
