31 lines
913 B
Diff
31 lines
913 B
Diff
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
|
|
|