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:	Tue, 7 Jun 2016 09:10:27 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Mateusz Guzik <mguzik@...hat.com>
Cc:	linux-tip-commits@...r.kernel.org, paulmck@...ux.vnet.ibm.com,
	akpm@...ux-foundation.org, torvalds@...ux-foundation.org,
	adobriyan@...il.com, tglx@...utronix.de,
	linux-kernel@...r.kernel.org, mingo@...nel.org, hpa@...or.com
Subject: Re: [tip:locking/core] locking/barriers: Validate
 lockless_dereference() is used on a pointer type

On Mon, Jun 06, 2016 at 11:31:39PM +0200, Mateusz Guzik wrote:
> The reason is that leaf_walk_rcu does get_child_rcu(pn, cindex++), which
> ends up in lockless_dereference as pn[cindex++], which is now evaluated
> twice. 

Indeed, bad that; yes I think the below will work, will you send a
proper patch so I can apply?

> The simplest fix I see does the assignment later, that is:
> diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> index e9c6417..06f27fd 100644
> --- a/include/linux/compiler.h
> +++ b/include/linux/compiler.h
> @@ -551,8 +551,8 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
>   */
>  #define lockless_dereference(p) \
>  ({ \
> -       __maybe_unused const void * const _________p2 = p; \
>         typeof(p) _________p1 = READ_ONCE(p); \
> +       __maybe_unused const void * const _________p2 = _________p1; \
>         smp_read_barrier_depends(); /* Dependency order vs. p above. */ \
>         (_________p1); \
>  })
> 
> -- 
> Mateusz Guzik

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ