|
@@ -272,6 +272,46 @@ static struct bpf_test tests[] = {
|
|
|
.errstr = "invalid bpf_ld_imm64 insn",
|
|
|
.result = REJECT,
|
|
|
},
|
|
|
+ {
|
|
|
+ "arsh32 on imm",
|
|
|
+ .insns = {
|
|
|
+ BPF_MOV64_IMM(BPF_REG_0, 1),
|
|
|
+ BPF_ALU32_IMM(BPF_ARSH, BPF_REG_0, 5),
|
|
|
+ BPF_EXIT_INSN(),
|
|
|
+ },
|
|
|
+ .result = REJECT,
|
|
|
+ .errstr = "BPF_ARSH not supported for 32 bit ALU",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "arsh32 on reg",
|
|
|
+ .insns = {
|
|
|
+ BPF_MOV64_IMM(BPF_REG_0, 1),
|
|
|
+ BPF_MOV64_IMM(BPF_REG_1, 5),
|
|
|
+ BPF_ALU32_REG(BPF_ARSH, BPF_REG_0, BPF_REG_1),
|
|
|
+ BPF_EXIT_INSN(),
|
|
|
+ },
|
|
|
+ .result = REJECT,
|
|
|
+ .errstr = "BPF_ARSH not supported for 32 bit ALU",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "arsh64 on imm",
|
|
|
+ .insns = {
|
|
|
+ BPF_MOV64_IMM(BPF_REG_0, 1),
|
|
|
+ BPF_ALU64_IMM(BPF_ARSH, BPF_REG_0, 5),
|
|
|
+ BPF_EXIT_INSN(),
|
|
|
+ },
|
|
|
+ .result = ACCEPT,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "arsh64 on reg",
|
|
|
+ .insns = {
|
|
|
+ BPF_MOV64_IMM(BPF_REG_0, 1),
|
|
|
+ BPF_MOV64_IMM(BPF_REG_1, 5),
|
|
|
+ BPF_ALU64_REG(BPF_ARSH, BPF_REG_0, BPF_REG_1),
|
|
|
+ BPF_EXIT_INSN(),
|
|
|
+ },
|
|
|
+ .result = ACCEPT,
|
|
|
+ },
|
|
|
{
|
|
|
"no bpf_exit",
|
|
|
.insns = {
|