From: Gerd Hoffmann <kraxel@redhat.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: qemu-devel@nongnu.org, "Laurent Vivier" <laurent@vivier.eu>,
"Michael S . Tsirkin" <mst@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Ard Biesheuvel" <ardb@kernel.org>
Subject: Re: [PATCH] x86: only modify setup_data if the boot protocol indicates safety
Date: Mon, 5 Sep 2022 10:40:51 +0200 [thread overview]
Message-ID: <20220905084051.cbwjktoumwhfy5tr@sirius.home.kraxel.org> (raw)
In-Reply-To: <20220904165058.1140503-1-Jason@zx2c4.com>
On Sun, Sep 04, 2022 at 06:50:58PM +0200, Jason A. Donenfeld wrote:
> This reverts 3824e25db1 ("x86: disable rng seeding via setup_data"), and
> then makes the use of setup_data safe. It does so by checking the boot
> protocol version. If it's sufficient, then it means EFI boots won't
> crash. While we're at it, gate this on SEV too.
> @@ -463,6 +462,7 @@ static void pc_i440fx_7_0_machine_options(MachineClass *m)
> + pcmc->legacy_no_rng_seed = true;
This needs go into the pc_i440fx_7_1_machine_options function, otherwise
legacy_no_rng_seed gets flipped from false to true for 7.1 machine types
which breaks compatibility.
> @@ -398,6 +397,7 @@ static void pc_q35_7_0_machine_options(MachineClass *m)
> + pcmc->legacy_no_rng_seed = true;
Same here.
> --- a/hw/i386/x86.c
> +++ b/hw/i386/x86.c
> @@ -1088,8 +1088,15 @@ void x86_load_linux(X86MachineState *x86ms,
> qemu_guest_getrandom_nofail(setup_data->data, RNG_SEED_LENGTH);
> }
>
> - /* Offset 0x250 is a pointer to the first setup_data link. */
> - stq_p(header + 0x250, first_setup_data);
> + /*
> + * Only modify the header if doing so won't crash EFI boot, which is the
> + * case only for newer boot protocols, and don't do so either if SEV is
> + * enabled.
> + */
> + if (protocol >= 0x210 && !sev_enabled()) {
> + /* Offset 0x250 is a pointer to the first setup_data link. */
> + stq_p(header + 0x250, first_setup_data);
> + }
This should better go into a separate patch.
take care,
Gerd
next prev parent reply other threads:[~2022-09-05 8:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-04 16:50 [PATCH] x86: only modify setup_data if the boot protocol indicates safety Jason A. Donenfeld
2022-09-04 16:54 ` Jason A. Donenfeld
2022-09-05 8:40 ` Gerd Hoffmann [this message]
2022-09-06 10:27 ` Jason A. Donenfeld
2022-09-06 10:37 ` [PATCH v2 1/2] " Jason A. Donenfeld
2022-09-06 10:38 ` [PATCH v2 2/2] x86: re-enable rng seeding via setup_data Jason A. Donenfeld
2022-09-06 10:44 ` [PATCH] x86: only modify setup_data if the boot protocol indicates safety Gerd Hoffmann
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=20220905084051.cbwjktoumwhfy5tr@sirius.home.kraxel.org \
--to=kraxel@redhat.com \
--cc=Jason@zx2c4.com \
--cc=ardb@kernel.org \
--cc=f4bug@amsat.org \
--cc=laurent@vivier.eu \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).