Loading libprocessgroup/setup/cgroup_map_write.cpp +12 −2 Original line number Diff line number Diff line Loading @@ -263,8 +263,18 @@ static bool SetupCgroup(const CgroupDescriptor& descriptor) { return false; } result = mount("none", controller->path(), "cgroup2", MS_NODEV | MS_NOEXEC | MS_NOSUID, nullptr); // The memory_recursiveprot mount option has been introduced by kernel commit // 8a931f801340 ("mm: memcontrol: recursive memory.low protection"; v5.7). Try first to // mount with that option enabled. If mounting fails because the kernel is too old, // retry without that mount option. if (mount("none", controller->path(), "cgroup2", MS_NODEV | MS_NOEXEC | MS_NOSUID, "memory_recursiveprot") < 0) { LOG(INFO) << "Mounting memcg with memory_recursiveprot failed. Retrying without."; if (mount("none", controller->path(), "cgroup2", MS_NODEV | MS_NOEXEC | MS_NOSUID, nullptr) < 0) { PLOG(ERROR) << "Failed to mount cgroup v2"; } } // selinux permissions change after mounting, so it's ok to change mode and owner now if (!ChangeDirModeAndOwner(controller->path(), descriptor.mode(), descriptor.uid(), Loading Loading
libprocessgroup/setup/cgroup_map_write.cpp +12 −2 Original line number Diff line number Diff line Loading @@ -263,8 +263,18 @@ static bool SetupCgroup(const CgroupDescriptor& descriptor) { return false; } result = mount("none", controller->path(), "cgroup2", MS_NODEV | MS_NOEXEC | MS_NOSUID, nullptr); // The memory_recursiveprot mount option has been introduced by kernel commit // 8a931f801340 ("mm: memcontrol: recursive memory.low protection"; v5.7). Try first to // mount with that option enabled. If mounting fails because the kernel is too old, // retry without that mount option. if (mount("none", controller->path(), "cgroup2", MS_NODEV | MS_NOEXEC | MS_NOSUID, "memory_recursiveprot") < 0) { LOG(INFO) << "Mounting memcg with memory_recursiveprot failed. Retrying without."; if (mount("none", controller->path(), "cgroup2", MS_NODEV | MS_NOEXEC | MS_NOSUID, nullptr) < 0) { PLOG(ERROR) << "Failed to mount cgroup v2"; } } // selinux permissions change after mounting, so it's ok to change mode and owner now if (!ChangeDirModeAndOwner(controller->path(), descriptor.mode(), descriptor.uid(), Loading