diff options
Diffstat (limited to 'samples/bpf/test_verifier.c')
-rw-r--r-- | samples/bpf/test_verifier.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/samples/bpf/test_verifier.c b/samples/bpf/test_verifier.c index 9ab645698ffb..12f3780af73f 100644 --- a/samples/bpf/test_verifier.c +++ b/samples/bpf/test_verifier.c | |||
@@ -721,6 +721,28 @@ static struct bpf_test tests[] = { | |||
721 | .errstr = "different pointers", | 721 | .errstr = "different pointers", |
722 | .result = REJECT, | 722 | .result = REJECT, |
723 | }, | 723 | }, |
724 | { | ||
725 | "access skb fields bad4", | ||
726 | .insns = { | ||
727 | BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 3), | ||
728 | BPF_LDX_MEM(BPF_W, BPF_REG_1, BPF_REG_1, | ||
729 | offsetof(struct __sk_buff, len)), | ||
730 | BPF_MOV64_IMM(BPF_REG_0, 0), | ||
731 | BPF_EXIT_INSN(), | ||
732 | BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0), | ||
733 | BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), | ||
734 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), | ||
735 | BPF_LD_MAP_FD(BPF_REG_1, 0), | ||
736 | BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem), | ||
737 | BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 1), | ||
738 | BPF_EXIT_INSN(), | ||
739 | BPF_MOV64_REG(BPF_REG_1, BPF_REG_0), | ||
740 | BPF_JMP_IMM(BPF_JA, 0, 0, -13), | ||
741 | }, | ||
742 | .fixup = {7}, | ||
743 | .errstr = "different pointers", | ||
744 | .result = REJECT, | ||
745 | }, | ||
724 | }; | 746 | }; |
725 | 747 | ||
726 | static int probe_filter_length(struct bpf_insn *fp) | 748 | static int probe_filter_length(struct bpf_insn *fp) |