From: sashiko-bot@kernel.org
To: "Daniel Borkmann" <daniel@iogearbox.net>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net 3/3] selftests/bpf: Add test for redirect from qdisc qevent block
Date: Wed, 01 Jul 2026 12:33:38 +0000 [thread overview]
Message-ID: <20260701123339.522481F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260630123331.186840-4-daniel@iogearbox.net>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The test is flaky due to a race condition with asynchronous ARP resolution.
- [Low] Semantically incorrect use of the tcx-specific constant `TCX_REDIRECT` in a legacy `cls_bpf` program.
--
commit fc8f69a4140a0efbcb7d3933eb46154533713ffc
Author: Daniel Borkmann <daniel@iogearbox.net>
selftests/bpf: Add test for redirect from qdisc qevent block
This commit adds a regression test for a NULL current->bpf_net_context
dereference. It verifies the behavior when a BPF classifier attached to
a qdisc qevent block asks for a redirect.
> diff --git a/tools/testing/selftests/bpf/prog_tests/tc_qevent.c b/tools/testing/selftests/bpf/prog_tests/tc_qevent.c
> new file mode 100644
> index 0000000000000..67e1d17567abd
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/tc_qevent.c
> @@ -0,0 +1,113 @@
[ ... ]
> +static void blast_udp(void)
> +{
[ ... ]
> + /*
> + * Push far more than the RED queue can hold. Once qavg crosses qth_min
> + * every further packet hits the congestion_drop / early_drop qevent.
> + */
> + for (i = 0; i < 50000; i++)
> + sendto(fd, buf, sizeof(buf), MSG_DONTWAIT,
> + (struct sockaddr *)&dst, sizeof(dst));
> +
> + close(fd);
> +}
[ ... ]
> +static void run_qevent_redirect(struct bpf_program *prog, __u64 *counter)
> +{
[ ... ]
> + if (system("tc filter add block 10 bpf da object-pinned "
> + PIN_PATH " 2>/dev/null")) {
> + test__skip();
> + goto close_ns;
> + }
> +
> + blast_udp();
> + ASSERT_GT(*counter, 0, "qevent classifier ran");
[Severity: Medium]
Since static ARP entries are not configured, could this lead to a flaky test
due to a race condition with asynchronous ARP resolution?
When blast_udp() loops through sendto(), the first packets might trigger an
ARP request while the rest get dropped or queued by the neighbor layer before
reaching the RED qdisc.
Because ASSERT_GT() is checked immediately after blast_udp(), is it possible
the check evaluates before the network stack finishes processing the ARP
reply, leaving the qdisc with no packets and causing the test to fail?
> diff --git a/tools/testing/selftests/bpf/progs/test_tc_qevent.c b/tools/testing/selftests/bpf/progs/test_tc_qevent.c
> new file mode 100644
> index 0000000000000..1529c111f4aa4
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/test_tc_qevent.c
> @@ -0,0 +1,23 @@
[ ... ]
> +SEC("tc")
> +int qevent_redirect_verdict(struct __sk_buff *skb)
> +{
> + __sync_fetch_and_add(&verdict_calls, 1);
> + return TCX_REDIRECT;
> +}
[Severity: Low]
Is it correct to return the TCX_REDIRECT constant here?
Since this program is attached using the legacy cls_bpf via tc filter add bpf
da in run_qevent_redirect(), shouldn't it return standard TC_ACT_* return
codes like TC_ACT_REDIRECT?
They both evaluate to 7 so it functions correctly, but mixing the newer TCX
framework constants in a legacy program might cause API confusion.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260630123331.186840-1-daniel@iogearbox.net?part=3
next prev parent reply other threads:[~2026-07-01 12:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 12:33 [PATCH net 0/3] Fix broken TC_ACT_REDIRECT from qdiscs Daniel Borkmann
2026-06-30 12:33 ` [PATCH net 1/3] bpf: Reject redirect helpers without a bpf_net_context Daniel Borkmann
2026-06-30 12:33 ` [PATCH net 2/3] net/sched: Handle TC_ACT_REDIRECT from qdisc filter chains Daniel Borkmann
2026-06-30 15:16 ` Jamal Hadi Salim
2026-06-30 15:23 ` Daniel Borkmann
2026-07-01 15:35 ` Jamal Hadi Salim
2026-07-01 12:33 ` sashiko-bot
2026-07-01 13:07 ` Daniel Borkmann
2026-06-30 12:33 ` [PATCH net 3/3] selftests/bpf: Add test for redirect from qdisc qevent block Daniel Borkmann
2026-07-01 12:33 ` sashiko-bot [this message]
2026-07-01 13:20 ` Daniel Borkmann
2026-06-30 14:37 ` [PATCH net 0/3] Fix broken TC_ACT_REDIRECT from qdiscs Sebastian Andrzej Siewior
2026-06-30 15:09 ` Daniel Borkmann
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=20260701123339.522481F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--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