public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: William Liu <will@willsroot.io>
Cc: netdev@vger.kernel.org, stephen@networkplumber.org,
	kuba@kernel.org, Savino Dicanosa <savy@syst3mfailure.io>,
	Jamal Hadi Salim <jhs@mojatatu.com>
Subject: Re: [Patch net v5 3/9] net_sched: Implement the right netem duplication behavior
Date: Wed, 26 Nov 2025 19:01:53 -0800	[thread overview]
Message-ID: <aSe/IfNSZBTTAfTA@pop-os.localdomain> (raw)
In-Reply-To: <mz8HnpeShmNHFgeE6yoGG_gb5l1mHqvNee9aRtGX6yTz5zDvf2I4U1wKtH9k5qkfz0SfUfhsonzrzDSgvyM9vRRyvktvYwtTHvfmcZK_Sp8=@willsroot.io>

On Thu, Nov 27, 2025 at 02:09:58AM +0000, William Liu wrote:
> On Wednesday, November 26th, 2025 at 11:13 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> 
> > Again, it does not violate the man page. What standard are you referring
> > to when you say "expected user behavior"? Please kindly point me to the
> > standard you refer here, I am happy to look into it.
> 
> I meant long-time existing user-observable behavior (since 2005).

If you believe this does not violate man page, then it is safe.

Otherwise, please be specific on how it violates man page. There is only
one sentence in the man page: "creates a copy of the packet before queuing."
Let's reduce it down to two words: "before queuing", please kindly point out
which word my patch violates. I am happy to consider your opinion, but
only when you are willing to help.

Keep saying long-time or user-expected does not help anything here, man
page is the only "contract" we have with the users.

> 
> If you were just trying to fix the bug, then a fix that prevents DOS and changes no existing observable behavior is better imo.

The problematic behavior of duplication is the root cause. So, we can't
fix the bug without fixing the root cause.

Let's put security aside, it is still problematic logically. There is no
way to define a logiclly correct behavior with queuing back to root.

Since you ignored my 3-page long changelog, let me copy-n-paste it for
your convenience:

   Single netem hierarchy (prio + netem):
      tc qdisc add dev lo root handle 1: prio bands 3 priomap 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
      tc filter add dev lo parent 1:0 protocol ip matchall classid 1:1
      tc qdisc add dev lo parent 1:1 handle 10: netem limit 4 duplicate 100%

    Result: 2x packet multiplication (1→2 packets)
      2 echo requests + 4 echo replies = 6 total packets

    Expected behavior: Only one netem stage exists in this hierarchy, so
    1 ping becomes 2 packets (100% duplication). The 2 echo requests generate
    2 echo replies, which also get duplicated to 4 replies, yielding the
    predictable total of 6 packets (2 requests + 4 replies).

    Nest netem hierarchy (netem + netem):
      tc qdisc add dev lo root handle 1: netem limit 1000 duplicate 100%
      tc qdisc add dev lo parent 1: handle 2: netem limit 1000 duplicate 100%

    Result: 4x packet multiplication (1→2→4 packets)
      4 echo requests + 16 echo replies = 20 total packets
 
If a netem clone is reinjected at the root, then each duplicate enters the
entire qdisc hierarchy again, so the clone becomes
an input to netem again, producing: 1 → 2 → 4 → 8 → …

This is no longer a single probability distribution; it becomes a cascade
of netem stages, even if you only configured one.

The behavior becomes structural, not probabilistic. Which is not what users
expect when they set duplicate 100%.

They intuitively expect:
- One duplication,
- One netem pass,
- No recursion.

This matches same-qdisc enqueueing.

This is why the right behavior matters for users, regardless of security
concern. Hence it must be corrected.

If any part of it is not clear, please let me know. I am very happy to
explain to you. If you need, we can have a video meeting too, happy to
walk you through this step-by-step.

Thanks,
Cong

  reply	other threads:[~2025-11-27  3:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-26 19:52 [Patch net v5 0/9] netem: Fix skb duplication logic and prevent infinite loops Cong Wang
2025-11-26 19:52 ` [Patch net v5 1/9] Revert "net/sched: Restrict conditions for adding duplicating netems to qdisc tree" Cong Wang
2025-11-26 19:52 ` [Patch net v5 2/9] Revert "selftests/tc-testing: Add tests for restrictions on netem duplication" Cong Wang
2025-11-26 19:52 ` [Patch net v5 3/9] net_sched: Implement the right netem duplication behavior Cong Wang
2025-11-26 20:30   ` William Liu
2025-11-26 22:08     ` Cong Wang
2025-11-26 22:43       ` William Liu
2025-11-26 23:13         ` Cong Wang
2025-11-27  2:09           ` William Liu
2025-11-27  3:01             ` Cong Wang [this message]
2025-12-03 15:05   ` Stephen Hemminger
2025-11-26 19:52 ` [Patch net v5 4/9] net_sched: Prevent using netem duplication in non-initial user namespace Cong Wang
2025-12-02  0:25   ` Jakub Kicinski
2025-12-03  5:41     ` Cong Wang
2025-12-02  0:40   ` Stephen Hemminger
2025-12-02  9:16   ` Paolo Abeni
2025-11-26 19:52 ` [Patch net v5 5/9] net_sched: Check the return value of qfq_choose_next_agg() Cong Wang
2025-12-02  9:20   ` Paolo Abeni
2025-12-03  5:42     ` Cong Wang
2025-12-02 21:18   ` Xiang Mei
2025-11-26 19:52 ` [Patch net v5 6/9] selftests/tc-testing: Add a nested netem duplicate test Cong Wang
2025-11-26 19:52 ` [Patch net v5 7/9] selftests/tc-testing: Add a test case for piro with netem duplicate Cong Wang
2025-11-26 19:52 ` [Patch net v5 8/9] selftests/tc-testing: Add a test case for mq " Cong Wang
2025-11-26 19:52 ` [Patch net v5 9/9] selftests/tc-testing: Update test cases " Cong Wang

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=aSe/IfNSZBTTAfTA@pop-os.localdomain \
    --to=xiyou.wangcong@gmail.com \
    --cc=jhs@mojatatu.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=savy@syst3mfailure.io \
    --cc=stephen@networkplumber.org \
    --cc=will@willsroot.io \
    /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