aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStanislav Fomichev2022-06-30 15:42:03 -0700
committerDaniel Borkmann2022-07-01 15:13:36 +0200
commitb0d93b44641a83c28014ca38001e85bf6dc8501e (patch)
treec4d56da08a2d901407bec4b756462e1d3519d528 /tools
parent7a255ae77216237a4ce83ddea595aa4e0a812f46 (diff)
selftests/bpf: Skip lsm_cgroup when we don't have trampolines
With arch_prepare_bpf_trampoline removed on x86: [...] #98/1 lsm_cgroup/functional:SKIP #98 lsm_cgroup:SKIP Summary: 1/0 PASSED, 1 SKIPPED, 0 FAILED Fixes: dca85aac8895 ("selftests/bpf: lsm_cgroup functional test") Signed-off-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Hao Luo <haoluo@google.com> Link: https://lore.kernel.org/bpf/20220630224203.512815-1-sdf@google.com
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/lsm_cgroup.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/lsm_cgroup.c b/tools/testing/selftests/bpf/prog_tests/lsm_cgroup.c
index d40810a742fa..c542d7e80a5b 100644
--- a/tools/testing/selftests/bpf/prog_tests/lsm_cgroup.c
+++ b/tools/testing/selftests/bpf/prog_tests/lsm_cgroup.c
@@ -9,6 +9,10 @@
#include "cgroup_helpers.h"
#include "network_helpers.h"
+#ifndef ENOTSUPP
+#define ENOTSUPP 524
+#endif
+
static struct btf *btf;
static __u32 query_prog_cnt(int cgroup_fd, const char *attach_func)
@@ -100,6 +104,10 @@ static void test_lsm_cgroup_functional(void)
ASSERT_EQ(query_prog_cnt(cgroup_fd, "bpf_lsm_sk_alloc_security"), 0, "prog count");
ASSERT_EQ(query_prog_cnt(cgroup_fd, NULL), 0, "total prog count");
err = bpf_prog_attach(alloc_prog_fd, cgroup_fd, BPF_LSM_CGROUP, 0);
+ if (err == -ENOTSUPP) {
+ test__skip();
+ goto close_cgroup;
+ }
if (!ASSERT_OK(err, "attach alloc_prog_fd"))
goto detach_cgroup;
ASSERT_EQ(query_prog_cnt(cgroup_fd, "bpf_lsm_sk_alloc_security"), 1, "prog count");