Skip to content

Commit

Permalink
selftests/bpf: Fix a test_verifier failure
Browse files Browse the repository at this point in the history
The following test_verifier subtest failed due to
new encoding for BSWAP.

  $ ./test_verifier
  ...
  #99/u invalid 64-bit BPF_END FAIL
  Unexpected success to load!
  verification time 215 usec
  stack depth 0
  processed 3 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
  #99/p invalid 64-bit BPF_END FAIL
  Unexpected success to load!
  verification time 198 usec
  stack depth 0
  processed 3 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0

Tighten the test so it still reports a failure.

Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
  • Loading branch information
Yonghong Song authored and Kernel Patches Daemon committed Jul 28, 2023
1 parent c4ef55f commit 5cc19c2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/testing/selftests/bpf/verifier/basic_instr.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,19 @@
.retval = 1,
},
{
"invalid 64-bit BPF_END",
"invalid 64-bit BPF_END with BPF_TO_BE",
.insns = {
BPF_MOV32_IMM(BPF_REG_0, 0),
{
.code = BPF_ALU64 | BPF_END | BPF_TO_LE,
.code = BPF_ALU64 | BPF_END | BPF_TO_BE,
.dst_reg = BPF_REG_0,
.src_reg = 0,
.off = 0,
.imm = 32,
},
BPF_EXIT_INSN(),
},
.errstr = "unknown opcode d7",
.errstr = "unknown opcode df",
.result = REJECT,
},
{
Expand Down

0 comments on commit 5cc19c2

Please sign in to comment.