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] [day] [month] [year] [list]
Message-ID: <c58b6751-7502-fad4-e087-9f0bb744ebb9@oracle.com>
Date:   Sat, 18 Jan 2020 10:06:30 -0800
From:   santosh.shilimkar@...cle.com
To:     Amol Grover <frextrite@...il.com>,
        Santosh Shilimkar <ssantosh@...nel.org>,
        Olof Johansson <olof@...om.net>
Cc:     arm@...nel.org, soc@...nel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        linux-kernel-mentees@...ts.linuxfoundation.org,
        Joel Fernandes <joel@...lfernandes.org>,
        Madhuparna Bhowmik <madhuparnabhowmik04@...il.com>,
        "Paul E . McKenney" <paulmck@...nel.org>
Subject: Re: [PATCH v2] drivers: soc: ti: knav_qmss_queue: Pass lockdep
 expression to RCU lists

On 1/17/20 8:24 PM, Amol Grover wrote:
> inst->handles is traversed using list_for_each_entry_rcu
> outside an RCU read-side critical section but under the protection
> of knav_dev_lock.
> 
> Hence, add corresponding lockdep expression to silence false-positive
> lockdep warnings, and harden RCU lists.
> 
> Add macro for the corresponding lockdep expression.
> 
> Signed-off-by: Amol Grover <frextrite@...il.com>
> ---
> v2:
> - Remove rcu_read_lock_held() from lockdep expression since it is
>    implicitly checked for.
>
Thanks.
Acked-by: Santosh Shilimkar <ssantosh@...nel.org>

>   drivers/soc/ti/knav_qmss_queue.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c
> index 1ccc9064e1eb..37f3db6c041c 100644
> --- a/drivers/soc/ti/knav_qmss_queue.c
> +++ b/drivers/soc/ti/knav_qmss_queue.c
> @@ -25,6 +25,8 @@
>   
>   static struct knav_device *kdev;
>   static DEFINE_MUTEX(knav_dev_lock);
> +#define knav_dev_lock_held() \
> +	lockdep_is_held(&knav_dev_lock)
>   
>   /* Queue manager register indices in DTS */
>   #define KNAV_QUEUE_PEEK_REG_INDEX	0
> @@ -52,8 +54,9 @@ static DEFINE_MUTEX(knav_dev_lock);
>   #define knav_queue_idx_to_inst(kdev, idx)			\
>   	(kdev->instances + (idx << kdev->inst_shift))
>   
> -#define for_each_handle_rcu(qh, inst)			\
> -	list_for_each_entry_rcu(qh, &inst->handles, list)
> +#define for_each_handle_rcu(qh, inst)				\
> +	list_for_each_entry_rcu(qh, &inst->handles, list,	\
> +				knav_dev_lock_held())
>   
>   #define for_each_instance(idx, inst, kdev)		\
>   	for (idx = 0, inst = kdev->instances;		\
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ