Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1712192

Re: early x86 unseeded randomness

From Borislav Petkov <bp@alien8.de>
Newsgroups linux.kernel
Subject Re: early x86 unseeded randomness
Date 2017-08-15 15:50 +0200
Message-ID <ueKoh-1VC-3@gated-at.bofh.it> (permalink)
References (4 earlier) <uesUp-83a-11@gated-at.bofh.it> <ueyZR-3cJ-31@gated-at.bofh.it> <ueDPQ-6jk-7@gated-at.bofh.it> <ueELT-6RV-1@gated-at.bofh.it> <ueHA6-bQ-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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?

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

early x86 unseeded randomness Borislav Petkov <bp@alien8.de> - 2017-08-14 19:40 +0200
  Re: early x86 unseeded randomness Linus Torvalds <torvalds@linux-foundation.org> - 2017-08-14 19:50 +0200
    Re: early x86 unseeded randomness Borislav Petkov <bp@alien8.de> - 2017-08-14 20:10 +0200
      Re: early x86 unseeded randomness Linus Torvalds <torvalds@linux-foundation.org> - 2017-08-14 20:20 +0200
        Re: early x86 unseeded randomness Borislav Petkov <bp@alien8.de> - 2017-08-14 21:10 +0200
          Re: early x86 unseeded randomness Theodore Ts'o <tytso@mit.edu> - 2017-08-15 03:40 +0200
            Re: early x86 unseeded randomness Willy Tarreau <w@1wt.eu> - 2017-08-15 08:50 +0200
              Re: early x86 unseeded randomness Ingo Molnar <mingo@kernel.org> - 2017-08-15 09:50 +0200
                Re: early x86 unseeded randomness Willy Tarreau <w@1wt.eu> - 2017-08-15 10:10 +0200
                Re: early x86 unseeded randomness Ingo Molnar <mingo@kernel.org> - 2017-08-15 10:10 +0200
                Re: early x86 unseeded randomness Theodore Ts'o <tytso@mit.edu> - 2017-08-15 14:20 +0200
                Re: early x86 unseeded randomness Willy Tarreau <w@1wt.eu> - 2017-08-15 15:30 +0200
                Re: early x86 unseeded randomness Thomas Gleixner <tglx@linutronix.de> - 2017-08-15 12:50 +0200
                Re: early x86 unseeded randomness Borislav Petkov <bp@alien8.de> - 2017-08-15 15:50 +0200
                Re: early x86 unseeded randomness Thomas Gleixner <tglx@linutronix.de> - 2017-08-15 15:50 +0200
                Re: early x86 unseeded randomness Theodore Ts'o <tytso@mit.edu> - 2017-08-15 16:30 +0200
                Re: early x86 unseeded randomness Thomas Gleixner <tglx@linutronix.de> - 2017-08-15 16:50 +0200
                Re: early x86 unseeded randomness Borislav Petkov <bp@alien8.de> - 2017-08-15 17:30 +0200
                Re: early x86 unseeded randomness Thomas Gleixner <tglx@linutronix.de> - 2017-08-15 19:40 +0200
                Re: early x86 unseeded randomness Theodore Ts'o <tytso@mit.edu> - 2017-08-16 05:40 +0200
                Re: early x86 unseeded randomness Thomas Gleixner <tglx@linutronix.de> - 2017-08-16 11:20 +0200
                Re: early x86 unseeded randomness Will Deacon <will.deacon@arm.com> - 2017-08-16 12:00 +0200
                Re: early x86 unseeded randomness Theodore Ts'o <tytso@mit.edu> - 2017-08-16 05:30 +0200
                Re: early x86 unseeded randomness Borislav Petkov <bp@alien8.de> - 2017-08-15 17:30 +0200
                Re: early x86 unseeded randomness Michael Ellerman <mpe@ellerman.id.au> - 2017-08-15 14:50 +0200

csiph-web