diff --git a/0008-fix-the-issue-of-CPU-file-being-overwritten.patch b/0008-fix-the-issue-of-CPU-file-being-overwritten.patch new file mode 100644 index 0000000000000000000000000000000000000000..d54edf529620f4f3109b54a120fdc8e617134ba9 --- /dev/null +++ b/0008-fix-the-issue-of-CPU-file-being-overwritten.patch @@ -0,0 +1,57 @@ +From 967be2c8e91a51c85035742b458e5ff7c7560d88 Mon Sep 17 00:00:00 2001 +From: wujichao +Date: Mon, 9 Jun 2025 20:50:07 +0800 +Subject: [PATCH] bugfix: Information in cpu directory is overwritten after lxcfs restart + +Signed-off-by: wujichao + +--- + remountcmd.go | 4 ++-- + tests/src/test_docker_lxcfs.sh | 2 +- + umountcmd.go | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/remountcmd.go b/remountcmd.go +index 8259cf5..e2577ce 100644 +--- a/remountcmd.go ++++ b/remountcmd.go +@@ -294,8 +294,8 @@ func remountToContainer(initMountns, initUserns, containerid string, pid string, + valueMountPaths = append(valueMountPaths, fmt.Sprintf("/var/lib/lxc/lxcfs/proc/%s", value.Name())) + } + +- valuePaths = append(valuePaths, "/sys/devices/system/cpu") +- valueMountPaths = append(valueMountPaths, "/var/lib/lxc/lxcfs/sys/devices/system/cpu") ++ valuePaths = append(valuePaths, "/sys/devices/system/cpu/online") ++ valueMountPaths = append(valueMountPaths, "/var/lib/lxc/lxcfs/sys/devices/system/cpu/online") + + if err := libmount.NsExecUmount(pid, valuePaths); err != nil { + lxcfs_log.Errorf("unmount %v for container error: %v", valuePaths, err) +diff --git a/tests/src/test_docker_lxcfs.sh b/tests/src/test_docker_lxcfs.sh +index bf260d8..265cf3a 100755 +--- a/tests/src/test_docker_lxcfs.sh ++++ b/tests/src/test_docker_lxcfs.sh +@@ -33,7 +33,7 @@ function test_fun() { + -v /var/lib/lxc/lxcfs/proc/cpuinfo:/proc/cpuinfo:rw \ + -v /var/lib/lxc/lxcfs/proc/meminfo:/proc/meminfo:rw \ + -v /var/lib/lxc/lxcfs/proc/stat:/proc/stat:rw \ +- -v /var/lib/lxc/lxcfs/sys/devices/system/cpu:/sys/devices/system/cpu:rw \ ++ -v /var/lib/lxc/lxcfs/sys/devices/system/cpu/online:/sys/devices/system/cpu/online:rw \ + --name ${con_name} ${image_name} /bin/bash` + + WaitInspect $cid running +diff --git a/umountcmd.go b/umountcmd.go +index ff2a349..590935c 100644 +--- a/umountcmd.go ++++ b/umountcmd.go +@@ -148,7 +148,7 @@ func umountForContainer(initMountns, initUserns, containerid string, pid string, + valuePaths = append(valuePaths, fmt.Sprintf("/proc/%s", value.Name())) + } + +- valuePaths = append(valuePaths, "/sys/devices/system/cpu") ++ valuePaths = append(valuePaths, "/sys/devices/system/cpu/online") + + if err := libmount.NsExecUmount(pid, valuePaths); err != nil { + lxcfs_log.Errorf("unmount %v for container %s error: %v", valuePaths, containerid, err) +-- +2.33.0 + diff --git a/lxcfs-tools.spec b/lxcfs-tools.spec index 938e4b62fddecf12f4fe02e4f6854e9bf56c47d3..9e1c88709a41def912e3d2a3b465a0d0b0a94a2a 100644 --- a/lxcfs-tools.spec +++ b/lxcfs-tools.spec @@ -1,7 +1,7 @@ #Basic Information Name: lxcfs-tools Version: 0.3 -Release: 35 +Release: 36 Summary: toolkit for lxcfs to remount a running isulad License: Mulan PSL v2 URL: https://gitee.com/openeuler/lxcfs-tools @@ -15,6 +15,7 @@ Patch4: 0004-add-dt-test.patch Patch5: 0005-add-riscv64-to-syscall-build.patch Patch6: 0006-lxcfs-tools-support-lxcfs-reliability-for-doc.patch Patch7: 0007-test-add-tests-for-docker-and-lxcfs.patch +Patch8: 0008-fix-the-issue-of-CPU-file-being-overwritten.patch %ifarch sw_64 Patch1000: lxcfs-tools-sw.patch @@ -114,6 +115,12 @@ rm -rfv %{buildroot} %changelog +* Thu Jun 26 2025 wujichao - 0.3-36 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:bugfix: Information in cpu directory is overwritten after lxcfs restart + * Tue Apr 16 2024 Pengda Dou - 0.3-35 - add support for loongarch64