From: Eduard Zingerman <eddyz87@gmail.com>
To: Puranjay Mohan <puranjay@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
John Fastabend <john.fastabend@gmail.com>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf] bpf: verifier: support BPF_LOAD_ACQ in insn_def_regno()
Date: Wed, 21 May 2025 12:13:42 -0700 [thread overview]
Message-ID: <80ef5e2e-c2d9-45b7-9a48-f8c1a4767eae@gmail.com> (raw)
In-Reply-To: <20250521183911.21781-1-puranjay@kernel.org>
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.
next prev parent reply other threads:[~2025-05-21 19:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-21 18:39 Puranjay Mohan
2025-05-21 19:13 ` Eduard Zingerman [this message]
2025-05-21 20:04 ` Alexei Starovoitov
2025-05-21 20:19 ` Eduard Zingerman
2025-05-21 20:22 ` Puranjay Mohan
2025-05-21 20:40 ` Peilin Ye
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=80ef5e2e-c2d9-45b7-9a48-f8c1a4767eae@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=puranjay@kernel.org \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®