Skip to content

Commit

Permalink
Merge branch 'bpf-subreg-tests'
Browse files Browse the repository at this point in the history
Jiong Wang says:

====================
JIT back-ends need to guarantee high 32-bit cleared whenever one eBPF insn
write low 32-bit sub-register only. It is possible that some JIT back-ends
have failed doing this and are silently generating wrong image.

This set completes the unit tests, so bug on this could be exposed in JITs.
====================

Signed-off-by: Daniel Borkmann <[email protected]>
  • Loading branch information
borkmann committed May 29, 2019
2 parents bd95e67 + c25d60c commit 10b3c44
Show file tree
Hide file tree
Showing 2 changed files with 533 additions and 39 deletions.
39 changes: 0 additions & 39 deletions tools/testing/selftests/bpf/verifier/basic_instr.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,42 +132,3 @@
.prog_type = BPF_PROG_TYPE_SCHED_CLS,
.result = ACCEPT,
},
{
"and32 reg zero extend check",
.insns = {
BPF_MOV64_IMM(BPF_REG_0, -1),
BPF_MOV64_IMM(BPF_REG_2, -2),
BPF_ALU32_REG(BPF_AND, BPF_REG_0, BPF_REG_2),
BPF_ALU64_IMM(BPF_RSH, BPF_REG_0, 32),
BPF_EXIT_INSN(),
},
.prog_type = BPF_PROG_TYPE_SCHED_CLS,
.result = ACCEPT,
.retval = 0,
},
{
"or32 reg zero extend check",
.insns = {
BPF_MOV64_IMM(BPF_REG_0, -1),
BPF_MOV64_IMM(BPF_REG_2, -2),
BPF_ALU32_REG(BPF_OR, BPF_REG_0, BPF_REG_2),
BPF_ALU64_IMM(BPF_RSH, BPF_REG_0, 32),
BPF_EXIT_INSN(),
},
.prog_type = BPF_PROG_TYPE_SCHED_CLS,
.result = ACCEPT,
.retval = 0,
},
{
"xor32 reg zero extend check",
.insns = {
BPF_MOV64_IMM(BPF_REG_0, -1),
BPF_MOV64_IMM(BPF_REG_2, 0),
BPF_ALU32_REG(BPF_XOR, BPF_REG_0, BPF_REG_2),
BPF_ALU64_IMM(BPF_RSH, BPF_REG_0, 32),
BPF_EXIT_INSN(),
},
.prog_type = BPF_PROG_TYPE_SCHED_CLS,
.result = ACCEPT,
.retval = 0,
},
Loading

0 comments on commit 10b3c44

Please sign in to comment.