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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200712160856.GW9247@paulmck-ThinkPad-P72>
Date:   Sun, 12 Jul 2020 09:08:56 -0700
From:   "Paul E. McKenney" <paulmck@...nel.org>
To:     madhuparnabhowmik10@...il.com
Cc:     josh@...htriplett.org, joel@...lfernandes.org, pbonzini@...hat.com,
        rcu@...r.kernel.org, linux-kernel@...r.kernel.org, x86@...nel.org,
        kvm@...r.kernel.org, frextrite@...il.com
Subject: Re: [PATCH 2/2] kvm: mmu: page_track: Fix RCU list API usage

On Sun, Jul 12, 2020 at 06:40:03PM +0530, madhuparnabhowmik10@...il.com wrote:
> From: Madhuparna Bhowmik <madhuparnabhowmik10@...il.com>
> 
> Use hlist_for_each_entry_srcu() instead of hlist_for_each_entry_rcu()
> as it also checkes if the right lock is held.
> Using hlist_for_each_entry_rcu() with a condition argument will not
> report the cases where a SRCU protected list is traversed using
> rcu_read_lock(). Hence, use hlist_for_each_entry_srcu().
> 
> Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@...il.com>

I queued both for testing and review, thank you!

In particular, this one needs an ack by the maintainer.

							Thanx, Paul

> ---
>  arch/x86/kvm/mmu/page_track.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/mmu/page_track.c b/arch/x86/kvm/mmu/page_track.c
> index a7bcde34d1f2..a9cd17625950 100644
> --- a/arch/x86/kvm/mmu/page_track.c
> +++ b/arch/x86/kvm/mmu/page_track.c
> @@ -229,7 +229,8 @@ void kvm_page_track_write(struct kvm_vcpu *vcpu, gpa_t gpa, const u8 *new,
>  		return;
>  
>  	idx = srcu_read_lock(&head->track_srcu);
> -	hlist_for_each_entry_rcu(n, &head->track_notifier_list, node)
> +	hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
> +				srcu_read_lock_held(&head->track_srcu))
>  		if (n->track_write)
>  			n->track_write(vcpu, gpa, new, bytes, n);
>  	srcu_read_unlock(&head->track_srcu, idx);
> @@ -254,7 +255,8 @@ void kvm_page_track_flush_slot(struct kvm *kvm, struct kvm_memory_slot *slot)
>  		return;
>  
>  	idx = srcu_read_lock(&head->track_srcu);
> -	hlist_for_each_entry_rcu(n, &head->track_notifier_list, node)
> +	hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
> +				srcu_read_lock_held(&head->track_srcu))
>  		if (n->track_flush_slot)
>  			n->track_flush_slot(kvm, slot, n);
>  	srcu_read_unlock(&head->track_srcu, idx);
> -- 
> 2.17.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ