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>] [day] [month] [year] [list]
Message-ID: <20210820044015.GA2751666@roeck-us.net>
Date:   Thu, 19 Aug 2021 21:40:15 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        LKML <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Will Deacon <will@...nel.org>,
        Waiman Long <longman@...hat.com>,
        Boqun Feng <boqun.feng@...il.com>,
        Davidlohr Bueso <dave@...olabs.net>,
        Mike Galbraith <efault@....de>
Subject: Re: [PATCH v2] locking/ww_mutex: Initialize waiter.ww_ctx properly

On Thu, Aug 19, 2021 at 09:30:30PM +0200, Sebastian Andrzej Siewior wrote:
> The gathering of the debug code for the ww-mutex initialized moved the
> POISON initialiation into one spot and only set waiter.ww_ctx if the
> ww_ctx was non-NULL thus keeping the POISON value in ww-mutex case.
> 
> For ww-mutex without a context it is expected to set the context to
> NULL, the poison value was intended only for the regular mutex.
> 
> Always initialized waiter.ww_ctx to ww_ctx in the ww-mutex case.
> 
> Fixes: c0afb0ffc06e6 ("locking/ww_mutex: Gather mutex_waiter initialization")
> Reported-by: Guenter Roeck <linux@...ck-us.net>
> Suggested-by: Peter Zijlstra <peterz@...radead.org>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>

Tested-by: Guenter Roeck <linux@...ck-us.net>

> ---
> v1…v2: Use PeterZ' approach.
> 
>  kernel/locking/mutex.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
> index 05b68931622d1..2c70213934cd4 100644
> --- a/kernel/locking/mutex.c
> +++ b/kernel/locking/mutex.c
> @@ -614,7 +614,7 @@ __mutex_lock_common(struct mutex *lock, unsigned int state, unsigned int subclas
>  
>  	debug_mutex_lock_common(lock, &waiter);
>  	waiter.task = current;
> -	if (ww_ctx)
> +	if (use_ww_ctx)
>  		waiter.ww_ctx = ww_ctx;
>  
>  	lock_contended(&lock->dep_map, ip);
> -- 
> 2.33.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ