Adapt errstr of existing tests to make them pass, and add a new case to test backward jump to reserved code. Signed-off-by: Hao Sun <sunhao.th@xxxxxxxxx> --- tools/testing/selftests/bpf/verifier/ld_imm64.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/bpf/verifier/ld_imm64.c b/tools/testing/selftests/bpf/verifier/ld_imm64.c index f9297900cea6..aa3ada0062d9 100644 --- a/tools/testing/selftests/bpf/verifier/ld_imm64.c +++ b/tools/testing/selftests/bpf/verifier/ld_imm64.c @@ -9,8 +9,7 @@ BPF_MOV64_IMM(BPF_REG_0, 2), BPF_EXIT_INSN(), }, - .errstr = "invalid BPF_LD_IMM insn", - .errstr_unpriv = "R1 pointer comparison", + .errstr = "jump to reserved code", .result = REJECT, }, { @@ -23,8 +22,7 @@ BPF_LD_IMM64(BPF_REG_0, 1), BPF_EXIT_INSN(), }, - .errstr = "invalid BPF_LD_IMM insn", - .errstr_unpriv = "R1 pointer comparison", + .errstr = "jump to reserved code", .result = REJECT, }, { @@ -144,3 +142,13 @@ .errstr = "unrecognized bpf_ld_imm64 insn", .result = REJECT, }, +{ + "test15 ld_imm64", + .insns = { + BPF_LD_IMM64(BPF_REG_0, 0), + BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, -2), + BPF_EXIT_INSN(), + }, + .errstr = "jump to reserved code", + .result = REJECT, +}, -- 2.34.1