* [PATCH] fq_codel: Discard problematic packets with pkt_len 0
@ 2022-06-10 7:05 Di Zhu
2022-06-10 7:32 ` Eric Dumazet
0 siblings, 1 reply; 4+ messages in thread
From: Di Zhu @ 2022-06-10 7:05 UTC (permalink / raw)
To: jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni
Cc: netdev, linux-kernel, zhudi2, rose.chen, syzbot+7a12909485b94426aceb
Syzbot found an issue [1]: fq_codel_drop() try to drop a flow whitout any
skbs, that is, the flow->head is null.
The root cause is that: when the first queued skb with pkt_len 0, backlogs
of the flow that this skb enqueued is still 0 and if sch->limit is set to
0 then fq_codel_drop() will be called. At this point, the backlogs of all
flows are all 0, so flow with idx 0 is selected to drop, but this flow have
not any skbs.
skb with pkt_len 0 can break existing processing logic, so just discard
these invalid skbs.
LINK: [1] https://syzkaller.appspot.com/bug?id=0b84da80c2917757915afa89f7738a9d16ec96c5
Reported-by: syzbot+7a12909485b94426aceb@syzkaller.appspotmail.com
Signed-off-by: Di Zhu <zhudi2@huawei.com>
---
net/sched/sch_fq_codel.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
index 839e1235db05..c0f82b7358e1 100644
--- a/net/sched/sch_fq_codel.c
+++ b/net/sched/sch_fq_codel.c
@@ -191,6 +191,9 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch,
unsigned int pkt_len;
bool memory_limited;
+ if (unlikely(!qdisc_pkt_len(skb)))
+ return qdisc_drop(skb, sch, to_free);
+
idx = fq_codel_classify(skb, sch, &ret);
if (idx == 0) {
if (ret & __NET_XMIT_BYPASS)
--
2.27.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fq_codel: Discard problematic packets with pkt_len 0
2022-06-10 7:05 [PATCH] fq_codel: Discard problematic packets with pkt_len 0 Di Zhu
@ 2022-06-10 7:32 ` Eric Dumazet
2022-06-10 7:35 ` Eric Dumazet
0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2022-06-10 7:32 UTC (permalink / raw)
To: Di Zhu
Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, David Miller,
Jakub Kicinski, Paolo Abeni, netdev, LKML, rose.chen,
syzbot+7a12909485b94426aceb
On Fri, Jun 10, 2022 at 12:07 AM Di Zhu <zhudi2@huawei.com> wrote:
>
> Syzbot found an issue [1]: fq_codel_drop() try to drop a flow whitout any
> skbs, that is, the flow->head is null.
> The root cause is that: when the first queued skb with pkt_len 0, backlogs
> of the flow that this skb enqueued is still 0 and if sch->limit is set to
> 0 then fq_codel_drop() will be called. At this point, the backlogs of all
> flows are all 0, so flow with idx 0 is selected to drop, but this flow have
> not any skbs.
> skb with pkt_len 0 can break existing processing logic, so just discard
> these invalid skbs.
>
> LINK: [1] https://syzkaller.appspot.com/bug?id=0b84da80c2917757915afa89f7738a9d16ec96c5
>
> Reported-by: syzbot+7a12909485b94426aceb@syzkaller.appspotmail.com
> Signed-off-by: Di Zhu <zhudi2@huawei.com>
> ---
> net/sched/sch_fq_codel.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
> index 839e1235db05..c0f82b7358e1 100644
> --- a/net/sched/sch_fq_codel.c
> +++ b/net/sched/sch_fq_codel.c
> @@ -191,6 +191,9 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch,
> unsigned int pkt_len;
> bool memory_limited;
>
> + if (unlikely(!qdisc_pkt_len(skb)))
> + return qdisc_drop(skb, sch, to_free);
> +
This has been discussed in the past.
Feeding ndo_start_xmit() in hundreds of drivers with zero-length
packets will crash anyway.
We are not going to add such silly tests in all qdiscs, and then all
ndo_start_xmit(), since qdiscs are not mandatory.
Please instead fix BPF layer, instead of hundreds of drivers/qdiscs.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fq_codel: Discard problematic packets with pkt_len 0
2022-06-10 7:32 ` Eric Dumazet
@ 2022-06-10 7:35 ` Eric Dumazet
2022-06-10 7:37 ` 答复: " zhudi (E)
0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2022-06-10 7:35 UTC (permalink / raw)
To: Di Zhu
Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, David Miller,
Jakub Kicinski, Paolo Abeni, netdev, LKML, rose.chen,
syzbot+7a12909485b94426aceb
On Fri, Jun 10, 2022 at 12:32 AM Eric Dumazet <edumazet@google.com> wrote:
>
> On Fri, Jun 10, 2022 at 12:07 AM Di Zhu <zhudi2@huawei.com> wrote:
> >
> > Syzbot found an issue [1]: fq_codel_drop() try to drop a flow whitout any
> > skbs, that is, the flow->head is null.
> > The root cause is that: when the first queued skb with pkt_len 0, backlogs
> > of the flow that this skb enqueued is still 0 and if sch->limit is set to
> > 0 then fq_codel_drop() will be called. At this point, the backlogs of all
> > flows are all 0, so flow with idx 0 is selected to drop, but this flow have
> > not any skbs.
> > skb with pkt_len 0 can break existing processing logic, so just discard
> > these invalid skbs.
> >
> > LINK: [1] https://syzkaller.appspot.com/bug?id=0b84da80c2917757915afa89f7738a9d16ec96c5
> >
> > Reported-by: syzbot+7a12909485b94426aceb@syzkaller.appspotmail.com
> > Signed-off-by: Di Zhu <zhudi2@huawei.com>
> > ---
> > net/sched/sch_fq_codel.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
> > index 839e1235db05..c0f82b7358e1 100644
> > --- a/net/sched/sch_fq_codel.c
> > +++ b/net/sched/sch_fq_codel.c
> > @@ -191,6 +191,9 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch,
> > unsigned int pkt_len;
> > bool memory_limited;
> >
> > + if (unlikely(!qdisc_pkt_len(skb)))
> > + return qdisc_drop(skb, sch, to_free);
> > +
>
>
> This has been discussed in the past.
>
https://www.spinics.net/lists/netdev/msg777503.html
> Feeding ndo_start_xmit() in hundreds of drivers with zero-length
> packets will crash anyway.
>
> We are not going to add such silly tests in all qdiscs, and then all
> ndo_start_xmit(), since qdiscs are not mandatory.
>
> Please instead fix BPF layer, instead of hundreds of drivers/qdiscs.
^ permalink raw reply [flat|nested] 4+ messages in thread
* 答复: [PATCH] fq_codel: Discard problematic packets with pkt_len 0
2022-06-10 7:35 ` Eric Dumazet
@ 2022-06-10 7:37 ` zhudi (E)
0 siblings, 0 replies; 4+ messages in thread
From: zhudi (E) @ 2022-06-10 7:37 UTC (permalink / raw)
To: Eric Dumazet
Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, David Miller,
Jakub Kicinski, Paolo Abeni, netdev, LKML, Chenxiang (EulerOS),
syzbot+7a12909485b94426aceb
Thanks Eric, I'll take a look.
> On Fri, Jun 10, 2022 at 12:32 AM Eric Dumazet <edumazet@google.com> wrote:
> >
> > On Fri, Jun 10, 2022 at 12:07 AM Di Zhu <zhudi2@huawei.com> wrote:
> > >
> > > Syzbot found an issue [1]: fq_codel_drop() try to drop a flow whitout any
> > > skbs, that is, the flow->head is null.
> > > The root cause is that: when the first queued skb with pkt_len 0, backlogs
> > > of the flow that this skb enqueued is still 0 and if sch->limit is set to
> > > 0 then fq_codel_drop() will be called. At this point, the backlogs of all
> > > flows are all 0, so flow with idx 0 is selected to drop, but this flow have
> > > not any skbs.
> > > skb with pkt_len 0 can break existing processing logic, so just discard
> > > these invalid skbs.
> > >
> > > LINK: [1]
> https://syzkaller.appspot.com/bug?id=0b84da80c2917757915afa89f7738a9d16e
> c96c5
> > >
> > > Reported-by: syzbot+7a12909485b94426aceb@syzkaller.appspotmail.com
> > > Signed-off-by: Di Zhu <zhudi2@huawei.com>
> > > ---
> > > net/sched/sch_fq_codel.c | 3 +++
> > > 1 file changed, 3 insertions(+)
> > >
> > > diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
> > > index 839e1235db05..c0f82b7358e1 100644
> > > --- a/net/sched/sch_fq_codel.c
> > > +++ b/net/sched/sch_fq_codel.c
> > > @@ -191,6 +191,9 @@ static int fq_codel_enqueue(struct sk_buff *skb,
> struct Qdisc *sch,
> > > unsigned int pkt_len;
> > > bool memory_limited;
> > >
> > > + if (unlikely(!qdisc_pkt_len(skb)))
> > > + return qdisc_drop(skb, sch, to_free);
> > > +
> >
> >
> > This has been discussed in the past.
> >
>
> https://www.spinics.net/lists/netdev/msg777503.html
>
> > Feeding ndo_start_xmit() in hundreds of drivers with zero-length
> > packets will crash anyway.
> >
> > We are not going to add such silly tests in all qdiscs, and then all
> > ndo_start_xmit(), since qdiscs are not mandatory.
> >
> > Please instead fix BPF layer, instead of hundreds of drivers/qdiscs.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-06-10 7:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 7:05 [PATCH] fq_codel: Discard problematic packets with pkt_len 0 Di Zhu
2022-06-10 7:32 ` Eric Dumazet
2022-06-10 7:35 ` Eric Dumazet
2022-06-10 7:37 ` 答复: " zhudi (E)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®