From: Eduard Zingerman <eddyz87@gmail.com>
To: Slava Imameev <slava.imameev@crowdstrike.com>,
ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org
Cc: martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev,
john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me,
haoluo@google.com, jolsa@kernel.org, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org, shuah@kernel.org,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-open-source@crowdstrike.com
Subject: Re: [PATCH bpf-next v2 0/2] bpf: Add multi-level pointer parameter support for trampolines
Date: Tue, 17 Feb 2026 17:48:53 -0800 [thread overview]
Message-ID: <bb4bf5fe648ac71c969c6228ac6e72ea85cbc64b.camel@gmail.com> (raw)
In-Reply-To: <20260217221357.18215-1-slava.imameev@crowdstrike.com>
On Wed, 2026-02-18 at 09:13 +1100, Slava Imameev wrote:
[...]
> The verifier assigns SCALAR type to single-level pointers (void*, int*).
So, the simplest change for pointers to pointers would be as below, right?
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -6906,7 +6906,8 @@ bool btf_ctx_access(int off, int size, enum bpf_access_type type,
* If it's a pointer to void, it's the same as scalar from the verifier
* safety POV. Either way, no futher pointer walking is allowed.
*/
- if (is_void_or_int_ptr(btf, t))
+ if (is_void_or_int_ptr(btf, t) || !is_ptr_to_struct(btf, t))
return true;
/* this is a pointer to another type */
Except that loaded value would be marked as scalar() and one would
need to cast it using e.g. bpf_core_cast() to obtain an untrusted
pointer.
> For multi-level pointers, I selected PTR_TO_MEM to enable memory access
> through a single load instruction for the first level of dereference,
> with subsequent dereferences becoming SCALAR. This design eliminates
> helper call for parameter dereference, replacing it with a load
> instruction (e.g., void* ptr = *pptr).
If going this route instead, is there a technical reason to limit this
logic to multi-level pointers? Applying same rules to `int *` and
alike seem more consistent.
[...]
next prev parent reply other threads:[~2026-02-18 1:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-17 22:13 [PATCH bpf-next v2 0/2] bpf: Add multi-level pointer parameter support for trampolines Slava Imameev
2026-02-17 22:13 ` [PATCH bpf-next v2 1/2] bpf: Support multi-level pointer params via PTR_TO_MEM " Slava Imameev
2026-02-17 22:13 ` [PATCH bpf-next v2 2/2] selftests/bpf: Add trampolines multi-level pointer params test coverage Slava Imameev
2026-02-17 22:47 ` bot+bpf-ci
2026-02-18 9:25 ` kernel test robot
2026-02-18 1:48 ` Eduard Zingerman [this message]
2026-02-18 10:43 ` Re: [PATCH bpf-next v2 0/2] bpf: Add multi-level pointer parameter Slava Imameev
2026-02-18 16:16 ` David Windsor
2026-02-19 3:15 ` Alexei Starovoitov
2026-02-19 5:17 ` Yonghong Song
2026-02-23 9:44 ` Re: " Slava Imameev
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=bb4bf5fe648ac71c969c6228ac6e72ea85cbc64b.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=haoluo@google.com \
--cc=horms@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-open-source@crowdstrike.com \
--cc=martin.lau@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=slava.imameev@crowdstrike.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