|
@@ -1553,6 +1553,14 @@ static bool is_pkt_reg(struct bpf_verifier_env *env, int regno)
|
|
|
return type_is_pkt_pointer(reg->type);
|
|
|
}
|
|
|
|
|
|
+static bool is_flow_key_reg(struct bpf_verifier_env *env, int regno)
|
|
|
+{
|
|
|
+ const struct bpf_reg_state *reg = reg_state(env, regno);
|
|
|
+
|
|
|
+ /* Separate to is_ctx_reg() since we still want to allow BPF_ST here. */
|
|
|
+ return reg->type == PTR_TO_FLOW_KEYS;
|
|
|
+}
|
|
|
+
|
|
|
static int check_pkt_ptr_alignment(struct bpf_verifier_env *env,
|
|
|
const struct bpf_reg_state *reg,
|
|
|
int off, int size, bool strict)
|
|
@@ -1961,7 +1969,8 @@ static int check_xadd(struct bpf_verifier_env *env, int insn_idx, struct bpf_ins
|
|
|
}
|
|
|
|
|
|
if (is_ctx_reg(env, insn->dst_reg) ||
|
|
|
- is_pkt_reg(env, insn->dst_reg)) {
|
|
|
+ is_pkt_reg(env, insn->dst_reg) ||
|
|
|
+ is_flow_key_reg(env, insn->dst_reg)) {
|
|
|
verbose(env, "BPF_XADD stores into R%d %s is not allowed\n",
|
|
|
insn->dst_reg,
|
|
|
reg_type_str[reg_state(env, insn->dst_reg)->type]);
|