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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1708151546380.1886@nanos>
Date:   Tue, 15 Aug 2017 15:48:18 +0200 (CEST)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Borislav Petkov <bp@...en8.de>
cc:     Ingo Molnar <mingo@...nel.org>, Willy Tarreau <w@....eu>,
        Theodore Ts'o <tytso@....edu>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        x86-ml <x86@...nel.org>, "Jason A. Donenfeld" <Jason@...c4.com>,
        lkml <linux-kernel@...r.kernel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Nicholas Mc Guire <der.herr@...r.at>
Subject: Re: early x86 unseeded randomness

On Tue, 15 Aug 2017, Borislav Petkov wrote:
> On Tue, Aug 15, 2017 at 12:47:36PM +0200, Thomas Gleixner wrote:
> > 8<-------------------
> > 
> > --- a/arch/x86/kernel/tsc.c
> > +++ b/arch/x86/kernel/tsc.c
> > @@ -1360,3 +1360,19 @@ unsigned long calibrate_delay_is_known(v
> >  	return 0;
> >  }
> >  #endif
> > +
> > +u64 __init tsc_early_random(void)
> > +{
> > +	u64 uninitialized_var(res);
> > +	int i;
> > +
> > +	if (!boot_cpu_has(X86_FEATURE_TSC))
> > +		return res;
> > +
> > +	res ^= rdtsc();
> > +	for (i = 0; i < BITS_PER_LONG; i++) {
> > +		res ^= ((rdtsc() & 0x04) >> 2) << i;
> > +		udelay(2);
> > +	}
> > +	return res;
> > +}
> 
> Something like this is exactly what I was aiming at with my dumb patch.
> We could use this for early boot randomness on x86.
> 
> Should I turn it into proper patches or you want to?

Go ahead. What you actually want to do is to replace boot_cpu_has() with a
real cpuid() check because boot_cpu_has() is not initialized on real early
boot.

Thanks,

	tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ