BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jiayuan Chen" <jiayuan.chen@linux.dev>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v4 3/3] selftests/bpf: xdp: test dev_xdp_install() rejects device-bound program
Date: Mon, 10 Aug 2026 05:23:44 +0000	[thread overview]
Message-ID: <20260810052345.E16C51F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260810050621.82035-4-jiayuan.chen@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Multi-line comment opening `/*` is not on its own line, violating BPF subsystem coding style.
--

--- Patch [3]: [PATCH bpf-next v4 3/3] selftests/bpf: xdp: test dev_xdp_install() rejects device-bound program ---
commit b147dadba98d80bfb5e1c977447162a9b3e3bc29
Author: Jiayuan Chen <jiayuan.chen@linux.dev>

selftests/bpf: xdp: test dev_xdp_install() rejects device-bound program

This commit adds a test to ensure that device-bound XDP programs cannot be
swapped into a generic XDP link via BPF_LINK_UPDATE, bypassing the original
checks in dev_xdp_attach().

> diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_dev_bound_only.c b/tools/testing/selftests/bpf/prog_tests/xdp_dev_bound_only.c
> index 7dd18c6d06c60..4a13f8ec43009 100644
> --- a/tools/testing/selftests/bpf/prog_tests/xdp_dev_bound_only.c
> +++ b/tools/testing/selftests/bpf/prog_tests/xdp_dev_bound_only.c

[ ... ]

> @@ -59,3 +61,50 @@ void test_xdp_dev_bound_only_offdev(void)
>  	 */
>  	SYS_NOFAIL("ip netns del " LOCAL_NETNS);
>  }
> +
> +/* A device-bound program must not run on the XDP software path.
> + * dev_xdp_attach() rejected such programs, but bpf_xdp_link_update() reaches
> + * dev_xdp_install() directly and bypasses it, so the check has to live in
> + * dev_xdp_install(). Create a generic (SKB) XDP link with a normal program,
> + * then try to swap in a device-bound program via BPF_LINK_UPDATE.
> + */

[Severity: Low]
This isn't a bug, but does this multi-line comment follow the preferred BPF
subsystem comment style? 

The BPF subsystem guidelines prefer the opening /* to be on its own line for
multi-line comments, with the comment text starting on the next line.

> +void test_xdp_dev_bound_only_link_update(void)
> +{
> +	LIBBPF_OPTS(bpf_link_create_opts, lopts, .flags = XDP_FLAGS_SKB_MODE);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260810050621.82035-1-jiayuan.chen@linux.dev?part=3

  reply	other threads:[~2026-08-10  5:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10  5:05 [PATCH bpf-next v4 0/3] bpf: prevent offloaded programs from running on host via tcx/netkit Jiayuan Chen
2026-08-10  5:05 ` [PATCH bpf-next v4 1/3] bpf, tcx, netkit: reject offloaded programs Jiayuan Chen
2026-08-10  5:06 ` [PATCH bpf-next v4 2/3] bpf, xdp: move offload check into dev_xdp_install() Jiayuan Chen
2026-08-10 18:49   ` Jakub Kicinski
2026-08-11  3:06     ` Jiayuan Chen
2026-08-10  5:06 ` [PATCH bpf-next v4 3/3] selftests/bpf: xdp: test dev_xdp_install() rejects device-bound program Jiayuan Chen
2026-08-10  5:23   ` sashiko-bot [this message]
2026-08-10  6:30   ` bot+bpf-ci

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=20260810052345.E16C51F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=jiayuan.chen@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