From: sashiko-bot@kernel.org
To: "Andrey Grodzovsky" <andrey.grodzovsky@crowdstrike.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v4 6/7] selftests/bpf: Cover BPF program load strategy transitions
Date: Mon, 21 Sep 2026 23:37:12 +0000 [thread overview]
Message-ID: <20260921233713.18F791F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260921223937.3203093-7-andrey.grodzovsky@crowdstrike.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] bpf: ignored bpf_program__set_load_strategy() return value in selftest
--
commit 9bfec64bd482deb3a43ba282aed9959f4435d987
Author: Slava Imameev <slava.imameev@crowdstrike.com>
selftests/bpf: Cover BPF program load strategy transitions
Adds a load_type test to cover load strategy transitions
(DISABLED/AUTO/MANUAL) and compatibility with boolean auto-attach states.
Also tests the manual load/attach cycle after loading an object.
> diff --git a/tools/testing/selftests/bpf/prog_tests/load_type.c b/tools/testing/selftests/bpf/prog_tests/load_type.c
> new file mode 100644
> index 0000000000000..ab42c3e887fce
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/load_type.c
> @@ -0,0 +1,186 @@
[ ... ]
> +void test_load_type(void)
> +{
> + struct bpf_link *link = NULL;
> + struct test_load_type *skel;
> + int err;
> +
> + skel = test_load_type__open();
> + if (!ASSERT_OK_PTR(skel, "skel_open"))
> + return;
> +
> + /* don't load prog1 */
> + bpf_program__set_load_strategy(skel->progs.prog1, BPF_PROG_LOAD_STRATEGY_DISABLED);
> +
> + /* load and attach prog2 */
> + bpf_program__set_load_strategy(skel->progs.prog2, BPF_PROG_LOAD_STRATEGY_AUTO);
[Severity: Medium]
Is it intentional that test_load_type() ignores the return value of
bpf_program__set_load_strategy() for prog1 and prog2?
Since this selftest is designed to verify load strategy transitions, failing
to check the return value might silently mask regressions. If the API
introduces a bug where transitioning to AUTO fails (e.g., returning -EINVAL),
the API call would return an error but the program's strategy would remain
its default (which is already AUTO for prog2).
Because prog2 remains AUTO, the subsequent test assertions expecting AUTO
behavior would still pass, completely missing the API failure it was designed
to catch. Should these calls use ASSERT_OK() similar to how prog3 is checked
below?
> + if (!ASSERT_TRUE(bpf_program__autoload(skel->progs.prog2), "prog2_autoload"))
> + goto cleanup;
> +
> + err = bpf_program__set_load_strategy(skel->progs.prog3, BPF_PROG_LOAD_STRATEGY_MANUAL);
> + if (!ASSERT_OK(err, "set_load_strategy_manual"))
> + goto cleanup;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260921223937.3203093-1-andrey.grodzovsky@crowdstrike.com?part=6
next prev parent reply other threads:[~2026-09-21 23:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 22:39 [PATCH bpf-next v4 0/7] libbpf: BPF program manual loading Andrey Grodzovsky
2026-09-21 22:39 ` [PATCH bpf-next v4 1/7] libbpf: BPF program load strategy enum Andrey Grodzovsky
2026-09-21 23:21 ` bot+bpf-ci
2026-09-21 22:39 ` [PATCH bpf-next v4 2/7] libbpf: BPF programs manual loading and attaching Andrey Grodzovsky
2026-09-21 23:03 ` sashiko-bot
2026-09-22 23:51 ` Andrey Grodzovsky
2026-09-21 22:39 ` [PATCH bpf-next v4 3/7] libbpf: Support declarative manual load via SEC("!...") prefix Andrey Grodzovsky
2026-09-21 23:12 ` sashiko-bot
2026-09-21 23:21 ` bot+bpf-ci
2026-09-21 22:39 ` [PATCH bpf-next v4 4/7] libbpf: Reject gen_loader for objects with already-manual programs Andrey Grodzovsky
2026-09-21 22:39 ` [PATCH bpf-next v4 5/7] libbpf: Version bpf_program__set_autoattach() ABI change Andrey Grodzovsky
2026-09-21 23:31 ` sashiko-bot
2026-09-21 22:39 ` [PATCH bpf-next v4 6/7] selftests/bpf: Cover BPF program load strategy transitions Andrey Grodzovsky
2026-09-21 23:37 ` sashiko-bot [this message]
2026-09-21 22:39 ` [PATCH bpf-next v4 7/7] selftests/bpf: Cover BPF program manual loading Andrey Grodzovsky
2026-09-22 1:37 ` [PATCH bpf-next v4 0/7] libbpf: " Alexei Starovoitov
2026-09-22 14:34 ` Andrey Grodzovsky
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=20260921233713.18F791F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=andrey.grodzovsky@crowdstrike.com \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.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