From: Eduard Zingerman <eddyz87@gmail.com>
To: Puranjay Mohan <puranjay12@gmail.com>
Cc: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@kernel.org>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
kernel-team@meta.com
Subject: Re: [PATCH bpf-next v2 5/9] selftests: bpf: Update failure message for rbtree_fail
Date: Wed, 31 Dec 2025 11:45:57 -0800 [thread overview]
Message-ID: <5a7adb5b2627b4572e86ab76fa4099e34c5c300a.camel@gmail.com> (raw)
In-Reply-To: <CANk7y0gt3NSQooG4FactYh-q7bD9zf77B6ZiQg4nEhNAq1ro-Q@mail.gmail.com>
On Wed, 2025-12-31 at 19:44 +0000, Puranjay Mohan wrote:
> On Wed, Dec 31, 2025 at 7:27 PM Eduard Zingerman <eddyz87@gmail.com> wrote:
> >
> > On Wed, 2025-12-31 at 09:08 -0800, Puranjay Mohan wrote:
> > > The rbtree_api_use_unchecked_remove_retval() selftest passes a pointer
> > > received from bpf_rbtree_remove() to bpf_rbtree_add() without checking
> > > for NULL, this was earlier caught by __check_ptr_off_reg() in the
> > > verifier. Now the verifier assumes every kfunc only takes trusted pointer
> > > arguments, so it catches this NULL pointer earlier in the path and
> > > provides a more accurate failure message.
> > >
> > > Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
> > > ---
> >
> > Acked-by: Eduard Zingerman <eddyz87@gmail.com>
> >
> > > tools/testing/selftests/bpf/progs/rbtree_fail.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/tools/testing/selftests/bpf/progs/rbtree_fail.c b/tools/testing/selftests/bpf/progs/rbtree_fail.c
> > > index 4acb6af2dfe3..70b7baf9304b 100644
> > > --- a/tools/testing/selftests/bpf/progs/rbtree_fail.c
> > > +++ b/tools/testing/selftests/bpf/progs/rbtree_fail.c
> > > @@ -153,7 +153,7 @@ long rbtree_api_add_to_multiple_trees(void *ctx)
> > > }
> > >
> > > SEC("?tc")
> > > -__failure __msg("dereference of modified ptr_or_null_ ptr R2 off=16 disallowed")
> > > +__failure __msg("Possibly NULL pointer passed to trusted arg1")
> > > long rbtree_api_use_unchecked_remove_retval(void *ctx)
> > > {
> > > struct bpf_rb_node *res;
> >
> > Do you happen to know how did it infer off=16 for R2?
> > From the test I would infer that the off is zero.
>
> I thought about that too,
>
> struct node_data {
> long key;
> long data;
> struct bpf_rb_node node;
> };
>
> the node is at an offset of 16 and bpf_rbtree_remove() returns the
> pointer to this node.
Oh, makes sense, thank you.
next prev parent reply other threads:[~2025-12-31 19:46 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-31 17:08 [PATCH bpf-next v2 0/9] bpf: Make KF_TRUSTED_ARGS default Puranjay Mohan
2025-12-31 17:08 ` [PATCH bpf-next v2 1/9] bpf: Make KF_TRUSTED_ARGS the default for all kfuncs Puranjay Mohan
2025-12-31 17:37 ` bot+bpf-ci
2025-12-31 18:37 ` Eduard Zingerman
2025-12-31 19:00 ` Puranjay Mohan
2025-12-31 19:10 ` Eduard Zingerman
2025-12-31 19:15 ` Puranjay Mohan
2026-01-02 0:15 ` Emil Tsalapatis
2025-12-31 17:08 ` [PATCH bpf-next v2 2/9] bpf: net: netfilter: Mark kfuncs accurately Puranjay Mohan
2025-12-31 17:08 ` [PATCH bpf-next v2 3/9] bpf: Remove redundant KF_TRUSTED_ARGS flag from all kfuncs Puranjay Mohan
2025-12-31 19:13 ` Eduard Zingerman
2026-01-02 0:19 ` Emil Tsalapatis
2025-12-31 17:08 ` [PATCH bpf-next v2 4/9] selftests: bpf: Update kfunc_param_nullable test for new error message Puranjay Mohan
2025-12-31 19:21 ` Eduard Zingerman
2026-01-02 1:45 ` Emil Tsalapatis
2025-12-31 17:08 ` [PATCH bpf-next v2 5/9] selftests: bpf: Update failure message for rbtree_fail Puranjay Mohan
2025-12-31 19:27 ` Eduard Zingerman
2025-12-31 19:44 ` Puranjay Mohan
2025-12-31 19:45 ` Eduard Zingerman [this message]
2026-01-02 1:44 ` Emil Tsalapatis
2025-12-31 17:08 ` [PATCH bpf-next v2 6/9] selftests: bpf: fix test_kfunc_dynptr_param Puranjay Mohan
2025-12-31 19:29 ` Eduard Zingerman
2025-12-31 19:39 ` Puranjay Mohan
2025-12-31 19:44 ` Eduard Zingerman
2025-12-31 23:29 ` Puranjay Mohan
2026-01-02 1:44 ` Emil Tsalapatis
2025-12-31 17:08 ` [PATCH bpf-next v2 7/9] selftests: bpf: fix cgroup_hierarchical_stats Puranjay Mohan
2025-12-31 19:40 ` Eduard Zingerman
2026-01-02 1:48 ` Emil Tsalapatis
2025-12-31 17:08 ` [PATCH bpf-next v2 8/9] bpf: xfrm: drop dead NULL check in bpf_xdp_get_xfrm_state() Puranjay Mohan
2025-12-31 19:48 ` Eduard Zingerman
2025-12-31 17:08 ` [PATCH bpf-next v2 9/9] HID: bpf: drop dead NULL checks in kfuncs Puranjay Mohan
2025-12-31 18:20 ` Alexei Starovoitov
2025-12-31 18:25 ` Puranjay Mohan
2026-01-05 14:52 ` Benjamin Tissoires
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=5a7adb5b2627b4572e86ab76fa4099e34c5c300a.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=kernel-team@meta.com \
--cc=martin.lau@kernel.org \
--cc=memxor@gmail.com \
--cc=puranjay12@gmail.com \
/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