selftests/bpf: Fix test_verifier after introducing resolve_pseudo_ldimm64
authorHao Luo <haoluo@google.com>
Wed, 7 Oct 2020 02:28:57 +0000 (19:28 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 7 Oct 2020 03:16:57 +0000 (20:16 -0700)
Commit 4976b718c355 ("bpf: Introduce pseudo_btf_id") switched
the order of check_subprogs() and resolve_pseudo_ldimm() in
the verifier. Now an empty prog expects to see the error "last
insn is not an the prog of a single invalid ldimm exit or jmp"
instead, because the check for subprogs comes first. It's now
pointless to validate that half of ldimm64 won't be the last
instruction.

Tested:
 # ./test_verifier
 Summary: 1129 PASSED, 537 SKIPPED, 0 FAILED
 and the full set of bpf selftests.

Fixes: 4976b718c355 ("bpf: Introduce pseudo_btf_id")
Signed-off-by: Hao Luo <haoluo@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201007022857.2791884-1-haoluo@google.com
tools/testing/selftests/bpf/verifier/basic.c
tools/testing/selftests/bpf/verifier/ld_imm64.c

index b8d1864..de84f0d 100644 (file)
@@ -2,7 +2,7 @@
        "empty prog",
        .insns = {
        },
-       .errstr = "unknown opcode 00",
+       .errstr = "last insn is not an exit or jmp",
        .result = REJECT,
 },
 {
index 3856dba..f929790 100644 (file)
        .result = REJECT,
 },
 {
-       "test5 ld_imm64",
-       .insns = {
-       BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, 0, 0, 0),
-       },
-       .errstr = "invalid bpf_ld_imm64 insn",
-       .result = REJECT,
-},
-{
        "test6 ld_imm64",
        .insns = {
        BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, 0, 0, 0),