All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 2/4] selftests/bpf: Add assertions for bpf_program__{add,clear}_flags()
Date: Thu, 10 Sep 2026 18:42:49 +0000	[thread overview]
Message-ID: <20260910184249.BAA0A1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260910183222.307208-2-toke@redhat.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Missing early exit check on BPF skeleton load and flag manipulation operations allows execution to proceed in an invalid state.
--

commit 1694db036efd5301fa9d3722ffe0c0854fa291b9
Author: Toke Høiland-Jørgensen <toke@redhat.com>

selftests/bpf: Add assertions for bpf_program__{add,clear}_flags()
    
Add assertions that round-tripping through bpf_program__add_flags() and
bpf_program__clear_flags() ends up with the original flags value.
Arbitrarily add these to the kernel_flag test prog since that's where
we're already checking for the bpf_program__flags() value (and the test
name contains "flag").

> diff --git a/tools/testing/selftests/bpf/prog_tests/kernel_flag.c b/tools/testing/selftests/bpf/prog_tests/kernel_flag.c
> index 25eb59f460abe..72c0ef8da409e 100644
> --- a/tools/testing/selftests/bpf/prog_tests/kernel_flag.c
> +++ b/tools/testing/selftests/bpf/prog_tests/kernel_flag.c
> @@ -10,15 +10,31 @@ void test_kernel_flag(void)

[ ... ]

> +	ret = bpf_program__add_flags(prog, BPF_F_ANY_ALIGNMENT);
> +	ASSERT_OK(ret, "bpf_program__add_flags ret");

[Severity: Low]
Should this ASSERT_OK() call be wrapped in an if (!...) goto close_prog;
check?  If it fails, the test will continue executing instead of cleanly
aborting.

> +	ASSERT_EQ(bpf_program__flags(prog), flags | BPF_F_ANY_ALIGNMENT,
> +		  "bpf_program__add_flags value");
> +
> +	ret = bpf_program__clear_flags(prog, BPF_F_ANY_ALIGNMENT);
> +	ASSERT_OK(ret, "bpf_program__clear_flags ret");
> +	ASSERT_EQ(bpf_program__flags(prog), flags, "bpf_program__clear_flags value");
> +
> +	ret = test_kernel_flag__load(lsm_skel);
> +	ASSERT_OK(ret, "test_kernel_flag__load");

[Severity: Low]
Is it intentional to allow execution to proceed if the skeleton fails to
load?  Wrapping this in if (!ASSERT_OK(ret, ...)) goto close_prog; would
abort the test cleanly and avoid cascading test failures.

> +
>  	lsm_skel->bss->monitored_tid = sys_gettid();
>  
>  	ret = test_kernel_flag__attach(lsm_skel);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260910183222.307208-1-toke@redhat.com?part=2

  reply	other threads:[~2026-09-10 18:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 18:32 [PATCH bpf-next v2 1/4] libbpf: Add bpf_program__add_flags() and bpf_program__clear_flags() Toke Høiland-Jørgensen
2026-09-10 18:32 ` [PATCH bpf-next v2 2/4] selftests/bpf: Add assertions for bpf_program__{add,clear}_flags() Toke Høiland-Jørgensen
2026-09-10 18:42   ` sashiko-bot [this message]
2026-09-10 18:32 ` [PATCH bpf-next v2 3/4] selftests/bpf: Adopt bpf_program__add_flags() helper Toke Høiland-Jørgensen
2026-09-10 18:45   ` sashiko-bot
2026-09-11  3:18   ` Jiayuan Chen
2026-09-11  9:53     ` Toke Høiland-Jørgensen
2026-09-11 19:27       ` Andrii Nakryiko
2026-09-12  8:24         ` Toke Høiland-Jørgensen
2026-09-10 18:32 ` [PATCH bpf-next v2 4/4] bpftool: " Toke Høiland-Jørgensen
2026-09-10 18:40 ` [PATCH bpf-next v2 1/4] libbpf: Add bpf_program__add_flags() and bpf_program__clear_flags() sashiko-bot
2026-09-10 22:43 ` Eduard Zingerman
2026-09-11  3:07 ` Jiayuan Chen
2026-09-11 19:27 ` Andrii Nakryiko

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=20260910184249.BAA0A1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=toke@redhat.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 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.