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: <20230526203301.6933b4b3@kernel.org>
Date: Fri, 26 May 2023 20:33:01 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Pedro Tammela <pctammela@...atatu.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
 pabeni@...hat.com, kuniyu@...zon.com, dh.herrmann@...il.com,
 jhs@...atatu.com
Subject: Re: [PATCH net] net/netlink: fix NETLINK_LIST_MEMBERSHIPS group
 array length check

On Thu, 25 May 2023 11:46:09 -0300 Pedro Tammela wrote:
> For the socket option 'NETLINK_LIST_MEMBERSHIPS' the length is defined
> as the number of u32 required to represent the whole bitset.

I don't think it is, it's a getsockopt() len is in bytes.

> User space then usually queries the required size and issues a subsequent
> getsockopt call with the correct parameters[1].
> 
> The current code has an unit mismatch between 'len' and 'pos', where
> 'len' is the number of u32 in the passed array while 'pos' is the
> number of bytes iterated in the groups bitset.
> For netlink groups greater than 32, which from a quick glance
> is a rare occasion, the mismatch causes the misreport of groups e.g.
> if a rtnl socket is a member of group 34, it's reported as not a member
> (all 0s).

IDK... I haven't tried to repro but looking at the code the more
suspicious line of code is this one:

		if (put_user(ALIGN(nlk->ngroups / 8, sizeof(u32)), optlen))

It's going to round down bytes, and I don't think it's intending to.
It should be DIV_ROUND_UP(, 8) then ALIGN(, 4) right?
-- 
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ