From: Cong Wang <xiyou.wangcong@gmail.com>
To: William Liu <will@willsroot.io>
Cc: netdev@vger.kernel.org, jhs@mojatatu.com, victor@mojatatu.com,
pctammela@mojatatu.com, pabeni@redhat.com, kuba@kernel.org,
stephen@networkplumber.org, dcaratti@redhat.com,
savy@syst3mfailure.io, jiri@resnulli.us, davem@davemloft.net,
edumazet@google.com, horms@kernel.org,
linux-kernel@vger.kernel.org
Subject: This breaks netem use cases
Date: Tue, 8 Jul 2025 12:42:38 -0700 [thread overview]
Message-ID: <aG10rqwjX6elG1Gx@pop-os.localdomain> (raw)
In-Reply-To: <20250708164141.875402-1-will@willsroot.io>
(Cc LKML for more audience, since this clearly breaks potentially useful
use cases)
On Tue, Jul 08, 2025 at 04:43:26PM +0000, William Liu wrote:
> netem_enqueue's duplication prevention logic breaks when a netem
> resides in a qdisc tree with other netems - this can lead to a
> soft lockup and OOM loop in netem_dequeue, as seen in [1].
> Ensure that a duplicating netem cannot exist in a tree with other
> netems.
As I already warned in your previous patchset, this breaks the following
potentially useful use case:
sudo tc qdisc add dev eth0 root handle 1: mq
sudo tc qdisc add dev eth0 parent 1:1 handle 10: netem duplicate 100%
sudo tc qdisc add dev eth0 parent 1:2 handle 20: netem duplicate 100%
I don't see any logical problem of such use case, therefore we should
consider it as valid, we can't break it.
>
> Previous approaches suggested in discussions in chronological order:
>
> 1) Track duplication status or ttl in the sk_buff struct. Considered
> too specific a use case to extend such a struct, though this would
> be a resilient fix and address other previous and potential future
> DOS bugs like the one described in loopy fun [2].
The link you provid is from 8 years ago, since then the redirection
logic has been improved. I am not sure why it helps to justify your
refusal of this approach.
I also strongly disagree with "too specific a use case to extend such
a struct", we simply have so many use-case-specific fields within
sk_buff->cb. For example, the tc_skb_cb->zone is very specific
for act_ct.
skb->cb is precisely designed to be use-case-specific and layer-specific.
None of the above points stands.
>
> 2) Restrict netem_enqueue recursion depth like in act_mirred with a
> per cpu variable. However, netem_dequeue can call enqueue on its
> child, and the depth restriction could be bypassed if the child is a
> netem.
>
> 3) Use the same approach as in 2, but add metadata in netem_skb_cb
> to handle the netem_dequeue case and track a packet's involvement
> in duplication. This is an overly complex approach, and Jamal
> notes that the skb cb can be overwritten to circumvent this
> safeguard.
This is not true, except qdisc_skb_cb(skb)->data, other area of
skb->cb is preserved within Qdisc layer.
Based on the above reasoning, this is clearly no way to go:
NACK-by: Cong Wang <xiyou.wangcong@gmail.com>
Sorry for standing firmly for the users, we simply don't break use
cases. This is nothing personal, just a firm principle.
Please let me know if there is anything else I can help you with. I am
always ready to help (but not in a way of breaking use cases).
Thanks for your understanding!
next prev parent reply other threads:[~2025-07-08 19:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-08 16:43 [PATCH net v5 1/2] net/sched: Restrict conditions for adding duplicating netems to qdisc tree William Liu
2025-07-08 16:44 ` [PATCH net v5 2/2] selftests/tc-testing: Add tests for restrictions on netem duplication William Liu
2025-07-08 18:50 ` Jamal Hadi Salim
2025-07-08 18:50 ` [PATCH net v5 1/2] net/sched: Restrict conditions for adding duplicating netems to qdisc tree Jamal Hadi Salim
2025-07-08 19:42 ` Cong Wang [this message]
2025-07-08 20:35 ` This breaks netem use cases Jamal Hadi Salim
2025-07-08 21:32 ` Cong Wang
2025-07-08 22:26 ` Jamal Hadi Salim
2025-07-08 22:45 ` Stephen Hemminger
2025-07-11 5:19 ` Cong Wang
2025-07-10 8:26 ` Paolo Abeni
2025-07-11 5:44 ` Cong Wang
2025-07-11 22:55 ` [PATCH net v5 1/2] net/sched: Restrict conditions for adding duplicating netems to qdisc tree Jakub Kicinski
2025-07-12 16:51 ` William Liu
2025-07-14 14:58 ` Jakub Kicinski
2025-07-11 23:00 ` patchwork-bot+netdevbpf
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=aG10rqwjX6elG1Gx@pop-os.localdomain \
--to=xiyou.wangcong@gmail.com \
--cc=davem@davemloft.net \
--cc=dcaratti@redhat.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pctammela@mojatatu.com \
--cc=savy@syst3mfailure.io \
--cc=stephen@networkplumber.org \
--cc=victor@mojatatu.com \
--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