qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: Don't add RNG seed to Linux cmdline for SEV guests
@ 2023-02-07  8:41 Dov Murik
  2023-02-07 17:28 ` Jason A. Donenfeld
                   ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Dov Murik @ 2023-02-07  8:41 UTC (permalink / raw)
  To: qemu-devel
  Cc: Dov Murik, Tom Lendacky, Jason A. Donenfeld, James Bottomley,
	Gerd Hoffmann, Daniel P. Berrangé, H. Peter Anvin,
	Paolo Bonzini, Richard Henderson, Eduardo Habkost,
	Michael S. Tsirkin, Marcel Apfelbaum, Tobin Feldman-Fitzthum

Recent feature to supply RNG seed to the guest kernel modifies the
kernel command-line by adding extra data at its end; this breaks
measured boot with SEV and OVMF, and possibly signed boot.

Specifically SEV doesn't miss this feature because it uses UEFI/OVMF
which has its own way of getting random seed (not to mention that
getting the random seed from the untrusted host breaks the confidential
computing trust model).

Disable the RNG seed feature in SEV guests.

Fixes: eac7a7791bb6 ("x86: don't let decompressed kernel image clobber setup_data")
Reported-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Dov Murik <dovmurik@linux.ibm.com>

---

There might be a need for a wider change to the ways setup_data entries
are handled in x86_load_linux(); here I just try to restore the
situation for SEV guests prior to the addition of the SETUP_RNG_SEED
entry.

Recent discussions on other (safer?) ways to pass this setup_data entry:
[1] https://lore.kernel.org/qemu-devel/da39abab9785aea2a2e7652ed6403b6268aeb31f.camel@linux.ibm.com/

Note that in qemu 7.2.0 this is broken as well -- there the
SETUP_RNG_SEED entry is appended to the Linux kernel data (and therefore
modifies and breaks the measurement of the kernel in SEV measured boot).
A similar fix will be needed there (but I fear this patch cannot be
applied as-is).
---
 hw/i386/x86.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index eaff4227bd..e65a83f8df 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -1103,7 +1103,7 @@ void x86_load_linux(X86MachineState *x86ms,
         load_image_size(dtb_filename, setup_data->data, dtb_size);
     }
 
-    if (!legacy_no_rng_seed && protocol >= 0x209) {
+    if (!legacy_no_rng_seed && protocol >= 0x209 && !sev_enabled()) {
         setup_data_offset = cmdline_size;
         cmdline_size += sizeof(SetupData) + RNG_SEED_LENGTH;
         kernel_cmdline = g_realloc(kernel_cmdline, cmdline_size);

base-commit: 6661b8c7fe3f8b5687d2d90f7b4f3f23d70e3e8b
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2023-02-08 15:55 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-07  8:41 [PATCH] x86: Don't add RNG seed to Linux cmdline for SEV guests Dov Murik
2023-02-07 17:28 ` Jason A. Donenfeld
2023-02-07 21:45 ` Michael S. Tsirkin
2023-02-07 22:17   ` Jason A. Donenfeld
2023-02-07 22:31     ` Michael S. Tsirkin
2023-02-07 22:33       ` Jason A. Donenfeld
2023-02-07 22:49         ` Jason A. Donenfeld
2023-02-08  9:11         ` Michael S. Tsirkin
2023-02-08 11:23           ` Dov Murik
2023-02-08 13:20             ` Michael S. Tsirkin
2023-02-08 13:30               ` Jason A. Donenfeld
2023-02-08 13:58                 ` Michael S. Tsirkin
2023-02-07 23:21   ` Tom Lendacky
2023-02-07 23:24     ` Jason A. Donenfeld
2023-02-08 11:35       ` Dov Murik
2023-02-08 15:26       ` Tom Lendacky
2023-02-08 15:39         ` Michael S. Tsirkin
2023-02-08 15:47         ` Jason A. Donenfeld
2023-02-08 15:49         ` Dov Murik
2023-02-08 15:51           ` Jason A. Donenfeld
2023-02-08 15:52           ` Dov Murik
2023-02-08 15:54           ` Jason A. Donenfeld
2023-02-08 11:57     ` Dov Murik
2023-02-08  9:35   ` Daniel P. Berrangé
2023-02-08  9:50     ` Michael S. Tsirkin
2023-02-08  9:30 ` Daniel P. Berrangé
2023-02-08 11:27   ` Dov Murik

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).