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]
Date:   Fri, 24 Feb 2023 21:58:47 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Jakub Kicinski' <kuba@...nel.org>,
        Saeed Mahameed <saeed@...nel.org>
CC:     "David S. Miller" <davem@...emloft.net>,
        Paolo Abeni <pabeni@...hat.com>,
        Eric Dumazet <edumazet@...gle.com>,
        Saeed Mahameed <saeedm@...dia.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        Tariq Toukan <tariqt@...dia.com>,
        Rahul Rameshbabu <rrameshbabu@...dia.com>
Subject: RE: [net 07/10] net/mlx5e: Correct SKB room check to use all room in
 the fifo

From: Jakub Kicinski
> Sent: 24 February 2023 00:39
> 
> On Thu, 23 Feb 2023 14:52:44 -0800 Saeed Mahameed wrote:
> > From: Rahul Rameshbabu <rrameshbabu@...dia.com>
> >
> > Previous check was comparing against the fifo mask. The mask is size of the
> > fifo (power of two) minus one, so a less than or equal comparator should be
> > used for checking if the fifo has room for the SKB.
> >
> > Fixes: 19b43a432e3e ("net/mlx5e: Extend SKB room check to include PTP-SQ")
> 
> How big is the fifo? Not utilizing a single entry is not really worth
> calling a bug if the fifo has at least 32 entries..

There is also the question of how 'fifo full' and 'fifo empty'
are differentiated if they both have the same index values.
I've not looked at the code in question, but not using the
last slot is less likely to be buggy.

I've taken to using array[index++ & mask] and just letting
the index wrap at 2**32 (or even (not) wrap an 2**64).
Then the full and empty conditions are trivially separated.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ