[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <80ef5e2e-c2d9-45b7-9a48-f8c1a4767eae@gmail.com>
Date: Wed, 21 May 2025 12:13:42 -0700
From: Eduard Zingerman <eddyz87@...il.com>
To: Puranjay Mohan <puranjay@...nel.org>, Alexei Starovoitov
<ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
John Fastabend <john.fastabend@...il.com>,
Andrii Nakryiko <andrii@...nel.org>, Martin KaFai Lau
<martin.lau@...ux.dev>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>, Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH bpf] bpf: verifier: support BPF_LOAD_ACQ in
insn_def_regno()
On 2025-05-21 11:39, Puranjay Mohan wrote:
[...]
> @@ -3643,6 +3643,9 @@ static bool is_reg64(struct bpf_verifier_env *env, struct bpf_insn *insn,
> /* Return the regno defined by the insn, or -1. */
> static int insn_def_regno(const struct bpf_insn *insn)
> {
> + if (is_atomic_load_insn(insn))
> + return insn->dst_reg;
> +
> switch (BPF_CLASS(insn->code)) {
> case BPF_JMP:
> case BPF_JMP32:
I'm confused, is_atomic_load_insn() is defined as:
return BPF_CLASS(insn->code) == BPF_STX &&
BPF_MODE(insn->code) == BPF_ATOMIC &&
insn->imm == BPF_LOAD_ACQ;
And insn_def_regno() has the following case:
case BPF_STX:
if (BPF_MODE(insn->code) == BPF_ATOMIC ||
BPF_MODE(insn->code) == BPF_PROBE_ATOMIC) {
if (insn->imm == BPF_CMPXCHG)
return BPF_REG_0;
else if (insn->imm == BPF_LOAD_ACQ)
return insn->dst_reg;
else if (insn->imm & BPF_FETCH)
return insn->src_reg;
}
return -1;
Why is it not triggering?
Also, can this be tested with a BPF_F_TEST_RND_HI32 flag?
E.g. see verifier_scalar_ids.c:linked_regs_and_subreg_def() test case.
Powered by blists - more mailing lists