From: Sultan Alsawaf <sultanxda@gmail.com>
To: Justin Forbes <jmforbes@linuxtx.org>
Cc: "Theodore Y. Ts'o" <tytso@mit.edu>,
Jeremy Cline <jeremy@jcline.org>, Pavel Machek <pavel@ucw.cz>,
LKML <linux-kernel@vger.kernel.org>, Jann Horn <jannh@google.com>
Subject: Re: Linux messages full of `random: get_random_u32 called from`
Date: Tue, 1 May 2018 17:43:17 -0700 [thread overview]
Message-ID: <20180502004317.kxwiu2oephgbi6ok@sultan-box> (raw)
In-Reply-To: <CAFxkdArLwrG8x6fNtLUfHedKrH_0d97V6UEzOCBgK8Shkir9pQ@mail.gmail.com>
On Tue, May 01, 2018 at 05:35:56PM -0500, Justin Forbes wrote:
>
> I have not reproduced in GCE myself. We did get some confirmation
> that removing dracut-fips does make the problem less dire (but I
> wouldn't call a 4 minute boot a win, but booting in 4 minutes is
> better than not booting at all). Specifically systemd calls libgcrypt
> before it even opens the log with fips there, and this is before
> virtio-rng modules could even load. Right now though, we are looking
> at pretty much any possible options as the majority of people are
> calling for me to backout the patches completely from rawhide.
I've attached what I think is a reasonable stopgap solution until this is
actually fixed. If you're willing to revert the CVE-2018-1108 patches
completely, then I don't think you'll mind using this patch in the meantime.
Sultan
>From 5be2efdde744d3c55db3df81c0493fc67dc35620 Mon Sep 17 00:00:00 2001
From: Sultan Alsawaf <sultanxda@gmail.com>
Date: Tue, 1 May 2018 17:36:17 -0700
Subject: [PATCH] random: use urandom instead of random for now and speed up
crng init
With the fixes for CVE-2018-1108, /dev/random now requires user-provided
entropy on quite a few machines lacking high levels of boot entropy
in order to complete its initialization. This causes issues on environments
where userspace depends on /dev/random in order to finish booting
completely (i.e., userspace will remain stuck, unable to boot, waiting for
entropy more-or-less indefinitely until the user provides it via something
like keystrokes or mouse movements).
As a temporary workaround, redirect /dev/random to /dev/urandom instead,
and speed up the initialization process by slightly relaxing the
threshold for interrupts to go towards adding one bit of entropy credit
(only until initialization is complete).
Signed-off-by: Sultan Alsawaf <sultanxda@gmail.com>
---
drivers/char/mem.c | 3 ++-
drivers/char/random.c | 9 ++++++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index ffeb60d3434c..cc9507f01c79 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -870,7 +870,8 @@ static const struct memdev {
#endif
[5] = { "zero", 0666, &zero_fops, 0 },
[7] = { "full", 0666, &full_fops, 0 },
- [8] = { "random", 0666, &random_fops, 0 },
+ /* Redirect /dev/random to /dev/urandom until /dev/random is fixed */
+ [8] = { "random", 0666, &urandom_fops, 0 },
[9] = { "urandom", 0666, &urandom_fops, 0 },
#ifdef CONFIG_PRINTK
[11] = { "kmsg", 0644, &kmsg_fops, 0 },
diff --git a/drivers/char/random.c b/drivers/char/random.c
index d9e38523b383..bce3b43cdd3b 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1200,9 +1200,12 @@ void add_interrupt_randomness(int irq)
return;
}
- if ((fast_pool->count < 64) &&
- !time_after(now, fast_pool->last + HZ))
- return;
+ if (fast_pool->count < 64) {
+ unsigned long timeout = crng_ready() ? HZ : HZ / 4;
+
+ if (!time_after(now, fast_pool->last + timeout))
+ return;
+ }
r = &input_pool;
if (!spin_trylock(&r->lock))
--
2.14.1
next prev parent reply other threads:[~2018-05-02 0:43 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-26 4:11 Linux messages full of `random: get_random_u32 called from` Sultan Alsawaf
2018-04-26 5:00 ` Theodore Y. Ts'o
2018-04-26 5:05 ` Sultan Alsawaf
2018-04-26 7:32 ` Theodore Y. Ts'o
2018-04-26 15:17 ` Sultan Alsawaf
2018-04-26 19:25 ` Theodore Y. Ts'o
2018-04-26 20:22 ` Sultan Alsawaf
2018-04-26 20:47 ` Christian Brauner
2018-04-27 0:00 ` Theodore Y. Ts'o
2018-04-27 15:38 ` Jason A. Donenfeld
2018-04-27 19:14 ` Theodore Y. Ts'o
2018-04-26 23:56 ` Theodore Y. Ts'o
2018-04-27 5:20 ` Sultan Alsawaf
2018-04-27 20:10 ` Theodore Y. Ts'o
2018-04-27 22:59 ` Sultan Alsawaf
2018-04-29 14:32 ` Pavel Machek
2018-04-29 17:05 ` Sultan Alsawaf
2018-04-29 18:41 ` Pavel Machek
2018-04-29 20:20 ` Sultan Alsawaf
2018-04-29 21:18 ` Pavel Machek
2018-04-29 21:34 ` Sultan Alsawaf
2018-04-29 22:05 ` Theodore Y. Ts'o
2018-04-29 22:26 ` Sultan Alsawaf
2018-04-29 22:43 ` Jason A. Donenfeld
2018-04-29 22:49 ` Sultan Alsawaf
2018-04-30 0:11 ` Theodore Y. Ts'o
2018-04-30 4:34 ` Sultan Alsawaf
2018-04-30 16:11 ` Theodore Y. Ts'o
2018-05-01 19:53 ` Pavel Machek
2018-04-29 22:43 ` Pavel Machek
2018-04-30 0:32 ` Laura Abbott
2018-04-30 21:12 ` Jeremy Cline
2018-05-01 11:52 ` Justin Forbes
2018-05-01 12:55 ` Theodore Y. Ts'o
2018-05-01 22:35 ` Justin Forbes
2018-05-02 0:02 ` Theodore Y. Ts'o
2018-05-02 12:09 ` Justin Forbes
2018-05-02 16:26 ` Theodore Y. Ts'o
2018-05-02 17:49 ` Laura Abbott
2018-05-02 22:25 ` Theodore Y. Ts'o
2018-05-03 6:19 ` Pavel Machek
2018-05-03 12:23 ` Justin Forbes
2018-05-02 0:43 ` Sultan Alsawaf [this message]
2018-05-02 0:56 ` Theodore Y. Ts'o
2018-05-02 1:11 ` Sultan Alsawaf
2018-04-29 18:30 ` Sultan Alsawaf
2018-04-29 20:08 ` Theodore Y. Ts'o
2018-05-18 1:27 ` Trent Piepho
2018-05-18 2:32 ` Theodore Y. Ts'o
2018-05-18 22:56 ` Trent Piepho
2018-05-18 23:22 ` Theodore Y. Ts'o
2018-05-21 18:39 ` Trent Piepho
2018-04-29 14:29 ` Pavel Machek
-- strict thread matches above, loose matches on Subject: below --
2018-04-24 11:48 Paul Menzel
2018-04-24 13:56 ` Theodore Y. Ts'o
2018-04-24 14:30 ` Paul Menzel
2018-04-24 15:49 ` Theodore Y. Ts'o
2018-04-24 15:56 ` Paul Menzel
2018-04-25 7:41 ` Theodore Y. Ts'o
2018-04-26 3:48 ` Paul Menzel
2018-04-29 14:22 ` Pavel Machek
2018-04-29 23:02 ` Dave Jones
2018-04-29 23:07 ` Dave Jones
2018-04-30 0:21 ` Theodore Y. Ts'o
2018-04-26 5:51 ` Pavel Machek
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=20180502004317.kxwiu2oephgbi6ok@sultan-box \
--to=sultanxda@gmail.com \
--cc=jannh@google.com \
--cc=jeremy@jcline.org \
--cc=jmforbes@linuxtx.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=tytso@mit.edu \
/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