linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: "Theodore Y. Ts'o" <tytso@mit.edu>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rik van Riel <riel@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Philippe Ombredanne <pombredanne@nexb.com>,
	Kees Cook <keescook@chromium.org>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	Kate Stewart <kstewart@linuxfoundation.org>
Subject: Re: [PATCH v2] x86, random: Fix get_random_bytes() warning in x86 start_kernel
Date: Fri, 8 Feb 2019 08:14:45 -0500	[thread overview]
Message-ID: <ea4c44c8-a6f1-dac2-7cf8-a1a0443a39f0@redhat.com> (raw)
In-Reply-To: <20190204155535.GC9802@mit.edu>



On 2/4/19 10:55 AM, Theodore Y. Ts'o wrote:
> On Sun, Feb 03, 2019 at 08:09:37AM -0500, Prarit Bhargava wrote:
>> Ted, the bug I'm trying to fix is the warning:
>>
>> random: get_random_bytes called from start_kernel+0x8e/0x587 with crng_init=0
>>
>> during early boot.  Even with the kernel parameter the warning appears.
> 
> Sometimes the warnings are real, and shouldn't be suppressed.  A
> Debian maintainer once tried to suppress a compile-time warning, and
> it was disastrous for security.  :-)
> 
> What line number is that corresponding to?  It sounds like something
> is trying to use get_random_bytes() before the random driver was
> initialized, and so the first question is does it really need to call
> get_random_bytes() then or can it be moved?
> 

Yes, that's exactly the case.  During early boot we initialize the boot cpu's
stack canary at arch/x86/include/asm/stackprotector.h:75 which is well before
the random driver is initialized.  The same code is called for all other cpus,
so perhaps not calling get_random_bytes() for the boot cpu is another option.

>>> Also, relying on the TSC for entropy is not something we should be
>>> recommending.
>>
>> The current code uses the TSC.  It is not something new I'm introducing.
> 
> But we don't *rely* on it.  That's a big difference.

Perhaps I'm confusing you by changing the comment.  I'm not changing any
behaviour wrt TSC.  The current code "relies" on the TSC as much as it did
before (all the way back through the git history).

P.

> 
>        	     	       	    	     - Ted
> 

  reply	other threads:[~2019-02-08 13:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-01 18:08 [PATCH v2] x86, random: Fix get_random_bytes() warning in x86 start_kernel Prarit Bhargava
2019-02-02  3:02 ` Theodore Y. Ts'o
2019-02-03 13:09   ` Prarit Bhargava
2019-02-04 15:55     ` Theodore Y. Ts'o
2019-02-08 13:14       ` Prarit Bhargava [this message]
2019-02-08 17:43         ` Theodore Y. Ts'o

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=ea4c44c8-a6f1-dac2-7cf8-a1a0443a39f0@redhat.com \
    --to=prarit@redhat.com \
    --cc=Jason@zx2c4.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pombredanne@nexb.com \
    --cc=riel@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tytso@mit.edu \
    --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).