From: Ingo Molnar <mingo@kernel.org>
To: Len Brown <lenb@kernel.org>
Cc: x86@kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org, Len Brown <len.brown@intel.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH 1/1] x86: replace RDRAND forced-reseed with simple sanity check
Date: Wed, 5 Aug 2015 12:07:28 +0200 [thread overview]
Message-ID: <20150805100728.GA572@gmail.com> (raw)
In-Reply-To: <001e354e9435443b1720838a111620c4eec12a61.1438356386.git.len.brown@intel.com>
* Len Brown <lenb@kernel.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
prev parent reply other threads:[~2015-08-05 10:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-31 15:27 [PATCH 1/1] x86: replace RDRAND forced-reseed with simple sanity check Len Brown
2015-08-02 16:03 ` Pavel Machek
2015-08-03 17:20 ` Len Brown
2015-08-02 17:42 ` Jeff Epler
2015-08-02 18:50 ` Thomas Gleixner
2015-08-05 10:07 ` Ingo Molnar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150805100728.GA572@gmail.com \
--to=mingo@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=len.brown@intel.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).