lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 23 Jun 2021 22:23:28 -0400
From:   Willem de Bruijn <willemdebruijn.kernel@...il.com>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     Jesper Dangaard Brouer <brouer@...hat.com>, davem@...emloft.net,
        netdev@...r.kernel.org, eric.dumazet@...il.com, dsahern@...il.com,
        yoshfuji@...ux-ipv6.org, Dave Jones <dsj@...com>
Subject: Re: [PATCH net-next v3] net: ip: avoid OOM kills with large UDP sends
 over loopback

On Wed, Jun 23, 2021 at 5:07 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Wed, 23 Jun 2021 21:45:55 +0200 Jesper Dangaard Brouer wrote:
> > > diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
> > > index c3efc7d658f6..790dd28fd198 100644
> > > --- a/net/ipv4/ip_output.c
> > > +++ b/net/ipv4/ip_output.c
> > > @@ -1077,7 +1077,9 @@ static int __ip_append_data(struct sock *sk,
> > >                     if ((flags & MSG_MORE) &&
> > >                         !(rt->dst.dev->features&NETIF_F_SG))
> > >                             alloclen = mtu;
> > > -                   else if (!paged)
> > > +                   else if (!paged &&
> > > +                            (fraglen + hh_len + 15 < SKB_MAX_ALLOC ||
> >
> > What does the number 15 represent here?
>
> No idea, it's there on the allocation line, so I need to include it on
> the size check.
>
> Looking at super old code (2.4.x) it looks like it may have gotten
> copy & pasted mistakenly? The hard headers are rounded up to 16B,
> and there is code which does things like:
>
>         skb_alloc(size + dev->hard_header_len + 15);
>         skb_reserve(skb, (dev->hard_header_len + 15) & ~15);
>
> in other spots. So if I was to guess I'd say someone decided to add the
> 15B "to be safe" even though hh_len already includes the round up here.

The 15 seems to come from alignment indeed. Not sure when it was
introduced, but until 56951b54e87a there is also this

                /*
                 *      Get the memory we require with some space left
for alignment.
                 */

                skb = sock_alloc_send_skb(sk, fraglen+hh_len+15, 0,
flags&MSG_DONTWAIT, &err);

Powered by blists - more mailing lists