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] [day] [month] [year] [list]
Date: Mon, 29 Apr 2024 08:32:39 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: "Matthew Wilcox (Oracle)" <willy@...radead.org>
Cc: linux-kernel@...r.kernel.org, 
	Михаил Новоселов <m.novosyolov@...alinux.ru>, 
	Ильфат Гаптрахманов <i.gaptrakhmanov@...alinux.ru>, 
	stable@...r.kernel.org, Rik van Riel <riel@...riel.com>, 
	Mel Gorman <mgorman@...hsingularity.net>, Peter Zijlstra <peterz@...radead.org>, 
	Ingo Molnar <mingo@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] bounds: Use the right number of bits for power-of-two CONFIG_NR_CPUS

On Mon, 29 Apr 2024 at 07:48, Matthew Wilcox (Oracle)
<willy@...radead.org> wrote:
>
> bits_per() rounds up to the next power of two when passed a power of
> two.  This causes crashes on some machines and configurations.

Bah. Your patch is *still* wrong, because bits_per() thinks you need
one bit for a zero value, so when you do

        bits_per(CONFIG_NR_CPUS - 1)

and some insane person has enabled SMP and managed to set
CONFIG_NR_CPUS to 1, the math is *still* broken.

The right thing to do is

        order_base_2(CONFIG_NR_CPUS)

and 'bits_per()' should be avoided, having completely crazy semantics
(you can tell how almost all users actually do "x-1" as the argument).

We should probably get rid of that horrid bits_per(() entirely.

I applied your patch with that fixed (which admittedly make it all
*my* patch, but applying it as yours just to get the changelog).

               Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ