BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andrey Grodzovsky" <andrey.grodzovsky@crowdstrike.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v6 6/7] selftests/bpf: Cover BPF program manual loading
Date: Sat, 10 Oct 2026 15:03:52 +0000	[thread overview]
Message-ID: <sashiko-outbox-166679@kernel.org> (raw)
In-Reply-To: <20261010143156.379864-7-andrey.grodzovsky@crowdstrike.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] bpf: flaky test due to missing PID filtering and RCU detach delay
--

commit 5554ecac607fedce9b924955d0f276b639ab57c5
Author: Andrey Grodzovsky <andrey.grodzovsky@crowdstrike.com>
Subject: selftests/bpf: Cover BPF program manual loading

This commit adds a manual load test for BPF programs, covering declarative
and imperative manual load strategies, attach/detach/reload cycles, and a
deferred module BTF attach. It also adds a signed loader test to ensure
that manual programs are rejected when a gen loader object is used.

> diff --git a/tools/testing/selftests/bpf/prog_tests/manual_load.c b/tools/testing/selftests/bpf/prog_tests/manual_load.c
> new file mode 100644
> index 0000000000000..e5bdf7e0f04ec
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/manual_load.c

[ ... ]

> +	/*
> +	 * detach prog3 explicitly: its link is kept in a local variable, not in
> +	 * skel->links, so test_manual_load__destroy() has nothing to detach
> +	 */
> +	err = bpf_link__destroy(link);
> +	link = NULL;
> +	if (!ASSERT_OK(err, "link_destroy"))
> +		goto cleanup;
> +
> +	/* reset the call flag after detach */
> +	skel->bss->prog3_called = false;
> +
> +	usleep(1);
> +
> +	ASSERT_FALSE(skel->bss->prog3_called, "prog3_called");

[Severity: Low]
Since tracepoint unregistration uses RCU, could a concurrent syscall on
another CPU trigger the program during the grace period and set
prog3_called to true?

This might cause the test to sporadically fail when run in parallel.

[ ... ]

> diff --git a/tools/testing/selftests/bpf/progs/test_manual_load.c b/tools/testing/selftests/bpf/progs/test_manual_load.c
> new file mode 100644
> index 0000000000000..6cdbfc21ca379
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/test_manual_load.c

[ ... ]

> +/*
> + * disabled at parse time; its attach target is resolved against module
> + * BTF via bpf_program__set_attach_target() before it is switched to
> + * MANUAL and loaded
> + */
> +SEC("?fentry")
> +int BPF_PROG(prog5, struct file *file, struct kobject *kobj,
> +	     const struct bin_attribute *bin_attr, char *buf, loff_t off, size_t len)
> +{
> +	prog5_sz = len;
> +	return 0;
> +}

[Severity: Low]
Does this tracepoint need PID filtering?

When tests are run in parallel, concurrent tests triggering the testmod read
with different lengths could overwrite prog5_sz, which would fail the length
assertion in the test.

Filtering on the test process's PID (e.g., bpf_get_current_pid_tgid() >> 32
== test_pid) might prevent this.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261010143156.379864-1-andrey.grodzovsky@crowdstrike.com?part=6

  reply	other threads:[~2026-10-10 15:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-10 14:31 [PATCH bpf-next v6 0/7] libbpf: BPF program manual loading Andrey Grodzovsky
2026-10-10 14:31 ` [PATCH bpf-next v6 1/7] libbpf: Reject gen_loader set after PREPARE step Andrey Grodzovsky
2026-10-10 15:21   ` bot+bpf-ci
2026-10-10 14:31 ` [PATCH bpf-next v6 2/7] libbpf: BPF program load strategy enum Andrey Grodzovsky
2026-10-10 14:31 ` [PATCH bpf-next v6 3/7] libbpf: BPF programs manual loading and attaching Andrey Grodzovsky
2026-10-10 14:31 ` [PATCH bpf-next v6 4/7] libbpf: Support declarative manual load via SEC("!...") prefix Andrey Grodzovsky
2026-10-10 15:06   ` sashiko-bot
2026-10-10 14:31 ` [PATCH bpf-next v6 5/7] selftests/bpf: Cover BPF program load strategy transitions Andrey Grodzovsky
2026-10-10 14:31 ` [PATCH bpf-next v6 6/7] selftests/bpf: Cover BPF program manual loading Andrey Grodzovsky
2026-10-10 15:03   ` sashiko-bot [this message]
2026-10-10 14:31 ` [PATCH bpf-next v6 7/7] selftests/bpf: Convert veristat to BPF_PROG_LOAD_STRATEGY_MANUAL Andrey Grodzovsky
2026-10-10 15:08   ` sashiko-bot

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-166679@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