From: "H. Peter Anvin" <hpa@zytor.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
Andy Lutomirski <luto@kernel.org>
Subject: Re: [PATCH tip v9] x86/setup: Use rng seeds from setup_data
Date: Sat, 9 Jul 2022 15:42:50 -0700 [thread overview]
Message-ID: <ec46a292-dcc1-c12b-25a0-491b522c2db8@zytor.com> (raw)
In-Reply-To: <20220709094853.1090735-1-Jason@zx2c4.com>
On 7/9/22 02:48, Jason A. Donenfeld wrote:
> Currently the only way x86 can get an early boot RNG seed is via EFI,
> which is generally always used now for physical machines, but is very
> rarely used in VMs, especially VMs that are optimized for starting
> "instantaneously", such as Firecracker's MicroVM. For tiny fast booting
> VMs, EFI is not something you generally need or want.
>
> Rather, here we want the ability for the image loader or firmware to
> pass a single random seed, exactly as device tree platforms do with the
> "rng-seed" property. Additionally, this is something that bootloaders
> can append, with their own seed file management, which is something
> every other major OS ecosystem has that we do not (yet).
>
> This patch adds SETUP_RNG_SEED, similar to the other seven setup_data
> entries that are parsed at boot. It also takes care to zero out the seed
> immediately after using, in order to retain forward secrecy. This all
> takes about 7 trivial lines of code.
>
> Then, on kexec_file_load(), a new fresh seed is generated and passed to
> the next kernel, just as is done on device tree architectures when
> using kexec. And, importantly, I've tested that QEMU is able to properly
> pass SETUP_RNG_SEED as well, making this work for every step of the way.
> This code too is pretty straight forward.
>
> Together these measures ensure that VMs and nested kexec()'d kernels
> always receive a proper boot time RNG seed at the earliest possible
> stage from their parents:
>
> - Host [already has strongly initialized RNG]
> - QEMU [passes fresh seed in SETUP_RNG_SEED field]
> - Linux [uses parent's seed and gathers entropy of its own]
> - kexec [passes this in SETUP_RNG_SEED field]
> - Linux [uses parent's seed and gathers entropy of its own]
> - kexec [passes this in SETUP_RNG_SEED field]
> - Linux [uses parent's seed and gathers entropy of its own]
> - kexec [passes this in SETUP_RNG_SEED field]
> - ...
>
> I've verified in several scenarios that this works quite well from a
> host kernel to QEMU and down inwards, mixing and matching loaders, with
> every layer providing a seed to the next.
>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Acked-by: H. Peter Anvin (Intel) <hpa@zytor.com>
> ---
> Changes v8->v9:
> - [hpa] Update SETUP_TYPE_MAX and add SETUP_ENUM_MAX.
next prev parent reply other threads:[~2022-07-09 22:43 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-30 11:33 [PATCH] x86/setup: Allow passing RNG seeds via e820 setup table Jason A. Donenfeld
2022-06-30 11:59 ` [PATCH v2] " Jason A. Donenfeld
2022-06-30 12:09 ` [PATCH v3] " Jason A. Donenfeld
2022-06-30 13:31 ` [PATCH v4] " Jason A. Donenfeld
2022-07-01 17:58 ` [PATCH v5] " Jason A. Donenfeld
2022-07-01 18:25 ` H. Peter Anvin
2022-07-01 18:42 ` Jason A. Donenfeld
2022-07-01 18:52 ` H. Peter Anvin
2022-07-01 18:53 ` Jason A. Donenfeld
2022-07-03 0:44 ` [PATCH v6] x86/setup: Use rng seeds from setup_data Jason A. Donenfeld
2022-07-07 0:08 ` [PATCH v7] " Jason A. Donenfeld
2022-07-08 11:39 ` [PATCH tip v8] " Jason A. Donenfeld
2022-07-09 1:51 ` H. Peter Anvin
2022-07-09 9:43 ` Jason A. Donenfeld
2022-07-09 9:48 ` [PATCH tip v9] " Jason A. Donenfeld
2022-07-09 22:42 ` H. Peter Anvin [this message]
2022-07-09 23:23 ` Jason A. Donenfeld
2022-07-09 9:49 ` [PATCH tip v8] " Borislav Petkov
2022-07-09 9:53 ` Jason A. Donenfeld
2022-07-09 10:21 ` Borislav Petkov
2022-07-09 21:45 ` H. Peter Anvin
2022-07-09 21:57 ` Borislav Petkov
2022-07-09 22:41 ` H. Peter Anvin
2022-07-10 9:45 ` Borislav Petkov
2022-07-10 11:11 ` Jason A. Donenfeld
2022-07-10 12:27 ` Borislav Petkov
2022-07-10 17:13 ` Jason A. Donenfeld
2022-07-10 17:29 ` [PATCH tip v10] " Jason A. Donenfeld
2022-07-11 9:39 ` [tip: x86/kdump] " tip-bot2 for 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=ec46a292-dcc1-c12b-25a0-491b522c2db8@zytor.com \
--to=hpa@zytor.com \
--cc=Jason@zx2c4.com \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--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
all inboxes | Powered by JetHome®