public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, andrew+netdev@lunn.ch,
	netdev@vger.kernel.org, xiyou.wangcong@gmail.com,
	jiri@resnulli.us, victor@mojatatu.com, dcaratti@redhat.com,
	lariel@nvidia.com, daniel@iogearbox.net, pablo@netfilter.org,
	kadlec@netfilter.org, fw@strlen.de, phil@nwl.cc,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	zyc199902@zohomail.cn, lrGerlinde@mailfence.com,
	jschung2@proton.me
Subject: Re: [PATCH net 0/6] net/sched: Fix packet loops in mirred and netem
Date: Mon, 12 Jan 2026 22:20:17 -0800	[thread overview]
Message-ID: <20260112222017.3d1da4c9@phoenix.local> (raw)
In-Reply-To: <20260111163947.811248-1-jhs@mojatatu.com>

On Sun, 11 Jan 2026 11:39:41 -0500
Jamal Hadi Salim <jhs@mojatatu.com> wrote:

> We introduce a 2-bit global skb->ttl counter.Patch #1 describes how we puti
> together those bits. Patches #2 and patch #5 use these bits.
> I added Fixes tags to patch #1 in case it is useful for backporting.
> Patch #3 and #4 revert William's earlier netem commits. Patch #6 introduces
> tdc test cases.
> 
> Jamal Hadi Salim (5):
>   net: Introduce skb ttl field to track packet loops
>   net/sched: Fix ethx:ingress -> ethy:egress -> ethx:ingress mirred loop
>   Revert "net/sched: Restrict conditions for adding duplicating netems
>     to qdisc tree"
>   Revert "selftests/tc-testing: Add tests for restrictions on netem
>     duplication"
>   net/sched: fix packet loop on netem when duplicate is on
> 
> Victor Nogueira (1):
>   selftests/tc-testing: Add netem/mirred test cases exercising loops
> 
>  drivers/net/ifb.c                             |   2 +-
>  include/linux/skbuff.h                        |  24 +-
>  include/net/sch_generic.h                     |  22 +
>  net/netfilter/nft_fwd_netdev.c                |   1 +
>  net/sched/act_mirred.c                        |  45 +-
>  net/sched/sch_netem.c                         |  47 +-
>  .../tc-testing/tc-tests/actions/mirred.json   | 616 +++++++++++++++++-
>  .../tc-testing/tc-tests/infra/qdiscs.json     |   5 +-
>  .../tc-testing/tc-tests/qdiscs/netem.json     |  96 +--
>  9 files changed, 698 insertions(+), 160 deletions(-)
>

Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>

This is a complex patch series so I decided to get a second opinion using AI.
It is worth reading (but not completely trusting). Review prompt is Chris Mason's
Claude review prompts.


Summary: Patch Series Analysis
Patches Reviewed
6-patch series from Jamal Hadi Salim fixing loop detection in mirred and netem:

Patch 1/6: Introduces skb->ttl (2-bit field) for cross-deferral loop tracking, moves from_ingress to qdisc_skb_cb
Patch 2/6: Fixes mirred ingress→egress→ingress loop detection using ttl
Patch 3/6: Reverts netem duplication restrictions (preparation for proper fix)
Patch 4/6: Reverts associated selftests
Patch 5/6: Fixes netem duplicate infinite loop using ttl
Patch 6/6: (Email thread discussion, not code)

Key Findings
No regressions identified. The analysis covered:
AreaResultSKB structure change (ttl field)✓ Safe - properly initialized via zeroingfrom_ingress relocation✓ Safe - written immediately before readLoop detection logic✓ Correct - ttl tracks across async boundariesNetem duplicate fix✓ Improvement over old q->duplicate hackLocking✓ Correct softirq/per-cpu patternsResource management✓ No leaks identified
Design Assessment
The approach is sound:

Egress paths: Continue using per-cpu sched_mirred_dev[] array for immediate loop detection
Ingress paths: Use skb->ttl to track loops across netif_rx() deferral boundaries
Netem: ttl-based dup prevention works across entire qdisc tree (better than old local-only fix)

Recommendation
Yes, the patch is OK to merge.
The series correctly fixes real bugs (CVE-worthy loop conditions) with a minimal, well-designed solution. The 2-bit ttl field is sufficient for the use case (limit of 3 ingress redirects), and the changes maintain backward compatibility for existing configurations while closing the loop detection gaps.

  parent reply	other threads:[~2026-01-13  6:20 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-11 16:39 [PATCH net 0/6] net/sched: Fix packet loops in mirred and netem Jamal Hadi Salim
2026-01-11 16:39 ` [PATCH net 1/6] net: Introduce skb ttl field to track packet loops Jamal Hadi Salim
2026-01-13 19:44   ` Cong Wang
2026-01-11 16:39 ` [PATCH net 2/6] net/sched: Fix ethx:ingress -> ethy:egress -> ethx:ingress mirred loop Jamal Hadi Salim
2026-01-11 16:39 ` [PATCH net 3/6] Revert "net/sched: Restrict conditions for adding duplicating netems to qdisc tree" Jamal Hadi Salim
2026-01-11 16:39 ` [PATCH net 4/6] Revert "selftests/tc-testing: Add tests for restrictions on netem duplication" Jamal Hadi Salim
2026-01-11 16:39 ` [PATCH net 5/6] net/sched: fix packet loop on netem when duplicate is on Jamal Hadi Salim
2026-01-11 20:22   ` William Liu
2026-01-11 20:39   ` Cong Wang
2026-01-11 21:56     ` Jamal Hadi Salim
2026-01-13 19:32       ` Cong Wang
2026-01-11 16:39 ` [PATCH net 6/6] selftests/tc-testing: Add netem/mirred test cases exercising loops Jamal Hadi Salim
2026-01-13  6:20 ` Stephen Hemminger [this message]
2026-01-13 19:35   ` [PATCH net 0/6] net/sched: Fix packet loops in mirred and netem Cong Wang
2026-01-13 20:10 ` Cong Wang
2026-01-14 16:33   ` Jamal Hadi Salim
2026-01-15 20:16     ` Cong Wang
2026-01-16 15:04       ` Jamal Hadi Salim
2026-01-14  2:07 ` Jakub Kicinski
2026-01-14 16:40   ` Jamal Hadi Salim
2026-01-15  3:28     ` Jakub Kicinski
2026-01-15 10:22 ` Paolo Abeni
2026-01-15 14:32   ` Jamal Hadi Salim
2026-01-29  5:06     ` Willem de Bruijn
2026-01-29 21:22       ` Jamal Hadi Salim
2026-02-28 13:05         ` Jamal Hadi Salim

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=20260112222017.3d1da4c9@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=coreteam@netfilter.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dcaratti@redhat.com \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=jschung2@proton.me \
    --cc=kadlec@netfilter.org \
    --cc=kuba@kernel.org \
    --cc=lariel@nvidia.com \
    --cc=lrGerlinde@mailfence.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=phil@nwl.cc \
    --cc=victor@mojatatu.com \
    --cc=xiyou.wangcong@gmail.com \
    --cc=zyc199902@zohomail.cn \
    /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