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: <20150107022128.GC2433@kmo-pixel>
Date:	Tue, 6 Jan 2015 18:21:28 -0800
From:	Kent Overstreet <kmo@...erainc.com>
To:	Tejun Heo <tj@...nel.org>
Cc:	Christoph Lameter <cl@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2 percpu/for-3.20] percpu_ref: remove unnecessary
 ACCESS_ONCE() in percpu_ref_tryget_live()

On Tue, Jan 06, 2015 at 10:23:47AM -0500, Tejun Heo wrote:
> __ref_is_percpu() needs the implied ACCESS_ONCE() in
> lockless_dereference() on @ref->percpu_count_ptr because the value is
> tested for !__PERCPU_REF_ATOMIC, which may be set asynchronously, and
> then used as a pointer.  If the compiler generates a separate fetch
> when using it as a pointer, __PERCPU_REF_ATOMIC may be set in between
> contaminating the pointer value.
> 
> percpu_ref_tryget_live() also uses ACCESS_ONCE() to test
> __PERCPU_REF_DEAD; however, there's no reason for this.  I just copied
> ACCESS_ONCE() usage blindly from __ref_is_percpu().  All it does is
> confusing people trying to understand what's going on.
> 
> This patch removes the unnecessary ACCESS_ONCE() usage from
> percpu_ref_tryget_live() and adds a comment explaining why
> __ref_is_percpu() needs it.

lockless_dereference() is new - cool! I've been wanting that without even
realizing it.

Acked-by: Kent Overstreet <kmo@...erainc.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ