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] [day] [month] [year] [list]
Date:   Mon, 22 Mar 2021 13:19:11 -0400
From:   Waiman Long <longman@...hat.com>
To:     Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>
Cc:     Boqun Feng <boqun.feng@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lockdep: add a hint for "INFO: trying to register
 non-static key." message

On 3/21/21 2:49 AM, Tetsuo Handa wrote:
> Since this message is printed when dynamically allocated spinlocks (e.g.
> kzalloc()) are used without initialization (e.g. spin_lock_init()),
> suggest developers to check whether initialization functions for objects
> are called, before making developers wonder what annotation is missing.
>
> Signed-off-by: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
> ---
>   kernel/locking/lockdep.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index c6d0c1dc6253..44c549f5c061 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -931,6 +931,7 @@ static bool assign_lock_key(struct lockdep_map *lock)
>   		debug_locks_off();
>   		pr_err("INFO: trying to register non-static key.\n");
>   		pr_err("the code is fine but needs lockdep annotation.\n");
> +		pr_err("maybe you didn't initialize this object before you use?\n");
>   		pr_err("turning off the locking correctness validator.\n");
>   		dump_stack();
>   		return false;

The only way this message is written is when the appropriate lock init 
function isn't called for locks in dynamically allocated objects. I 
think you can just say so without the word "maybe". Like "the code is 
fine but needs lockdep annotation by calling appropriate lock 
initialization function.".

Cheers,
Longman

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ