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: <20240731164823.c8ac96ab0f8968ce8213c02d@linux-foundation.org>
Date: Wed, 31 Jul 2024 16:48:23 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Carlos Llamas <cmllamas@...gle.com>
Cc: linux-kernel@...r.kernel.org, kernel-team@...roid.com, "J. R. Okajima"
 <hooanon05g@...il.com>, Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
 Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v2] lockdep: upper limit LOCKDEP_CHAINS_BITS

On Tue, 23 Jul 2024 16:40:17 +0000 Carlos Llamas <cmllamas@...gle.com> wrote:

> From: "J. R. Okajima" <hooanon05g@...il.com>
> 
> CONFIG_LOCKDEP_CHAINS_BITS value decides the size of chain_hlocks[] in
> kernel/locking/lockdep.c, and it is checked by add_chain_cache() with
>     BUILD_BUG_ON((1UL << 24) <= ARRAY_SIZE(chain_hlocks));
> This patch is just to silence BUILD_BUG_ON().
> 
> ...
>
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -1515,7 +1515,7 @@ config LOCKDEP_BITS
>  config LOCKDEP_CHAINS_BITS
>  	int "Bitsize for MAX_LOCKDEP_CHAINS"
>  	depends on LOCKDEP && !LOCKDEP_SMALL
> -	range 10 30
> +	range 10 21
>  	default 16
>  	help
>  	  Try increasing this value if you hit "BUG: MAX_LOCKDEP_CHAINS too low!" message.

checking your homework...

With LOCKDEP_CHAINS_BITS == 21:

	#define MAX_LOCKDEP_CHAINS_BITS CONFIG_LOCKDEP_CHAINS_BITS

		gives MAX_LOCKDEP_CHAINS_BITS == 21

	#define MAX_LOCKDEP_CHAINS      (1UL << MAX_LOCKDEP_CHAINS_BITS)

		gives MAX_LOCKDEP_CHAINS == (1UL << 21)

	#define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)

		gives MAX_LOCKDEP_CHAIN_HLOCKS = 5 * (1UL << 21)

	static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS];

		gives ARRAY_SIZE(chain_hlocks) == 5 * (1UL << 21)

so

	BUILD_BUG_ON((1UL << 24) <= ARRAY_SIZE(chain_hlocks));
	ie, BUILD_BUG_ON((1UL << 24) <= 5 * (1UL << 21));

is OK, whereas

	BUILD_BUG_ON((1UL << 24) <= 5 * (1UL << 22));

will bug out.  So LGTM, I'll add it to mm.git.


btw, the help text "Bitsize for MAX_LOCKDEP_CHAINS" is odd.  What's a
bitsize?  Maybe "bit shift count for..." or such.



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ