[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <79a44096-57f0-4df7-62e0-a87b3eca6231@acm.org>
Date: Mon, 3 Jan 2022 13:26:20 -0800
From: Bart Van Assche <bvanassche@....org>
To: Waiman Long <longman@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Will Deacon <will.deacon@....com>,
Boqun Feng <boqun.feng@...il.com>
Cc: linux-kernel@...r.kernel.org,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
Subject: Re: [PATCH] locking/lockdep: Avoid potential access of invalid memory
in lock_class
On 1/3/22 10:17, Waiman Long wrote:
> On 1/3/22 12:47, Bart Van Assche wrote:
>> On 1/2/22 18:35, Waiman Long wrote:
>>> - WARN_ON_ONCE(!found);
>>> - __lockdep_free_key_range(pf, key, 1);
>>> - call_rcu_zapped(pf);
>>> - graph_unlock();
>>> -out_irq:
>>> + WARN_ON_ONCE(!found && debug_locks);
>>
>> lockdep_unregister_key() should only be called for a registered key so
>> I'd
>> like to keep the WARN_ON_ONCE(!found) here instead of changing it into
>> WARN_ON_ONCE(!found && debug_locks). Otherwise this patch looks good
>> to me.
>
> The reason for this change is to handle the case that a
> lockdep_register_key()/lockdep_unregister_key() pair may be called after
> debug_locks is turned off. Without that change, we are going to get the
> warning in lockdep_unregister_key(). That is the motivation of your
> original commit 8b39adbee805 ("locking/lockdep: Make
> lockdep_unregister_key() honor 'debug_locks' again").
Ah, that's right. Hence:
Reviewed-by: Bart Van Assche <bvanassche@....org>
Powered by blists - more mailing lists