From: sashiko-bot@kernel.org
To: "Kumar Kartikeya Dwivedi" <memxor@gmail.com>, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v4 04/16] selftests/bpf: Clone a program that calls a module kfunc
Date: Mon, 19 Oct 2026 03:31:18 +0000 [thread overview]
Message-ID: <sashiko-outbox-176573@kernel.org> (raw)
In-Reply-To: <20261019032401.2302823-5-memxor@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] selftests/bpf: new standalone file for narrow bpf_program__clone() variant
--
commit 037d01e59174031ad79e435ca7e39a5bb4ce575d
Author: Kumar Kartikeya Dwivedi <memxor@gmail.com>
selftests/bpf: Clone a program that calls a module kfunc
This commit adds a selftest that opens kfunc_call_test, prepares the object
via bpf_object__prepare(), and loads kfunc_call_test1 using
bpf_program__clone() to verify module BTF fd handling in the object's
fd_array.
> diff --git a/tools/testing/selftests/bpf/prog_tests/clone_module_kfunc.c b/tools/testing/selftests/bpf/prog_tests/clone_module_kfunc.c
> new file mode 100644
> index 0000000000000..fa6ccbaa7fd98
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/clone_module_kfunc.c
> @@ -0,0 +1,30 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (c) 2026 Meta Platforms, Inc. and affiliates. */
> +#include <test_progs.h>
> +#include "kfunc_call_test.skel.h"
> +
> +/*
> + * bpf_program__clone() loads a program from a prepared object with the
> + * fd_array of the object, where module BTF fds start at slot 1 and slot 0 is
> + * empty. It used to pass the fill index of that array as fd_array_cnt, which
> + * made the kernel resolve slot 0 and fail the load.
> + */
> +void test_clone_module_kfunc(void)
> +{
> + struct kfunc_call_test *skel;
> + int err, fd;
> +
> + skel = kfunc_call_test__open();
> + if (!ASSERT_OK_PTR(skel, "skel_open"))
> + return;
> +
> + err = bpf_object__prepare(skel->obj);
> + if (!ASSERT_OK(err, "prepare"))
> + goto out;
> +
> + fd = bpf_program__clone(skel->progs.kfunc_call_test1, NULL);
> + if (ASSERT_GE(fd, 0, "clone"))
> + close(fd);
> +out:
> + kfunc_call_test__destroy(skel);
> +}
[Severity: Low]
This isn't a bug, but test_clone_module_kfunc() in
tools/testing/selftests/bpf/prog_tests/clone_module_kfunc.c adds a new
standalone test file for a single bpf_object__prepare() and
bpf_program__clone() check on kfunc_call_test.skel.h.
In the same directory, tools/testing/selftests/bpf/prog_tests/kfunc_call.c
already includes kfunc_call_test.skel.h, exercises kfunc_call_test1 across
loader variants, and groups subtests under test_kfunc_call():
tools/testing/selftests/bpf/prog_tests/kfunc_call.c:test_kfunc_call() {
test_main();
if (test__start_subtest("subprog"))
test_subprog();
if (test__start_subtest("subprog_lskel"))
test_subprog_lskel();
if (test__start_subtest("destructive"))
test_destructive();
}
Similarly, tools/testing/selftests/bpf/prog_tests/prepare.c and
tools/testing/selftests/bpf/prog_tests/clone_attach_btf_id.c already test
bpf_object__prepare() and bpf_program__clone().
Could this check be added as a subtest or case in an existing test file such
as kfunc_call.c, prepare.c, or clone_attach_btf_id.c (similar to how the
preceding patch in the series extended prog_tests/map_excl.c) instead of
adding a new standalone file?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261019032401.2302823-1-memxor@gmail.com?part=4
next prev parent reply other threads:[~2026-10-19 3:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 3:23 [PATCH bpf-next v4 00/16] Fix some arena paper cuts Kumar Kartikeya Dwivedi
2026-10-19 3:23 ` [PATCH bpf-next v4 01/16] bpf: Check exclusive maps once the program digest is final Kumar Kartikeya Dwivedi
2026-10-19 3:46 ` sashiko-bot
2026-10-19 3:23 ` [PATCH bpf-next v4 02/16] selftests/bpf: Bind an exclusive map through a continuous fd_array Kumar Kartikeya Dwivedi
2026-10-19 3:23 ` [PATCH bpf-next v4 03/16] libbpf: Keep the fd_array fill index out of bpf_program__clone() Kumar Kartikeya Dwivedi
2026-10-19 3:23 ` [PATCH bpf-next v4 04/16] selftests/bpf: Clone a program that calls a module kfunc Kumar Kartikeya Dwivedi
2026-10-19 3:31 ` sashiko-bot [this message]
2026-10-19 3:23 ` [PATCH bpf-next v4 05/16] bpf: Add the __arena and __nullable BTF type tags Kumar Kartikeya Dwivedi
2026-10-19 3:23 ` [PATCH bpf-next v4 06/16] bpf: Recognize __nullable on pointer members of kernel structs Kumar Kartikeya Dwivedi
2026-10-19 3:23 ` [PATCH bpf-next v4 07/16] bpf: Turn loads of __arena pointer members into arena pointers Kumar Kartikeya Dwivedi
2026-10-19 3:23 ` [PATCH bpf-next v4 08/16] selftests/bpf: Test __nullable pointer members Kumar Kartikeya Dwivedi
2026-10-19 3:23 ` [PATCH bpf-next v4 09/16] selftests/bpf: Test __arena " Kumar Kartikeya Dwivedi
2026-10-19 3:23 ` [PATCH bpf-next v4 10/16] selftests/bpf: Move the no-arena tests out of objects with an arena map Kumar Kartikeya Dwivedi
2026-10-19 3:23 ` [PATCH bpf-next v4 11/16] libbpf: Bind the arena of an object to every program in it Kumar Kartikeya Dwivedi
2026-10-19 3:23 ` [PATCH bpf-next v4 12/16] selftests/bpf: Test arena binding by libbpf Kumar Kartikeya Dwivedi
2026-10-19 3:23 ` [PATCH bpf-next v4 13/16] bpf: Set up the arena base only in functions that use it Kumar Kartikeya Dwivedi
2026-10-19 3:23 ` [PATCH bpf-next v4 14/16] libbpf: Render the arena type tag with its address space Kumar Kartikeya Dwivedi
2026-10-19 3:23 ` [PATCH bpf-next v4 15/16] selftests/bpf: Test the address space rendering of the arena type tag Kumar Kartikeya Dwivedi
2026-10-19 3:23 ` [PATCH bpf-next v4 16/16] selftests/bpf: Test an arena kfunc argument passed from a subprogram Kumar Kartikeya Dwivedi
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=sashiko-outbox-176573@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=memxor@gmail.com \
--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