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>] [day] [month] [year] [list]
Date:   Wed, 19 Apr 2023 20:40:50 -0700
From:   Kuniyuki Iwashima <kuniyu@...zon.com>
To:     <kuba@...nel.org>
CC:     <bspencer@...ckberry.com>, <christophe-h.ricard@...com>,
        <davem@...emloft.net>, <dsahern@...il.com>, <edumazet@...gle.com>,
        <johannes.berg@...el.com>, <kaber@...sh.net>, <kuni1840@...il.com>,
        <kuniyu@...zon.com>, <netdev@...r.kernel.org>, <pabeni@...hat.com>,
        <pablo@...filter.org>
Subject: Re: [PATCH v1 net] netlink: Use copy_to_user() for optval in netlink_getsockopt().

From: Jakub Kicinski <kuba@...nel.org>
Date: Wed, 19 Apr 2023 16:09:08 -0700
> On Wed, 19 Apr 2023 09:17:37 +0200 Johannes Berg wrote:
> > > @@ -1754,39 +1754,17 @@ static int netlink_getsockopt(struct socket *sock, int level, int optname,
> > >
> > >         switch (optname) {
> > >         case NETLINK_PKTINFO:
> > > -               if (len < sizeof(int))
> > > -                       return -EINVAL;
> > > -               len = sizeof(int);
> >
> > On the other hand, this is actually accepting say a u64 now, and then
> > sets only 4 bytes of it, though at least it also sets the size to what
> > it wrote out.
> >
> > So I guess here we can argue either
> >  1) keep writing len to 4 and set 4 bytes of the output
> >  2) keep the length as is and set all bytes of the output
> >
> > but (2) gets confusing if you say used 6 bytes buffer as input? I mean,
> > yeah, I'd really hope nobody does that.
> >
> > If Jakub is feeling adventurous maybe we should attempt to see if we
> > break anything by accepting only == sizeof(int) rather than >= ... :-)
> 
> Can't think of a strong reason either way, so I'd keep the check
> and len setting as is.

Ok, I'll respin v2 with the existing check and len setting.

Thank you, Johannes and Jakub!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ