From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Andrii Nakryiko" <andrii.nakryiko@gmail.com>
Cc: "Andrea Righi" <arighi@nvidia.com>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
"Martin KaFai Lau" <martin.lau@linux.dev>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"Jiri Olsa" <jolsa@kernel.org>,
"Emil Tsalapatis" <emil@etsalapatis.com>,
"Ihor Solodrai" <ihor.solodrai@linux.dev>,
"John Fastabend" <john.fastabend@gmail.com>,
"Josh Don" <joshdon@google.com>,
"Vineeth Pillai" <vineethrp@google.com>,
"Balbir Singh" <balbirs@nvidia.com>,
"Shameer Kolothum" <skolothumtho@nvidia.com>,
"Himadri Chhaya-Shailesh" <himadrics@protonmail.com>,
"NchangRoy" <royfru44@gmail.com>, <bpf@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next 0/5] bpf: Expose pinned arenas as sized bpffs files
Date: Sun, 18 Oct 2026 00:52:46 +0000 [thread overview]
Message-ID: <DM7JXB4PREVH.1BHG31CCNRXF1@gmail.com> (raw)
In-Reply-To: <CAEf4BzZZRrD86ZswsB2r-swqNi7D1p52Vs=fQ9MXSgGATN31Jg@mail.gmail.com>
On Fri, Oct 16, 2026 at 12:52 PM Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote:
> kernel to do that. But once we have the ability to create ARRAY from a
> bunch of pre-existing memory (e.g., from memfd), this can be used both
> in a guest and in the host, and both models, guest allocates or host
> allocates, could be supported with the same model.
I don't think it will work for their use case.
With array of maps scx needs two lookups and two NULL checks
on every access, and the result cannot be kept in the task ctx
which is in arena today, since ptr_to_map_value becomes scalar.
unless everything is converted to magically bounded array, but...
> annoying, but what if we teach verifier to just automatically add
> bounds limiting sequence (e.g., masking if value size is power of two,
> slightly slower sequence for non-power-of-two, of course)
while working on arena ~year back I tried to add runtime masking to
ptr_to_map_value and couldn't figure it out.
then in ~april I tried again with llm-s and failed again.
the main issue is that ptr_to_map_value is a pointer,
and progs keep adding random stuff to it.
There is no way to split it into 'base + offset'
and apply mask on 'offset'.
I tried alignment tricks, like align each ptr_to_map_value's base
to 64k or such, but still failed. Something needs to remember
upper bits to see when math overflows.
That's why Barret was using explicit mask in C on every array access
(when he implemented all kinds of complex data structs on top of arrays).
Every access in C was base + mask(offset).
Array from memfd is a separate topic. So far I'm failing to see
a use case, but if it's not a lot of code, then why not.
prev parent reply other threads:[~2026-10-18 0:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 22:45 [PATCH bpf-next 0/5] bpf: Expose pinned arenas as sized bpffs files Andrea Righi
2026-10-10 22:45 ` [PATCH 1/5] bpf: Add an arena flag to retain allocated pages Andrea Righi
2026-10-10 23:00 ` sashiko-bot
2026-10-10 22:45 ` [PATCH 2/5] bpf: Expose pinned arenas as sized bpffs files Andrea Righi
2026-10-10 23:06 ` sashiko-bot
2026-10-10 23:40 ` bot+bpf-ci
2026-10-10 22:45 ` [PATCH 3/5] docs/bpf: Document pinned arena file mappings Andrea Righi
2026-10-10 23:19 ` bot+bpf-ci
2026-10-10 22:45 ` [PATCH 4/5] selftests/bpf: Test " Andrea Righi
2026-10-10 23:40 ` bot+bpf-ci
2026-10-10 22:46 ` [PATCH 5/5] selftests/bpf: Test two-way arena access with two guests Andrea Righi
2026-10-10 23:00 ` sashiko-bot
2026-10-10 23:40 ` bot+bpf-ci
2026-10-15 17:50 ` [PATCH bpf-next 0/5] bpf: Expose pinned arenas as sized bpffs files Josh Don
2026-10-16 19:03 ` Alexei Starovoitov
2026-10-16 19:52 ` Andrii Nakryiko
2026-10-18 0:52 ` Alexei Starovoitov [this message]
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=DM7JXB4PREVH.1BHG31CCNRXF1@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=arighi@nvidia.com \
--cc=balbirs@nvidia.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=himadrics@protonmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=joshdon@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=royfru44@gmail.com \
--cc=skolothumtho@nvidia.com \
--cc=song@kernel.org \
--cc=vineethrp@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.