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: <20150326171723.GA22620@arm.com>
Date:	Thu, 26 Mar 2015 17:17:23 +0000
From:	Will Deacon <will.deacon@....com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Christian Borntraeger <borntraeger@...ibm.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	"linux-next@...r.kernel.org" <linux-next@...r.kernel.org>,
	Stephen Rothwell <sfr@...b.auug.org.au>,
	Ingo Molnar <mingo@...e.hu>,
	Davidlohr Bueso <dave@...olabs.net>,
	Paul McKenney <paulmck@...ux.vnet.ibm.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"H. Peter Anvin" <hpa@...or.com>
Subject: Re: linux-next: build warnings after merge of the access_once tree

On Thu, Mar 26, 2015 at 05:07:48PM +0000, Peter Zijlstra wrote:
> On Thu, Mar 26, 2015 at 09:45:07AM -0700, Linus Torvalds wrote:
> 
> > Stop this idiocy.
> 
> Yeah, clearly I can type faster than I can think straight :/
> 
> 
> In any case, I've the below patch; do you want to take it now or do you
> want me to route it through tip/locking/urgent or something like that?

This patch also works fine for me. I managed to get the compiler to split a
64-bit load into 2x32-bit loads using memcpy, so I do like keeping the
8-byte case available for 32-bit architectures than can make use of it.

	Acked-by: Will Deacon <will.deacon@....com>

Will

> Subject: kernel: Remove atomicy checks from {READ,WRITE}_ONCE
> From: Peter Zijlstra <peterz@...radead.org>
> Date: Thu, 26 Mar 2015 17:45:37 +0100
> 
> The fact that volatile allows for atomic load/stores is a special case
> not a requirement for {READ,WRITE}_ONCE(). Their primary purpose is to
> force the compiler to emit load/stores _once_.
> 
> So remove the warning as it is correct behaviour. This also implies that
> the u64 case is not 64bit only, so remove the #ifdef so we can generate
> better code in that case.
> 
> Cc: Stephen Rothwell <sfr@...b.auug.org.au>
> Cc: Christian Borntraeger <borntraeger@...ibm.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...e.hu>
> Cc: "H. Peter Anvin" <hpa@...or.com>
> Cc: Davidlohr Bueso <dave@...olabs.net>
> Cc: Paul McKenney <paulmck@...ux.vnet.ibm.com>
> Cc: Will Deacon <will.deacon@....com>
> Acked-by: Linus Torvalds <torvalds@...ux-foundation.org>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> ---
>  include/linux/compiler.h | 16 ----------------
>  1 file changed, 16 deletions(-)
> 
> diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> index 1b45e4a0519b..0e41ca0e5927 100644
> --- a/include/linux/compiler.h
> +++ b/include/linux/compiler.h
> @@ -192,29 +192,16 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
>  
>  #include <uapi/linux/types.h>
>  
> -static __always_inline void data_access_exceeds_word_size(void)
> -#ifdef __compiletime_warning
> -__compiletime_warning("data access exceeds word size and won't be atomic")
> -#endif
> -;
> -
> -static __always_inline void data_access_exceeds_word_size(void)
> -{
> -}
> -
>  static __always_inline void __read_once_size(const volatile void *p, void *res, int size)
>  {
>  	switch (size) {
>  	case 1: *(__u8 *)res = *(volatile __u8 *)p; break;
>  	case 2: *(__u16 *)res = *(volatile __u16 *)p; break;
>  	case 4: *(__u32 *)res = *(volatile __u32 *)p; break;
> -#ifdef CONFIG_64BIT
>  	case 8: *(__u64 *)res = *(volatile __u64 *)p; break;
> -#endif
>  	default:
>  		barrier();
>  		__builtin_memcpy((void *)res, (const void *)p, size);
> -		data_access_exceeds_word_size();
>  		barrier();
>  	}
>  }
> @@ -225,13 +212,10 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
>  	case 1: *(volatile __u8 *)p = *(__u8 *)res; break;
>  	case 2: *(volatile __u16 *)p = *(__u16 *)res; break;
>  	case 4: *(volatile __u32 *)p = *(__u32 *)res; break;
> -#ifdef CONFIG_64BIT
>  	case 8: *(volatile __u64 *)p = *(__u64 *)res; break;
> -#endif
>  	default:
>  		barrier();
>  		__builtin_memcpy((void *)p, (const void *)res, size);
> -		data_access_exceeds_word_size();
>  		barrier();
>  	}
>  }
> 
--
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