From: sashiko-bot@kernel.org
To: "Leon Hwang" <leon.hwang@linux.dev>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 2/2] selftests/bpf: Verify rejection of sleepable tracing prog
Date: Fri, 24 Jul 2026 14:24:18 +0000 [thread overview]
Message-ID: <20260724142418.B7E191F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260724141422.10463-3-leon.hwang@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The test incorrectly handles the expected failure of `fentry_sleepable__load()`, leading to dead code on patched kernels and an intentional kernel BUG on unpatched kernels.
--
--- Patch [2]: [PATCH bpf-next 2/2] selftests/bpf: Verify rejection of sleepable tracing prog ---
commit 21867bb1ed07f00930e4aa9f252967deb7c142a2
Author: Leon Hwang <leon.hwang@linux.dev>
selftests/bpf: Verify rejection of sleepable tracing prog
This commit adds a BPF selftest to verify that a sleepable tracing program
cannot attach to a '__x64_sys' prefix program target.
> diff --git a/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c b/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c
> --- 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)
[ ... ]
> + 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);
> + if (!ASSERT_OK_PTR(skel->links.fentry_xdp, "bpf_program__attach_trace"))
> + goto out;
> +
> + skel_xdp->links.__x64_sys_nop = bpf_program__attach_xdp(skel_xdp->progs.__x64_sys_nop,
> + ifindex);
> + if (!ASSERT_OK_PTR(skel_xdp->links.__x64_sys_nop, "bpf_program__attach_xdp"))
> + goto out;
> +
> + err = system("ping -q -c 1 -W 1 127.0.0.1 > /dev/null");
> + ASSERT_OK(err, "ping");
> + ASSERT_ERR(skel->bss->retval, "retval");
[Severity: Medium]
Is it intended that the attach and ping logic only executes on unpatched
kernels?
When run on a patched kernel, fentry_sleepable__load() fails as expected
(err != 0). The ASSERT_ERR(err) check passes, but the if (err) block then
causes the test to jump to 'out', making the remaining attach and ping code
unreachable.
When run on an unpatched kernel, the load succeeds (err == 0). The
ASSERT_ERR(err) check fails, but because err is 0, the test proceeds past
the if (err) check. It then attaches the program and triggers it via ping,
which intentionally crashes the system with a kernel BUG (as noted in the
commit message) instead of failing gracefully.
Could this be resolved by either removing the unreachable attach and ping
code entirely, or by changing the check to if (!err) to prevent the test
from crashing unpatched kernels?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260724141422.10463-1-leon.hwang@linux.dev?part=2
next prev parent reply other threads:[~2026-07-24 14:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 14:14 [PATCH bpf-next 0/2] bpf: Fix sleepable check for tracing prog Leon Hwang
2026-07-24 14:14 ` [PATCH bpf-next 1/2] " Leon Hwang
2026-07-24 15:41 ` Viktor Malik
2026-07-24 15:54 ` Leon Hwang
2026-07-24 14:14 ` [PATCH bpf-next 2/2] selftests/bpf: Verify rejection of sleepable " Leon Hwang
2026-07-24 14:24 ` sashiko-bot [this message]
2026-07-24 15:13 ` Leon Hwang
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=20260724142418.B7E191F00A3D@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 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.