BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jakub Sitnicki" <jakub@cloudflare.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next 06/14] selftests/bpf: Test skb_ext survival across veth and GRE
Date: Sat, 15 Aug 2026 08:14:52 +0000	[thread overview]
Message-ID: <20260815081453.5BC451F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260814-bpf-meta-inside-skb-ext-v1-6-767edd862656@cloudflare.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Incorrect assertions for if_nametoindex() return values allow errors to pass silently.
--

--- Patch [6]: [PATCH net-next 06/14] selftests/bpf: Test skb_ext survival across veth and GRE ---
commit 9eef2d71b261cfaa465a5233213fb272dc34f416
Author: Jakub Sitnicki <jakub@cloudflare.com>

selftests/bpf: Test skb_ext survival across veth and GRE
    
This commit tests if skb_ext survives veth cross-netns forwarding and GRE
encap/decap. It writes skb_ext at TC egress and reads it back at TC ingress
after the packet crosses device boundaries.

> diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c b/tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c
> index 58b793cf14e59..de60303025361 100644
> --- a/tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c
> +++ b/tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c

[ ... ]

> @@ -783,6 +783,156 @@ static void test_mirred_clone_ext_cow(struct test_xdp_meta *skel)
> +/* Test if skb_ext survives veth cross-netns forward */
> +static void test_skb_ext_scrub_veth(struct test_xdp_meta *skel)
> +{

[ ... ]

> +	SYS(close, "ip link set dev " RX_NAME " up");
> +
> +	rx_ifindex = if_nametoindex(RX_NAME);
> +	if (!ASSERT_GE(rx_ifindex, 0, "if_nametoindex rx"))
> +		goto close;

[Severity: Low]
Does this code correctly catch interface lookup failures?

Since if_nametoindex() returns 0 on failure, the ASSERT_GE(rx_ifindex, 0, ...)
check will evaluate 0 >= 0 as true, failing to catch the error. The test will
instead fail slightly later with a less descriptive error. 

Should this be using ASSERT_GT() or ASSERT_NEQ() instead?

[ ... ]

> +	SYS(close, "ip link set dev " TX_NAME " up");
> +
> +	tx_ifindex = if_nametoindex(TX_NAME);
> +	if (!ASSERT_GE(tx_ifindex, 0, "if_nametoindex tx"))
> +		goto close;

[Severity: Low]
Is this the same issue here? if_nametoindex() returning 0 would bypass this
ASSERT_GE check.

[ ... ]

> +/* Test if skb_ext survives GRE tunnel encap+decap */
> +static void test_skb_ext_scrub_gre(struct test_xdp_meta *skel)
> +{

[ ... ]

> +	/* Write skb_ext on TC egress on GRE tx */
> +	tx_ifindex = if_nametoindex("gre_tx");
> +	if (!ASSERT_GE(tx_ifindex, 0, "tx_ifindex"))
> +		goto close;

[Severity: Low]
Is this the same issue here as well?

[ ... ]

> +	/* Read skb_ext on TC ingress on GRE rx */
> +	rx_ifindex = if_nametoindex("gre_rx");
> +	if (!ASSERT_GE(rx_ifindex, 0, "rx_ifindex"))
> +		goto close;

[Severity: Low]
And one more instance here where ASSERT_GE allows if_nametoindex() failure
to pass silently.

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260814-bpf-meta-inside-skb-ext-v1-0-767edd862656@cloudflare.com?part=6

  reply	other threads:[~2026-08-15  8:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14  8:14 [PATCH net-next 00/14] skb extension for BPF metadata Jakub Sitnicki
2026-08-14  8:14 ` [PATCH net-next 01/14] bpf: Introduce per-packet metadata storage for BPF programs Jakub Sitnicki
2026-08-15  8:14   ` sashiko-bot
2026-08-14  8:14 ` [PATCH net-next 02/14] bpf: Allow access to bpf_sock_ops_kern->skb Jakub Sitnicki
2026-08-14  8:14 ` [PATCH net-next 03/14] bpf: Make BPF skb extension survive packet scrubbing Jakub Sitnicki
2026-08-15  8:14   ` sashiko-bot
2026-08-14  8:14 ` [PATCH net-next 04/14] selftests/bpf: Add tests for bpf_dynptr_from_skb_ext Jakub Sitnicki
2026-08-15  8:14   ` sashiko-bot
2026-08-14  8:14 ` [PATCH net-next 05/14] selftests/bpf: Test skb_ext on cloned skbs Jakub Sitnicki
2026-08-15  8:14   ` sashiko-bot
2026-08-14  8:14 ` [PATCH net-next 06/14] selftests/bpf: Test skb_ext survival across veth and GRE Jakub Sitnicki
2026-08-15  8:14   ` sashiko-bot [this message]
2026-08-14  8:14 ` [PATCH net-next 07/14] selftests/bpf: Test skb_ext read from cgroup_skb and sk_filter hooks Jakub Sitnicki
2026-08-15  8:14   ` sashiko-bot
2026-08-14  8:14 ` [PATCH net-next 08/14] selftests/bpf: Test skb_ext read from sock_ops and LSM hooks Jakub Sitnicki
2026-08-15  8:14   ` sashiko-bot
2026-08-14  8:14 ` [PATCH net-next 09/14] selftests/bpf: Test skb_ext read from kfree_skb tracepoint Jakub Sitnicki
2026-08-15  8:14   ` sashiko-bot
2026-08-14  8:14 ` [PATCH net-next 10/14] selftests/bpf: Test skb_ext read from netfilter hook Jakub Sitnicki
2026-08-14  8:14 ` [PATCH net-next 11/14] selftests/bpf: Test skb_ext from LWT in, out, and xmit hooks Jakub Sitnicki
2026-08-15  8:14   ` sashiko-bot
2026-08-14  8:14 ` [PATCH net-next 12/14] selftests/bpf: Test skb_ext read from seg6local End.BPF hook Jakub Sitnicki
2026-08-15  8:14   ` sashiko-bot
2026-08-14  8:14 ` [PATCH net-next 13/14] selftests/bpf: Test skb_ext read from sk_skb stream verdict hook Jakub Sitnicki
2026-08-15  8:14   ` sashiko-bot
2026-08-14  8:14 ` [PATCH net-next 14/14] selftests/bpf: Use non-trivial test payload in xdp_context tests Jakub Sitnicki

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=20260815081453.5BC451F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=jakub@cloudflare.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