|
@@ -13896,6 +13896,25 @@ static struct bpf_test tests[] = {
|
|
|
.prog_type = BPF_PROG_TYPE_SCHED_CLS,
|
|
|
.result = ACCEPT,
|
|
|
},
|
|
|
+ {
|
|
|
+ "calls: ctx read at start of subprog",
|
|
|
+ .insns = {
|
|
|
+ BPF_MOV64_REG(BPF_REG_6, BPF_REG_1),
|
|
|
+ BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 5),
|
|
|
+ BPF_JMP_REG(BPF_JSGT, BPF_REG_0, BPF_REG_0, 0),
|
|
|
+ BPF_MOV64_REG(BPF_REG_1, BPF_REG_6),
|
|
|
+ BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 2),
|
|
|
+ BPF_MOV64_REG(BPF_REG_1, BPF_REG_0),
|
|
|
+ BPF_EXIT_INSN(),
|
|
|
+ BPF_LDX_MEM(BPF_B, BPF_REG_9, BPF_REG_1, 0),
|
|
|
+ BPF_MOV64_IMM(BPF_REG_0, 0),
|
|
|
+ BPF_EXIT_INSN(),
|
|
|
+ },
|
|
|
+ .prog_type = BPF_PROG_TYPE_SOCKET_FILTER,
|
|
|
+ .errstr_unpriv = "function calls to other bpf functions are allowed for root only",
|
|
|
+ .result_unpriv = REJECT,
|
|
|
+ .result = ACCEPT,
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
static int probe_filter_length(const struct bpf_insn *fp)
|