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]
Date:   Thu, 15 Mar 2018 16:24:28 -0600
From:   Jason Gunthorpe <jgg@...pe.ca>
To:     Tejun Heo <tj@...nel.org>
Cc:     torvalds@...ux-foundation.org, jannh@...gle.com,
        paulmck@...ux.vnet.ibm.com, bcrl@...ck.org,
        viro@...iv.linux.org.uk, kent.overstreet@...il.com,
        security@...nel.org, linux-kernel@...r.kernel.org,
        kernel-team@...com, Mike Marciniszyn <mike.marciniszyn@...el.com>,
        linux-rdma@...r.kernel.org
Subject: Re: [PATCH 3/8] RDMAVT: Fix synchronization around percpu_ref

On Wed, Mar 14, 2018 at 12:45:10PM -0700, Tejun Heo wrote:
> rvt_mregion uses percpu_ref for reference counting and RCU to protect
> accesses from lkey_table.  When a rvt_mregion needs to be freed, it
> first gets unregistered from lkey_table and then rvt_check_refs() is
> called to wait for in-flight usages before the rvt_mregion is freed.
> 
> rvt_check_refs() seems to have a couple issues.
> 
> * It has a fast exit path which tests percpu_ref_is_zero().  However,
>   a percpu_ref reading zero doesn't mean that the object can be
>   released.  In fact, the ->release() callback might not even have
>   started executing yet.  Proceeding with freeing can lead to
>   use-after-free.
> 
> * lkey_table is RCU protected but there is no RCU grace period in the
>   free path.  percpu_ref uses RCU internally but it's sched-RCU whose
>   grace periods are different from regular RCU.  Also, it generally
>   isn't a good idea to depend on internal behaviors like this.
> 
> To address the above issues, this patch removes the fast exit and adds
> an explicit synchronize_rcu().
> 
> Signed-off-by: Tejun Heo <tj@...nel.org>
> Acked-by: Dennis Dalessandro <dennis.dalessandro@...el.com>
> Cc: Mike Marciniszyn <mike.marciniszyn@...el.com>
> Cc: linux-rdma@...r.kernel.org
> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
>  drivers/infiniband/sw/rdmavt/mr.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)

Applied to rdma for-next

Thanks,
Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ