From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Puranjay Mohan" <puranjay@kernel.org>, <bpf@vger.kernel.org>
Cc: "Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Martin KaFai Lau" <martin.lau@linux.dev>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"Tejun Heo" <tj@kernel.org>, "David Vernet" <void@manifault.com>,
"Andrea Righi" <arighi@nvidia.com>
Subject: Re: [PATCH bpf-next v4 1/3] bpf, x86: Support fetching AND/OR/XOR atomics in arena
Date: Fri, 16 Oct 2026 00:20:14 +0000 [thread overview]
Message-ID: <DM5TZB39B3HK.10G7EQ8CFNLJO@gmail.com> (raw)
In-Reply-To: <20261014125017.1426212-2-puranjay@kernel.org>
On Wed, Oct 14, 2026 at 05:50 AM Puranjay Mohan <puranjay@kernel.org> wrote:
> @@ -2926,6 +2989,51 @@ static int do_jit(struct bpf_verifier_env *env, struct bpf_prog *bpf_prog, int *
> fallthrough;
> case BPF_STX | BPF_PROBE_ATOMIC | BPF_W:
> case BPF_STX | BPF_PROBE_ATOMIC | BPF_DW:
> + if (is_atomic_fetch_op(insn)) {
[...]
> + /*
> + * An access through a number has its address in
> + * BPF_REG_AX (see arena_scalar_access()), where the
> + * loop below has to save R0.
> + */
> + if (dst_reg == BPF_REG_AX)
> + return -EOPNOTSUPP;
Reiterating TJ's point differently
can it save R0 with push rax / pop rax in this case, like div/mod do ?
When src_reg is R0 the operand is on the stack: 'or r11, [rsp]'.
Every arena access in Rust is through a number, so after this patch
fetch_or() works in C and doesn't work in Rust.
It's not "as they did before" either.
The verifier used to say
"BPF_ATOMIC stores into R6 scalar is not allowed".
Now the verifier accepts the prog and the load fails with ENOTSUPP
and nothing in the log.
Pls fix and respin patche 1 and 2.
pw-bot: cr
next prev parent reply other threads:[~2026-10-16 0:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 12:50 [PATCH bpf-next v4 0/3] bpf, x86: Support fetching AND/OR/XOR atomics in arena Puranjay Mohan
2026-10-14 12:50 ` [PATCH bpf-next v4 1/3] " Puranjay Mohan
2026-10-16 0:20 ` Alexei Starovoitov [this message]
2026-10-14 12:50 ` [PATCH bpf-next v4 2/3] selftests/bpf: Test " Puranjay Mohan
2026-10-14 12:50 ` [PATCH bpf-next v4 3/3] sched_ext: Use fetching atomics for cmask instead of a cmpxchg loop Puranjay Mohan
2026-10-14 13:23 ` bot+bpf-ci
2026-10-14 13:34 ` Puranjay Mohan
2026-10-15 17:06 ` [PATCH bpf-next v4 0/3] bpf, x86: Support fetching AND/OR/XOR atomics in arena Tejun Heo
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=DM5TZB39B3HK.10G7EQ8CFNLJO@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=arighi@nvidia.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=puranjay@kernel.org \
--cc=song@kernel.org \
--cc=tj@kernel.org \
--cc=void@manifault.com \
--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