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: <20230419175043.37093-1-kuniyu@amazon.com>
Date:   Wed, 19 Apr 2023 10:50:43 -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:   Tue, 18 Apr 2023 20:33:18 -0700
> On Tue, 18 Apr 2023 17:42:46 -0700 Kuniyuki Iwashima wrote:
> > Brad Spencer provided a detailed report that when calling getsockopt()
> > for AF_NETLINK, some SOL_NETLINK options set only 1 byte even though such
> > options require more than int as length.
> > 
> > The options return a flag value that fits into 1 byte, but such behaviour
> > confuses users who do not strictly check the value as char.
> > 
> > Currently, netlink_getsockopt() uses put_user() to copy data to optlen and
> > optval, but put_user() casts the data based on the pointer, char *optval.
> > So, only 1 byte is set to optval.
> > 
> > To avoid this behaviour, we need to use copy_to_user() or cast optval for
> > put_user().
> > 
> > Now getsockopt() accepts char as optval as the flags are only 1 byte.
> 
> I think it's worth doing, but it will change the return value on big
> endian, right?

Ah, I missed that point, yes.  I hope big endian users always
initialise the value to avoid the tricky behaviour.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ