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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201027123056.GE2651@hirez.programming.kicks-ass.net>
Date:   Tue, 27 Oct 2020 13:30:56 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Chris Wilson <chris@...is-wilson.co.uk>
Cc:     linux-kernel@...r.kernel.org, linux-tip-commits@...r.kernel.org,
        tip-bot2 for Peter Zijlstra <tip-bot2@...utronix.de>,
        Qian Cai <cai@...hat.com>, x86 <x86@...nel.org>
Subject: Re: [tip: locking/core] lockdep: Fix usage_traceoverflow

On Tue, Oct 27, 2020 at 12:59:55PM +0100, Peter Zijlstra wrote:
> On Tue, Oct 27, 2020 at 11:29:35AM +0000, Chris Wilson wrote:
> > Quoting tip-bot2 for Peter Zijlstra (2020-10-07 17:20:13)
> > > The following commit has been merged into the locking/core branch of tip:
> > > 
> > > Commit-ID:     24d5a3bffef117ed90685f285c6c9d2faa3a02b4
> > > Gitweb:        https://git.kernel.org/tip/24d5a3bffef117ed90685f285c6c9d2faa3a02b4
> > > Author:        Peter Zijlstra <peterz@...radead.org>
> > > AuthorDate:    Wed, 30 Sep 2020 11:49:37 +02:00
> > > Committer:     Peter Zijlstra <peterz@...radead.org>
> > > CommitterDate: Wed, 07 Oct 2020 18:14:17 +02:00
> > > 
> > > lockdep: Fix usage_traceoverflow
> > > 
> > > Basically print_lock_class_header()'s for loop is out of sync with the
> > > the size of of ->usage_traces[].
> > 
> > We're hitting a problem,
> > 
> > 	$ cat /proc/lockdep_stats
> > 
> > upon boot generates:
> > 
> > [   29.465702] DEBUG_LOCKS_WARN_ON(debug_atomic_read(nr_unused_locks) != nr_unused)
> > [   29.465716] WARNING: CPU: 0 PID: 488 at kernel/locking/lockdep_proc.c:256 lockdep_stats_show+0xa33/0xac0
> > 
> > that bisected to this patch. Only just completed the bisection and
> > thought you would like a heads up.
> 
> Oh hey, that's 'curious'... it does indeed trivially reproduce, let me
> have a poke.

This seems to make it happy. Not quite sure that's the best solution.

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 3e99dfef8408..81295bc760fe 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -4411,7 +4405,9 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this,
 		break;
 
 	case LOCK_USED:
-		debug_atomic_dec(nr_unused_locks);
+	case LOCK_USED_READ:
+		if ((hlock_class(this)->usage_mask & (LOCKF_USED|LOCKF_USED_READ)) == new_mask)
+			debug_atomic_dec(nr_unused_locks);
 		break;
 
 	default:



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ