runc:fix can't set cpuset-cpus and cpuset-mems at the same time

(cherry picked from commit 970358fda95448452400a3c1f6da54250db5ee61)
This commit is contained in:
zhongjiawei 2024-09-29 15:09:07 +08:00 committed by openeuler-sync-bot
parent 7a77b49682
commit 9a49713a9c
4 changed files with 51 additions and 2 deletions

View File

@ -1 +1 @@
1251c89d252bb9f8136d47c5892497829e78683f
1b7091b305556e0de2c50f193cd7bf50af035c01

View File

@ -0,0 +1,42 @@
From 316c33ea56636e2e19be332362973b7def6d1a2a Mon Sep 17 00:00:00 2001
From: zhongjiawei <zhongjiawei1@huawei.com>
Date: Fri, 27 Sep 2024 14:11:49 +0800
Subject: [PATCH] runc:fix can't set cpuset-cpus and cpuset-mems at the same
time
---
libcontainer/cgroups/fs/cpuset.go | 4 +++-
libcontainer/cgroups/fs/cpuset_test.go | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libcontainer/cgroups/fs/cpuset.go b/libcontainer/cgroups/fs/cpuset.go
index 32719600..d33e9f91 100644
--- a/libcontainer/cgroups/fs/cpuset.go
+++ b/libcontainer/cgroups/fs/cpuset.go
@@ -146,7 +146,9 @@ func (s *CpusetGroup) setCpuset(path, cpuset string) error {
func (s *CpusetGroup) Set(path string, r *configs.Resources) error {
var ret error
if r.CpusetCpus != "" {
- return s.setCpuset(path, r.CpusetCpus)
+ if err := s.setCpuset(path, r.CpusetCpus); err != nil {
+ return err
+ }
}
if r.CpusetMems != "" {
if err := cgroups.WriteFile(path, "cpuset.mems", r.CpusetMems); err != nil {
diff --git a/libcontainer/cgroups/fs/cpuset_test.go b/libcontainer/cgroups/fs/cpuset_test.go
index 0c72c7db..a8a6caae 100644
--- a/libcontainer/cgroups/fs/cpuset_test.go
+++ b/libcontainer/cgroups/fs/cpuset_test.go
@@ -81,7 +81,7 @@ type cpusetTestCase struct {
func getCpusetTestcaes() []cpusetTestCase {
testDir := "/sys/fs/cgroup/cpuset/runc-test"
- errStr1 := "failed to set"
+ errStr1 := "failed to stat"
errStr2 := "invalid cpuset format"
errStr3 := "invalid preferred_cpus"
return []cpusetTestCase{
--
2.33.0

View File

@ -3,7 +3,7 @@
Name: runc
Version: 1.1.8
Release: 21
Release: 24
Summary: runc is a CLI tool for spawning and running containers according to the OCI specification.
License: ASL 2.0
@ -57,6 +57,12 @@ install -p -m 755 runc $RPM_BUILD_ROOT/%{_bindir}/runc
%{_bindir}/runc
%changelog
* Sun Sep 29 2024 zhongjiawei<zhongjiawei1@huawei.com> - 1.1.8-24
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix can't set cpuset-cpus and cpuset-mems at the same time
* Tue Sep 10 2024 Song Zhang<zhangsong34@huawei.com> - 1.1.8-21
- Type:CVE
- CVE:CVE-2024-45310

View File

@ -43,3 +43,4 @@ patch/0043-runc-do-not-support-set-umask-through-native.umask.patch
patch/0044-runc-format-log-instead-panic-when-procError-missing.patch
patch/0045-rootfs-consolidate-mountpoint-creation-logic.patch
patch/0046-rootfs-try-to-scope-MkdirAll-to-stay-inside-the-root.patch
patch/0047-runc-fix-can-t-set-cpuset-cpus-and-cpuset-mems-at-th.patch