!465 fix load bpf failed

From: @zh_xiaoyu 
Reviewed-by: @duguhaotian 
Signed-off-by: @duguhaotian
This commit is contained in:
openeuler-ci-bot 2023-05-22 01:51:25 +00:00 committed by Gitee
commit 9c29a1ce6c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,30 @@
From ea611fd8e2c04e65c9239a9236376b2686b16832 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Sat, 6 May 2023 17:25:41 +0800
Subject: [PATCH] fix load bpf failed
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
src/lxc/cgroups/cgroup2_devices.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/lxc/cgroups/cgroup2_devices.c b/src/lxc/cgroups/cgroup2_devices.c
index 04ba7b3..690e0b3 100644
--- a/src/lxc/cgroups/cgroup2_devices.c
+++ b/src/lxc/cgroups/cgroup2_devices.c
@@ -237,6 +237,12 @@ int bpf_program_append_device(struct bpf_program *prog, struct device_item *devi
if (device->minor != -1)
jump_nr++;
+#ifdef HAVE_ISULAD
+ // add a check, if no jump should do, just return.
+ if (jump_nr == 1)
+ return 0;
+#endif
+
if (device_type > 0) {
struct bpf_insn ins[] = {
BPF_JMP_IMM(BPF_JNE, BPF_REG_2, device_type, jump_nr--),
--
2.25.1

View File

@ -1,4 +1,4 @@
%global _release 2022102418
%global _release 2022102419
Name: lxc
Version: 4.0.3
@ -39,6 +39,7 @@ Patch0028: 0028-use-ocihooks-env-after-getenv.patch
Patch0029: 0029-fix-mixed-use-of-signed-and-unsigned-type.patch
Patch0030: 0030-remove-unused-meminfo-stats.patch
Patch0031: 0031-lxc-attach-Fix-lost-return-codes-of-spawned-processe.patch
Patch0032: 0032-fix-load-bpf-failed.patch
BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath
BuildRequires: pkgconfig(libseccomp)
@ -225,6 +226,12 @@ rm -rf %{buildroot}%{_sysconfdir}/default/%{name}
%endif
%changelog
* Sat May 06 2023 zhangxiaoyu<zhangxiaoyu58@huawei.com> - 4.0.3-2022102419
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: fix load bpf failed
* Thu May 04 2023 Jian Zhang<zhang_jian7@hoperun.com> - 4.0.3-2022102418
- Type:bugfix
- ID:NA