!181 [sync] PR-180: runc:handle kmem.limit_in_bytes removal

From: @openeuler-sync-bot 
Reviewed-by: @duguhaotian 
Signed-off-by: @duguhaotian
This commit is contained in:
openeuler-ci-bot 2023-10-12 10:28:35 +00:00 committed by Gitee
commit 8fdc1ebc38
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 49 additions and 1 deletions

View File

@ -1 +1 @@
408f1a8482d8f9e4759d01b80ebd6d49b9c8b487 f00c21f87036fd8a6f453ae0ba294f2c7f70503e

View File

@ -0,0 +1,41 @@
From 23ec6c42c22a7bfd4494b15abc9c3303018dec85 Mon Sep 17 00:00:00 2001
From: Jordan Rife <jrife0@gmail.com>
Date: Sat, 16 Sep 2023 18:10:00 +0000
Subject: [PATCH] Handle kmem.limit_in_bytes removal
kmem.limit_in_bytes has been removed in upstream linux and this patch
is queued to be backported to linux 6.1 stable:
- https://lore.kernel.org/linux-mm/20230705134434.GA156754@cmpxchg.org/T/
- https://www.spinics.net/lists/stable-commits/msg316619.html
Without this change to libcontainerd, GetStats() will return an error
on the latest kernel(s). A downstream effect is that Kubernetes's
kubelet does not start up. This fix was tested by ensuring that it
unblocks kubelet startup when running on the latest kernel.
Signed-off-by: Jordan Rife <jrife0@gmail.com>
---
libcontainer/cgroups/fs/memory.go | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libcontainer/cgroups/fs/memory.go b/libcontainer/cgroups/fs/memory.go
index b7c75f94..a0e78074 100644
--- a/libcontainer/cgroups/fs/memory.go
+++ b/libcontainer/cgroups/fs/memory.go
@@ -234,6 +234,12 @@ func getMemoryData(path, name string) (cgroups.MemoryData, error) {
memoryData.Failcnt = value
value, err = fscommon.GetCgroupParamUint(path, limit)
if err != nil {
+ if name == "kmem" && os.IsNotExist(err) {
+ // Ignore ENOENT as kmem.limit_in_bytes has
+ // been removed in newer kernels.
+ return memoryData, nil
+ }
+
return cgroups.MemoryData{}, err
}
memoryData.Limit = value
--
2.33.0

View File

@ -54,6 +54,12 @@ install -p -m 755 runc $RPM_BUILD_ROOT/%{_bindir}/runc
%{_bindir}/runc %{_bindir}/runc
%changelog %changelog
* Thu Oct 12 2023 zhongjiawei<zhongjiawei1@huawei.com> - 1.1.3-17
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:handle kmem.limit_in_bytes removal
* Mon Sep 18 2023 zhongjiawei<zhongjiawei1@huawei.com> - 1.1.3-16 * Mon Sep 18 2023 zhongjiawei<zhongjiawei1@huawei.com> - 1.1.3-16
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA

View File

@ -39,3 +39,4 @@ patch/0038-runc-libct-fix-shared-pidns-detection.patch
patch/0039-runc-libct-fix-a-race-with-systemd-removal.patch patch/0039-runc-libct-fix-a-race-with-systemd-removal.patch
patch/0040-runc-run-refuse-a-non-empty-cgroup.patch patch/0040-runc-run-refuse-a-non-empty-cgroup.patch
patch/0041-runc-libct-init-unify-init-fix-its-error-logic.patch patch/0041-runc-libct-init-unify-init-fix-its-error-logic.patch
patch/0042-runc-Handle-kmem.limit_in_bytes-removal.patch