Skip to content

Commit

Permalink
ebpf: remove kernel test stubs
Browse files Browse the repository at this point in the history
Now that we have BPF_PROG_TYPE_SOCKET_FILTER up and running, we can
remove the test stubs which were added to get the verifier suite up.

We can just let the test cases probe under socket filter type instead.
In the fill/spill test case, we cannot (yet) access fields from the
context (skb), but we may adapt that test case in future.

Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: Alexei Starovoitov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
borkmann authored and davem330 committed Mar 1, 2015
1 parent b656cc6 commit f91fe17
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 83 deletions.
3 changes: 0 additions & 3 deletions kernel/bpf/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
obj-y := core.o
obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o hashtab.o arraymap.o helpers.o
ifdef CONFIG_TEST_BPF
obj-$(CONFIG_BPF_SYSCALL) += test_stub.o
endif
78 changes: 0 additions & 78 deletions kernel/bpf/test_stub.c

This file was deleted.

5 changes: 3 additions & 2 deletions samples/bpf/test_verifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ static struct bpf_test tests[] = {
BPF_LDX_MEM(BPF_DW, BPF_REG_2, BPF_REG_10, -8),

/* should be able to access R0 = *(R2 + 8) */
BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_2, 8),
/* BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_2, 8), */
BPF_MOV64_REG(BPF_REG_0, BPF_REG_2),
BPF_EXIT_INSN(),
},
.result = ACCEPT,
Expand Down Expand Up @@ -687,7 +688,7 @@ static int test(void)
}
printf("#%d %s ", i, tests[i].descr);

prog_fd = bpf_prog_load(BPF_PROG_TYPE_UNSPEC, prog,
prog_fd = bpf_prog_load(BPF_PROG_TYPE_SOCKET_FILTER, prog,
prog_len * sizeof(struct bpf_insn),
"GPL");

Expand Down

0 comments on commit f91fe17

Please sign in to comment.