diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2018-01-26 23:33:48 +0100 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2018-01-26 16:42:07 -0800 |
commit | 21ccaf21497b72f42133182716a42dbf573d314b (patch) | |
tree | 7294f8492555ec8d65ee23534f38c62d0e6029d5 /lib | |
parent | 73ae3c0426f01295ef307caf9531c0453b8f2728 (diff) |
bpf: add further test cases around div/mod and others
Update selftests to relfect recent changes and add various new
test cases.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/test_bpf.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/test_bpf.c b/lib/test_bpf.c index e3938e395cba..4cd9ea9b3449 100644 --- a/lib/test_bpf.c +++ b/lib/test_bpf.c @@ -2003,10 +2003,14 @@ static struct bpf_test tests[] = { { { 4, 0 }, { 5, 10 } } }, { - "INT: DIV by zero", + /* This one doesn't go through verifier, but is just raw insn + * as opposed to cBPF tests from here. Thus div by 0 tests are + * done in test_verifier in BPF kselftests. + */ + "INT: DIV by -1", .u.insns_int = { BPF_ALU64_REG(BPF_MOV, R6, R1), - BPF_ALU64_IMM(BPF_MOV, R7, 0), + BPF_ALU64_IMM(BPF_MOV, R7, -1), BPF_LD_ABS(BPF_B, 3), BPF_ALU32_REG(BPF_DIV, R0, R7), BPF_EXIT_INSN(), |