Skip to content

Commit

Permalink
selftests/bpf: Skip lsm_cgroup when we don't have trampolines
Browse files Browse the repository at this point in the history
With arch_prepare_bpf_trampoline removed on x86:

  [...]
  torvalds#98/1    lsm_cgroup/functional:SKIP
  torvalds#98      lsm_cgroup:SKIP
  Summary: 1/0 PASSED, 1 SKIPPED, 0 FAILED

Fixes: dca85aa ("selftests/bpf: lsm_cgroup functional test")
Signed-off-by: Stanislav Fomichev <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: Hao Luo <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
fomichev authored and borkmann committed Jul 1, 2022
1 parent 7a255ae commit b0d93b4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tools/testing/selftests/bpf/prog_tests/lsm_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit b0d93b4

Please sign in to comment.