[LTP] [PATCH 1/1] bpf_prog0[5-7]: Run with kernel.unprivileged_bpf_disabled = 0
Petr Vorel
pvorel@suse.cz
Thu Aug 18 19:17:24 CEST 2022
To avoid forcing users to run this setup to avoid TCONF:
tst_capability.c:29: TINFO: Dropping CAP_BPF(39)
bpf_common.c:39: TCONF: Hint: check also /proc/sys/kernel/unprivileged_bpf_disabled
bpf_common.c:41: TCONF: bpf() requires CAP_SYS_ADMIN or CAP_BPF on this system: EPERM (1)
Unfortunately this requires running as root.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/kernel/syscalls/bpf/bpf_prog05.c | 5 +++++
testcases/kernel/syscalls/bpf/bpf_prog06.c | 5 +++++
testcases/kernel/syscalls/bpf/bpf_prog07.c | 5 +++++
3 files changed, 15 insertions(+)
diff --git a/testcases/kernel/syscalls/bpf/bpf_prog05.c b/testcases/kernel/syscalls/bpf/bpf_prog05.c
index 2be5a2cc9..8197467d9 100644
--- a/testcases/kernel/syscalls/bpf/bpf_prog05.c
+++ b/testcases/kernel/syscalls/bpf/bpf_prog05.c
@@ -209,6 +209,11 @@ static struct tst_test test = {
{&msg, .size = sizeof(MSG)},
{}
},
+ .needs_root = 1,
+ .save_restore = (const struct tst_path_val[]) {
+ {"?/proc/sys/kernel/unprivileged_bpf_disabled", "0"},
+ {}
+ },
.tags = (const struct tst_tag[]) {
{"linux-git", "f6b1b3bf0d5f"},
{"linux-git", "468f6eafa6c4"},
diff --git a/testcases/kernel/syscalls/bpf/bpf_prog06.c b/testcases/kernel/syscalls/bpf/bpf_prog06.c
index c38dd8239..6c4f96740 100644
--- a/testcases/kernel/syscalls/bpf/bpf_prog06.c
+++ b/testcases/kernel/syscalls/bpf/bpf_prog06.c
@@ -150,6 +150,11 @@ static struct tst_test test = {
{&msg, .size = sizeof(MSG)},
{}
},
+ .needs_root = 1,
+ .save_restore = (const struct tst_path_val[]) {
+ {"?/proc/sys/kernel/unprivileged_bpf_disabled", "0"},
+ {}
+ },
.tags = (const struct tst_tag[]) {
{"linux-git", "64620e0a1e71"},
{"CVE", "CVE-2021-4204"},
diff --git a/testcases/kernel/syscalls/bpf/bpf_prog07.c b/testcases/kernel/syscalls/bpf/bpf_prog07.c
index 50ff6eed0..ae389e6ce 100644
--- a/testcases/kernel/syscalls/bpf/bpf_prog07.c
+++ b/testcases/kernel/syscalls/bpf/bpf_prog07.c
@@ -158,6 +158,11 @@ static struct tst_test test = {
{&msg, .size = sizeof(MSG)},
{}
},
+ .needs_root = 1,
+ .save_restore = (const struct tst_path_val[]) {
+ {"?/proc/sys/kernel/unprivileged_bpf_disabled", "0"},
+ {}
+ },
.tags = (const struct tst_tag[]) {
{"linux-git", "64620e0a1e71"},
{"CVE", "CVE-2022-23222"},
--
2.37.1
More information about the ltp
mailing list