Commit 21ccaf21 authored by Daniel Borkmann's avatar Daniel Borkmann Committed by Alexei Starovoitov

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: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 73ae3c04
...@@ -2003,10 +2003,14 @@ static struct bpf_test tests[] = { ...@@ -2003,10 +2003,14 @@ static struct bpf_test tests[] = {
{ { 4, 0 }, { 5, 10 } } { { 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 = { .u.insns_int = {
BPF_ALU64_REG(BPF_MOV, R6, R1), 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_LD_ABS(BPF_B, 3),
BPF_ALU32_REG(BPF_DIV, R0, R7), BPF_ALU32_REG(BPF_DIV, R0, R7),
BPF_EXIT_INSN(), BPF_EXIT_INSN(),
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment