ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] bpf_prog0[5-7]: Run with kernel.unprivileged_bpf_disabled = 0
@ 2022-08-18 17:17 Petr Vorel
  2022-08-18 17:50 ` Petr Vorel
  2022-08-19  8:27 ` Cyril Hrubis
  0 siblings, 2 replies; 9+ messages in thread
From: Petr Vorel @ 2022-08-18 17:17 UTC (permalink / raw)
  To: ltp; +Cc: Richard Palethorpe

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


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-08-25 14:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-18 17:17 [LTP] [PATCH 1/1] bpf_prog0[5-7]: Run with kernel.unprivileged_bpf_disabled = 0 Petr Vorel
2022-08-18 17:50 ` Petr Vorel
2022-08-19  8:27 ` Cyril Hrubis
2022-08-19 10:28   ` Petr Vorel
2022-08-19 10:31     ` Petr Vorel
2022-08-19 10:43     ` Cyril Hrubis
2022-08-19 11:00     ` Cyril Hrubis
2022-08-19 12:08       ` Petr Vorel
2022-08-25 14:22         ` Richard Palethorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).