BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Leon Hwang" <leon.hwang@linux.dev>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v4 2/2] selftests/bpf: Verify rejection of sleepable tracing prog
Date: Wed, 05 Aug 2026 15:32:23 +0000	[thread overview]
Message-ID: <20260805153224.645AE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260805150810.34907-3-leon.hwang@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The test deliberately triggers a kernel BUG on a failing run by executing an active kernel-crashing payload when the tested bug is present, disrupting automated CI environments.
--

--- Patch [2]: [PATCH bpf-next v4 2/2] selftests/bpf: Verify rejection of sleepable tracing prog ---
commit b744623263d5a19a3bd8be3aa0ccd3a94a64c24e
Author: Leon Hwang <leon.hwang@linux.dev>

selftests/bpf: Verify rejection of sleepable tracing prog

This commit adds a selftest to verify that a sleepable tracing program cannot
attach to a '__x64_sys' prefix prog target. It ensures the kernel properly
rejects this to avoid sleeping function bugs in invalid contexts.

> diff --git a/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c b/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c
> index 4a87d7163c8c7..2523c07a16c65 100644
> --- a/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c
> +++ b/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c
[ ... ]
> @@ -576,6 +577,60 @@ static void test_func_replace_progmap(void)
>  	freplace_progmap__destroy(skel);
>  }
>  
> +static void test_sleepable_fentry_to_xdp(void)
> +{
[ ... ]
> +	err = bpf_program__set_attach_target(skel->progs.fentry_xdp, prog_fd, "__x64_sys_nop");
> +	if (!ASSERT_OK(err, "bpf_program__set_attach_target"))
> +		goto out;
> +
> +	err = fentry_sleepable__load(skel);
> +	ASSERT_ERR(err, "fentry_sleepable__load");
> +	if (err)
> +		goto out;
> +
> +	skel->links.fentry_xdp = bpf_program__attach_trace(skel->progs.fentry_xdp);

[Severity: Medium]
Will this execution path crash automated CI environments when running on a
kernel without the fix?

If fentry_sleepable__load() unexpectedly succeeds and returns 0, ASSERT_ERR()
will log the test failure, but the subsequent 'if (err)' check evaluates to
false. This causes the test to fall through to the attach and ping payload
rather than jumping to 'out'.

Since executing this payload triggers a kernel panic when the bug is present,
should this error check jump to 'out' when err == 0 to fail gracefully?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260805150810.34907-1-leon.hwang@linux.dev?part=2

  reply	other threads:[~2026-08-05 15:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05 15:08 [PATCH bpf-next v4 0/2] bpf: Fix sleepable check for tracing/lsm prog Leon Hwang
2026-08-05 15:08 ` [PATCH bpf-next v4 1/2] " Leon Hwang
2026-08-05 16:44   ` bot+bpf-ci
2026-08-05 18:43     ` Andrii Nakryiko
2026-08-05 15:08 ` [PATCH bpf-next v4 2/2] selftests/bpf: Verify rejection of sleepable tracing prog Leon Hwang
2026-08-05 15:32   ` sashiko-bot [this message]
2026-08-05 18:50 ` [PATCH bpf-next v4 0/2] bpf: Fix sleepable check for tracing/lsm prog patchwork-bot+netdevbpf

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=20260805153224.645AE1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=leon.hwang@linux.dev \
    --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