[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150805100728.GA572@gmail.com>
Date: Wed, 5 Aug 2015 12:07:28 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Len Brown <lenb@...nel.org>
Cc: x86@...nel.org, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, Len Brown <len.brown@...el.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [PATCH 1/1] x86: replace RDRAND forced-reseed with simple sanity
check
* Len Brown <lenb@...nel.org> wrote:
> void x86_init_rdrand(struct cpuinfo_x86 *c)
> {
> #ifdef CONFIG_ARCH_RANDOM
> unsigned long tmp;
> - int i, count, ok;
> + int i;
>
> if (!cpu_has(c, X86_FEATURE_RDRAND))
> - return; /* Nothing to do */
> + return;
>
> - for (count = i = 0; i < RESEED_LOOP; i++) {
> - ok = rdrand_long(&tmp);
> - if (ok)
> - count++;
> + for (i = 0; i < SANITY_CHECK_LOOPS; i++) {
> + if (!rdrand_long(&tmp)) {
> + clear_cpu_cap(c, X86_FEATURE_RDRAND);
> + return;
So here we should emit a printk_once() warning that something's fishy, instead of
silently disabling a CPU feature.
Thanks,
Ingo
--
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