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>] [day] [month] [year] [list]
Message-Id: <20140319165608.739527f179d25c63ebb583ea@canb.auug.org.au>
Date:	Wed, 19 Mar 2014 16:56:08 +1100
From:	Stephen Rothwell <sfr@...b.auug.org.au>
To:	"Theodore Ts'o" <tytso@....edu>
Cc:	linux-next@...r.kernel.org, linux-kernel@...r.kernel.org,
	Kees Cook <keescook@...omium.org>,
	"H. Peter Anvin" <hpa@...ux.intel.com>
Subject: linux-next: manual merge of the random tree with Linus' tree

Hi Theodore,

Today's linux-next merge of the random tree got a conflict in
arch/x86/include/asm/archrandom.h between commit 5bfce5ef55cb ("x86,
kaslr: Provide randomness functions") from Linus' tree and commits
e3be36e60bdc ("x86, random: Enable the RDSEED instruction") and
91a60dc7aa88 ("random: Add arch_has_random[_seed]()") from the random tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@...b.auug.org.au

diff --cc arch/x86/include/asm/archrandom.h
index e6a92455740e,c7ed4a61e928..000000000000
--- a/arch/x86/include/asm/archrandom.h
+++ b/arch/x86/include/asm/archrandom.h
@@@ -39,20 -42,16 +42,30 @@@
  
  #ifdef CONFIG_ARCH_RANDOM
  
 +/* Instead of arch_get_random_long() when alternatives haven't run. */
 +static inline int rdrand_long(unsigned long *v)
 +{
 +	int ok;
 +	asm volatile("1: " RDRAND_LONG "\n\t"
 +		     "jc 2f\n\t"
 +		     "decl %0\n\t"
 +		     "jnz 1b\n\t"
 +		     "2:"
 +		     : "=r" (ok), "=a" (*v)
 +		     : "0" (RDRAND_RETRY_LOOPS));
 +	return ok;
 +}
 +
+ /* A single attempt at RDSEED */
+ static inline bool rdseed_long(unsigned long *v)
+ {
+ 	unsigned char ok;
+ 	asm volatile(RDSEED_LONG "\n\t"
+ 		     "setc %0"
+ 		     : "=qm" (ok), "=a" (*v));
+ 	return ok;
+ }
+ 
  #define GET_RANDOM(name, type, rdrand, nop)			\
  static inline int name(type *v)					\
  {								\
@@@ -80,15 -95,14 +109,21 @@@ GET_SEED(arch_get_random_seed_int, unsi
  GET_RANDOM(arch_get_random_long, unsigned long, RDRAND_LONG, ASM_NOP3);
  GET_RANDOM(arch_get_random_int, unsigned int, RDRAND_INT, ASM_NOP3);
  
+ GET_SEED(arch_get_random_seed_long, unsigned long, RDSEED_LONG, ASM_NOP4);
+ GET_SEED(arch_get_random_seed_int, unsigned int, RDSEED_INT, ASM_NOP4);
+ 
  #endif /* CONFIG_X86_64 */
  
+ #define arch_has_random()	static_cpu_has(X86_FEATURE_RDRAND)
+ #define arch_has_random_seed()	static_cpu_has(X86_FEATURE_RDSEED)
+ 
 +#else
 +
 +static inline int rdrand_long(unsigned long *v)
 +{
 +	return 0;
 +}
 +
  #endif  /* CONFIG_ARCH_RANDOM */
  
  extern void x86_init_rdrand(struct cpuinfo_x86 *c);

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ