[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+FuTScZWjZ3wRbM0Bc-4cMhTxWQ4FjbCL8U+Lxt_zoYhBfVjQ@mail.gmail.com>
Date: Tue, 28 Jan 2020 10:00:47 -0500
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: Willem de Bruijn <willemdebruijn.kernel@...il.com>,
Network Development <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>,
syzbot <syzkaller@...glegroups.com>,
Steffen Klassert <steffen.klassert@...unet.com>
Subject: Re: [PATCH net] udp: segment looped gso packets correctly
On Tue, Jan 28, 2020 at 6:27 AM Paolo Abeni <pabeni@...hat.com> wrote:
>
> On Mon, 2020-01-27 at 15:40 -0500, Willem de Bruijn wrote:
> > From: Willem de Bruijn <willemb@...gle.com>
> >
> > Multicast and broadcast packets can be looped from egress to ingress
> > pre segmentation with dev_loopback_xmit. That function unconditionally
> > sets ip_summed to CHECKSUM_UNNECESSARY.
> >
> > udp_rcv_segment segments gso packets in the udp rx path. Segmentation
> > usually executes on egress, and does not expect packets of this type.
> > __udp_gso_segment interprets !CHECKSUM_PARTIAL as CHECKSUM_NONE. But
> > the offsets are not correct for gso_make_checksum.
> >
> > UDP GSO packets are of type CHECKSUM_PARTIAL, with their uh->check set
> > to the correct pseudo header checksum. Reset ip_summed to this type.
> > (CHECKSUM_PARTIAL is allowed on ingress, see comments in skbuff.h)
> >
> > Reported-by: syzbot <syzkaller@...glegroups.com>
> > Fixes: cf329aa42b66 ("udp: cope with UDP GRO packet misdirection")
> > Signed-off-by: Willem de Bruijn <willemb@...gle.com>
> > ---
> > include/net/udp.h | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/include/net/udp.h b/include/net/udp.h
> > index bad74f7808311..8f163d674f072 100644
> > --- a/include/net/udp.h
> > +++ b/include/net/udp.h
> > @@ -476,6 +476,9 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk,
> > if (!inet_get_convert_csum(sk))
> > features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
> >
> > + if (skb->pkt_type == PACKET_LOOPBACK)
> > + skb->ip_summed = CHECKSUM_PARTIAL;
> > +
> > /* the GSO CB lays after the UDP one, no need to save and restore any
> > * CB fragment
> > */
>
> LGTM, Thanks!
>
> Acked-by: Paolo Abeni <pabeni@...hat.com>
>
> Out of sheer curiosity, do you know what was the kernel behaviour
> before the 'fixes' commit ? GSO packet delivered to user-space stillaggregated ?!?
Yes.. I had missed this entire ip_mc_output path when adding
segmentation (clearly).
Your patch fixed that. The other options would be segmenting in
dev_loopback_xmit or outright failing the call in udp_send_skb.
Neither of which is appealing.
Thanks for reviewing!
Powered by blists - more mailing lists