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: <25e2293a-f49e-4bc9-bf80-efb66d87c7cb@redhat.com>
Date: Tue, 27 May 2025 01:53:27 -0400
From: Waiman Long <llong@...hat.com>
To: Lance Yang <lance.yang@...ux.dev>, Waiman Long <llong@...hat.com>,
 peterz@...radead.org
Cc: mingo@...hat.com, will@...nel.org, boqun.feng@...il.com,
 linux-kernel@...r.kernel.org, Lance Yang <ioworker0@...il.com>,
 Zi Li <zi.li@...ux.dev>
Subject: Re: [WARN] LOCKDEP: MAX_LOCKDEP_CHAIN_HLOCKS too low

On 5/27/25 1:33 AM, Lance Yang wrote:
> Hi Longman,
>
> Thanks for looking into this!
>
> On 2025/5/27 12:48, Waiman Long wrote:
>> On 5/26/25 10:02 PM, Lance Yang wrote:
>>> From: Lance Yang <lance.yang@...ux.dev>
>>>
>>> Hi all,
>>>
>>> With CONFIG_LOCKDEP on, I got this warning during kernel builds:
>>>
>>> [Tue May 27 00:22:59 2025] BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!
>
> [...]
>
>>>
>>> $ cat .config|grep CONFIG_LOCKDEP
>>> CONFIG_LOCKDEP_SUPPORT=y
>>> CONFIG_LOCKDEP=y
>>> CONFIG_LOCKDEP_BITS=15
>>> CONFIG_LOCKDEP_CHAINS_BITS=16
>>> CONFIG_LOCKDEP_STACK_TRACE_BITS=19
>>> CONFIG_LOCKDEP_STACK_TRACE_HASH_BITS=14
>>> CONFIG_LOCKDEP_CIRCULAR_QUEUE_BITS=12
>>>
>>> Is it safe? Or could this be a real locking issue?
>>
>> The lock chains store the locking order of nested locks. The default 
>> value of 16 may be too low now as the kernel is becoming more complex 
>> in term of possible nested locking orders. Anyway, I would suggest 
>> upping the CONFIG_LOCKDEP_CHAIN_BITS to 17 or even 18 to prevent this 
>> kind of problem. In fact, the latest RHEL debug kernel sets 
>> CONFIG_LOCKDEP_CHAINS_BITS to 18.
>
> Yes, makes sense to me. Bumping it to 18 sounds reasonable as the kernel
> is getting more complex in terms of possible nested locking orders. It
> uses a bit more memory, but keeping LOCKDEP working is worth it ;)
>
> And if there are no objections, I’d be happy to send a patch making the
> change.

MAX_LOCKDEP_CHAIN_HLOCKS is composed of 2 parts - (1 << 
MAX_LOCKDEP_CHAINS_BITS) and AVG_LOCKDEP_CHAIN_DEPTH (5). I believe that 
the average lock chain length is probably bigger than 5 now. We will 
have to check the /proc/lockdep file to figure out if we should increase 
it as well. Anyway, I think we should increase 
CONFIG_LOCKDEP_CHAINS_BITS to at least 17, those we may still hit the 
"MAX_LOCKDEP_CHAIN_HLOCKS too low" if we run a variety of different 
workloads without reboot.

Cheers,
Longman


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ