BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Anastasios Papagiannis" <tasos.papagiannnis@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v3 5/7] selftests/bpf: Cover trusted-or-null BTF pointer reads
Date: Mon, 31 Aug 2026 10:55:59 +0000	[thread overview]
Message-ID: <20260831105559.E8E271F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831092305.42062-6-tasos.papagiannnis@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Tests for atomic RMW operations and BPF_LOAD_ACQ on trusted-or-null pointers are missing, despite the commit message claiming they are verified.
- [Low] Multi-line comment opening '/*' is not on its own line, violating BPF subsystem guidelines.
--

commit a8459550255e4dfc12584cd94a1820a3e538fba1
Author: Anastasios Papagiannis <tasos.papagiannnis@gmail.com>

selftests/bpf: Cover trusted-or-null BTF pointer reads

This commit updates verifier tests for unchecked trusted-or-null BTF pointer
dereferences and adds tests covering scalar reads and chained reads. It also
adds runtime tests to verify that non-NULL reads return the field value while
NULL reads return zero.

> diff --git a/tools/testing/selftests/bpf/prog_tests/test_struct_ops_maybe_null.c b/tools/testing/selftests/bpf/prog_tests/test_struct_ops_maybe_null.c
> --- a/tools/testing/selftests/bpf/prog_tests/test_struct_ops_maybe_null.c
> +++ b/tools/testing/selftests/bpf/prog_tests/test_struct_ops_maybe_null.c
> @@ -19,15 +19,15 @@ static void maybe_null(void)
>  	struct_ops_maybe_null__destroy(skel);
>  }
>  
> -/* Test that the verifier rejects a program that access a nullable pointer
> - * without a check beforehand.
> +/* Test that the verifier accepts a fault-protected read through a nullable
> + * trusted pointer without an explicit NULL check.
>   */

[Severity: Low]
This is not a bug, but does this follow the BPF subsystem comment guidelines?
The guidelines require multi-line comments to have the opening /* on its own
line, rather than keeping the text on the same line as the opening characters.

[ ... ]

> diff --git a/tools/testing/selftests/bpf/progs/test_tp_btf_nullable.c b/tools/testing/selftests/bpf/progs/test_tp_btf_nullable.c
> --- a/tools/testing/selftests/bpf/progs/test_tp_btf_nullable.c
> +++ b/tools/testing/selftests/bpf/progs/test_tp_btf_nullable.c
[ ... ]
> +SEC("tp_btf/bpf_testmod_test_nullable_bare_tp")
> +__failure __msg("pointer arithmetic on trusted_ptr_or_null_ prohibited")
> +int BPF_PROG(handle_tp_btf_nullable_arith, struct bpf_testmod_test_read_ctx *nullable_ctx)
> +{
> +	asm volatile("%[ctx] += 1" : [ctx] "+r"(nullable_ctx));
> +	return nullable_ctx->len;
> +}

[Severity: Medium]
The commit message states that the tests verify that atomic RMW operations
and BPF_LOAD_ACQ accesses remain prohibited. Does this patch actually include
those tests? The test for pointer arithmetic is present here in
handle_tp_btf_nullable_arith(), but there do not seem to be any corresponding
tests for atomic RMW operations or BPF_LOAD_ACQ accesses in this file or
elsewhere in the patch.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260831092305.42062-1-tasos.papagiannnis@gmail.com?part=5

  parent reply	other threads:[~2026-08-31 10:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31  9:22 [PATCH bpf-next v3 0/7] bpf: Add user memory access kfuncs for mm_struct Anastasios Papagiannis
2026-08-31  9:22 ` [PATCH bpf-next v3 1/7] mm: Add copy_remote_mm_str() Anastasios Papagiannis
2026-08-31  9:23 ` [PATCH bpf-next v3 2/7] bpf: Add user memory access kfuncs for mm_struct Anastasios Papagiannis
2026-08-31 10:01   ` sashiko-bot
2026-08-31 10:43   ` bot+bpf-ci
2026-08-31  9:23 ` [PATCH bpf-next v3 3/7] exec: Clear bprm->mm before dropping its reference Anastasios Papagiannis
2026-08-31 10:25   ` sashiko-bot
2026-08-31 10:30   ` bot+bpf-ci
2026-09-01  3:19   ` sun jian
2026-09-01  8:56   ` sun jian
2026-08-31  9:23 ` [PATCH bpf-next v3 4/7] bpf: Allow reads through trusted-or-null BTF pointers Anastasios Papagiannis
2026-08-31 10:43   ` bot+bpf-ci
2026-08-31  9:23 ` [PATCH bpf-next v3 5/7] selftests/bpf: Cover trusted-or-null BTF pointer reads Anastasios Papagiannis
2026-08-31 10:43   ` bot+bpf-ci
2026-08-31 10:55   ` sashiko-bot [this message]
2026-08-31  9:23 ` [PATCH bpf-next v3 6/7] bpf: Mark linux_binprm->mm as trusted-or-null Anastasios Papagiannis
2026-08-31 10:43   ` bot+bpf-ci
2026-09-01  3:50   ` sun jian
2026-08-31  9:23 ` [PATCH bpf-next v3 7/7] selftests/bpf: Test mm_struct user memory kfuncs with linux_binprm Anastasios Papagiannis

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=20260831105559.E8E271F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tasos.papagiannnis@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