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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF=yD-Jj8fC=yXoNAqph2MV1KJYXY_=otUBfE8VZjnCYu3266g@mail.gmail.com>
Date:   Fri, 26 Apr 2019 11:10:44 -0400
From:   Willem de Bruijn <willemdebruijn.kernel@...il.com>
To:     David Laight <David.Laight@...lab.com>
Cc:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "idosch@...sch.org" <idosch@...sch.org>,
        Willem de Bruijn <willemb@...gle.com>
Subject: Re: [PATCH net] packet: validate address length if non-zero

On Thu, Apr 25, 2019 at 11:42 AM Willem de Bruijn
<willemdebruijn.kernel@...il.com> wrote:
>
> On Thu, Apr 25, 2019 at 10:35 AM David Laight <David.Laight@...lab.com> wrote:
> >
> > From: Willem de Bruijn
> > > Sent: 25 April 2019 14:57
> > ...
> > > > I've just done a bit of software archaeology.
> > > >
> > > > Prior to 2.6.14-rc3 the send code ignored sll_halen, it was only set by the receive code.
> > > > So it is not surprising that old application code leaves it as zero.
> > > >
> > > > The old receive code also always set msg_namelen = sizeof (struct sockaddr_ll).
> > > > The receive code now sets:
> > > >   msg_namelen = offsetof(struct sockaddr_ll, sll_addr) + saddr->sll_halen;
> > > > For ethernet this changes the msg_namelen from 20 to 18.
> > > > A side effect (no one has noticed for years) is that you can't send a reply
> > > > by passing back the received address buffer.
> > >
> > > Great find, thanks. I hadn't thought of going back that far, but
> > > clearly should in these legacy caller questions..
> >
> > Fortunately I didn't have to find the pre-git sources :-)
> >
> > > > Looking at it all again how about:
> > > >         char *addr = NULL;
> > > >         ...
> > > >                         err = -EINVAL;
> > > >                         if (msg->msg_namelen < offsetof(struct sockaddr_ll, sll_addr))
> > > >                                 goto out;
> > > >                         proto = saddr->sll_protocol;
> > > >                         dev = dev_get_by_index(sock_net(sk), saddr->sll_ifindex);
> > > >                         if (dev && sock->type == SOCK_DGRAM) {
> > > >                                 if (msg->msg_namelen < dev->addr_len + offsetof(struct sockaddr_ll, sll_addr))
> > > >                                         goto out_unlock;
> > > >                                 addr = saddr->sll_addr;
> > > >                         }
> > >
> > > Yes, given the above, this looks great to me.

Coming back to this. Both the above and two separate send/recv fixes
seem fine to me. Do you have a preference either way? And do you want
to send the fix(es) or should I?

Thanks,

  Willem

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ