[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aC46PuLHp6yjTBJR@google.com>
Date: Wed, 21 May 2025 20:40:30 +0000
From: Peilin Ye <yepeilin@...gle.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Eduard Zingerman <eddyz87@...il.com>,
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 <bpf@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf] bpf: verifier: support BPF_LOAD_ACQ in
insn_def_regno()
On Wed, May 21, 2025 at 01:04:47PM -0700, Alexei Starovoitov wrote:
> On Wed, May 21, 2025 at 12:13 PM Eduard Zingerman <eddyz87@...il.com> wrote:
> > 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.
>
> I suspect it was already fixed by commit
> fce7bd8e385a ("bpf/verifier: Handle BPF_LOAD_ACQ instructions in
> insn_def_regno()")
Ah, right; I did it when adding support for riscv64 (which needs_zext).
I targeted bpf-next because at that time only x86_64 and arm64 (both
!needs_zext) supported BPF_LOAD_ACQ, and didn't realize this could
affect arm32 (needs_zext).
It should've targeted bpf with a Fixes: tag instead. Sorry for any
confusion.
Thanks,
Peilin Ye
Powered by blists - more mailing lists