Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/bpf: Fix test_verifier after introducing resolve_pseudo_ldimm64

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

authored by

Hao Luo and committed by
Alexei Starovoitov
bf88a80a 67ed3755

+1 -9
+1 -1
tools/testing/selftests/bpf/verifier/basic.c
··· 2 2 "empty prog", 3 3 .insns = { 4 4 }, 5 - .errstr = "unknown opcode 00", 5 + .errstr = "last insn is not an exit or jmp", 6 6 .result = REJECT, 7 7 }, 8 8 {
-8
tools/testing/selftests/bpf/verifier/ld_imm64.c
··· 51 51 .result = REJECT, 52 52 }, 53 53 { 54 - "test5 ld_imm64", 55 - .insns = { 56 - BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, 0, 0, 0), 57 - }, 58 - .errstr = "invalid bpf_ld_imm64 insn", 59 - .result = REJECT, 60 - }, 61 - { 62 54 "test6 ld_imm64", 63 55 .insns = { 64 56 BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, 0, 0, 0),