linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Borislav Petkov <bp@alien8.de>, "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Heiko Carstens <hca@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH] random: remove CONFIG_ARCH_RANDOM and "nordrand"
Date: Tue, 05 Jul 2022 14:50:34 -0700	[thread overview]
Message-ID: <11C903CC-22A7-48EE-AD63-E71CC8D28B88@zytor.com> (raw)
In-Reply-To: <YsSXkNBtB6Ciy9iN@zn.tnic>

On July 5, 2022 12:57:04 PM PDT, Borislav Petkov <bp@alien8.de> wrote:
>On Tue, Jul 05, 2022 at 09:44:17PM +0200, Jason A. Donenfeld wrote:
>> Oh, huh. Maybe in that case I should adjust the message to say "consider
>> using `random.trust_cpu=0`," which is the thing that would actually make
>> a security difference.
>
>Why isn't that option documented in
>Documentation/admin-guide/kernel-parameters.txt?
>
>> But actually, one thing that wasn't clear to me was: does `nordrand`
>> affect what userspace sees? While random.c is okay in lots of
>> circumstances, I could imagine `nordrand` playing a role in preventing
>> userspace from using it, which might be desirable. Is this the case? If
>> so, I can remove the nordrand chunk from this patch for v2. If not, I'll
>> adjust the text to mention `random.trust_cpu=0`.
>
>Unfortunately, it doesn't disable the instruction. It would be lovely if
>we had a switch like that...
>
>That's why this message is supposed to be noisy so that people can pay
>attention at least.
>
>> In the sense that random.c can handle mostly any input without making
>> the quality worse. So, you can't accidentally taint it. The only risk is
>> if it thinks RDRAND is good and trustable when it isn't, but that's what
>> `random.trust_cpu=0` is for.
>
>And that's why I'm saying that if you detect RDRAND returning the
>same thing over and over again, you should simply stop using it.
>Automatically. Not rely on the user to do anything.
>

It's just math. The only variable is your confidence level, i.e. at what level do you decide that the likelihood of pure chance is way smaller than the likelihood of hardware failure. For example, the likelihood of m n-bit samples in a row being identical is 2^-(n*(m-3/2)), and the likelihood of the CPU being destroyed by a meterorite in the same microsecond is about 2^-100.


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-07-05 21:52 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-05 19:01 [PATCH] random: remove CONFIG_ARCH_RANDOM and "nordrand" Jason A. Donenfeld
2022-07-05 19:36 ` Borislav Petkov
2022-07-05 19:44   ` Jason A. Donenfeld
2022-07-05 19:57     ` Borislav Petkov
2022-07-05 21:50       ` H. Peter Anvin [this message]
2022-07-05 22:00         ` Borislav Petkov
2022-07-05 23:11           ` H. Peter Anvin
2022-07-06 12:23             ` Borislav Petkov
2022-07-06 16:42               ` H. Peter Anvin
2022-07-06  0:28         ` Jason A. Donenfeld
2022-07-06  0:32           ` [PATCH v2] random: remove CONFIG_ARCH_RANDOM Jason A. Donenfeld
2022-07-06  6:41             ` Greg Kroah-Hartman
2022-07-06  8:40             ` Heiko Carstens
2022-07-06 10:54             ` [PATCH v3] " Jason A. Donenfeld
2022-07-06 12:35               ` Borislav Petkov
2022-07-06 13:55                 ` Jason A. Donenfeld
2022-07-06 14:35                   ` [PATCH v4] " Jason A. Donenfeld
2022-07-08  0:40                     ` [PATCH v5] " Jason A. Donenfeld
2022-07-13 15:46                       ` Catalin Marinas
2022-07-18 12:53                       ` Michael Ellerman
2022-08-12 13:50                       ` Geert Uytterhoeven
2022-07-06 12:30           ` [PATCH] random: remove CONFIG_ARCH_RANDOM and "nordrand" Borislav Petkov
2022-07-06 14:55 ` Theodore Ts'o
2022-07-06 15:24   ` Jason A. Donenfeld

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=11C903CC-22A7-48EE-AD63-E71CC8D28B88@zytor.com \
    --to=hpa@zytor.com \
    --cc=Jason@zx2c4.com \
    --cc=agordeev@linux.ibm.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hca@linux.ibm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=tglx@linutronix.de \
    --cc=will@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).