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