[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1tUrbP9EoC0snDQNBB8x_nmT2z1xjeEpsxnfS98xVcYAtGaJ6XWpUw6pHmCiC8f4c6WwcRpFMPIOivnco0aR8ZnVp2dC2lZyzgXzg7b8qDE=@willsroot.io>
Date: Wed, 02 Jul 2025 15:20:50 +0000
From: William Liu <will@...lsroot.io>
To: Jamal Hadi Salim <jhs@...atatu.com>
Cc: Cong Wang <xiyou.wangcong@...il.com>, netdev@...r.kernel.org, stephen@...workplumber.org, Savino Dicanosa <savy@...t3mfailure.io>
Subject: Re: [Patch net 1/2] netem: Fix skb duplication logic to prevent infinite loops
On Wednesday, July 2nd, 2025 at 3:06 PM, Jamal Hadi Salim <jhs@...atatu.com> wrote:
>
>
> On Wed, Jul 2, 2025 at 11:04 AM Jamal Hadi Salim jhs@...atatu.com wrote:
>
> > On Wed, Jul 2, 2025 at 10:12 AM Jamal Hadi Salim jhs@...atatu.com wrote:
> >
> > > On Tue, Jul 1, 2025 at 9:57 PM Cong Wang xiyou.wangcong@...il.com wrote:
> > >
> > > > On Tue, Jul 01, 2025 at 04:13:05PM -0700, Cong Wang wrote:
> > > >
> > > > > diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
> > > > > index fdd79d3ccd8c..33de9c3e4d1b 100644
> > > > > --- a/net/sched/sch_netem.c
> > > > > +++ b/net/sched/sch_netem.c
> > > > > @@ -460,7 +460,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
> > > > > skb->prev = NULL;
> > > > >
> > > > > /* Random duplication */
> > > > > - if (q->duplicate && q->duplicate >= get_crandom(&q->dup_cor, &q->prng))
> > > > > + if (tc_skb_cb(skb)->duplicate &&
> > > >
> > > > Oops, this is clearly should be !duplicate... It was lost during my
> > > > stupid copy-n-paste... Sorry for this mistake.
> > >
> > > I understood you earlier, Cong. My view still stands:
> > > You are adding logic to a common data structure for a use case that
> > > really makes no sense. The ROI is not good.
> > > BTW: I am almost certain you will hit other issues when this goes out
> > > or when you actually start to test and then you will have to fix more
> > > spots.
> >
> > Here's an example that breaks it:
> >
> > sudo 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
> > sudo tc filter add dev lo parent 1:0 protocol ip bpf obj
> > netem_bug_test.o sec classifier/pass classid 1:1
> > sudo tc qdisc add dev lo parent 1:1 handle 10: netem limit 4 duplicate 100%
> > sudo tc qdisc add dev lo parent 10: handle 30: netem gap 1 limit 4
> > duplicate 100% delay 1us reorder 100%
> >
> > And the ping 127.0.0.1 -c 1
> > I had to fix your patch for correctness (attached)
> >
> > the ebpf prog is trivial - make it just return the classid or even zero.
> >
> > William, as a middle ground can you take a crack at using cb_ext -
> > take a look for example at struct tc_skb_ext_alloc in cls_api.c (that
> > one is safe to extend).
>
> Meant: struct tc_skb_ext *ex
>
> If you need help ping me privately - some latency will be involved..
>
> cheers,
> jamal
Sure, I can take a crack at it in the upcoming days.
Best,
Will
Powered by blists - more mailing lists