On Tue, Sep 06, 2022 at 12:46:32PM +0200, Jason A. Donenfeld wrote:
> On Tue, Sep 06, 2022 at 06:45:34AM -0400, Michael S. Tsirkin wrote:
> > On Tue, Sep 06, 2022 at 12:43:55PM +0200, Jason A. Donenfeld wrote:
> > > On Tue, Sep 6, 2022 at 12:40 PM Michael S. Tsirkin <[email protected]>
> > > wrote:
> > > >
> > > > On Tue, Sep 06, 2022 at 12:36:56PM +0200, Jason A. Donenfeld wrote:
> > > > > It's only safe to modify the setup_data pointer on newer kernels where
> > > > > the EFI stub loader will ignore it. So condition setting that offset
> > > > > on
> > > > > the newer boot protocol version. While we're at it, gate this on SEV
> > > > > too.
> > > > > This depends on the kernel commit linked below going upstream.
> > > > >
> > > > > Cc: Gerd Hoffmann <[email protected]>
> > > > > Cc: Laurent Vivier <[email protected]>
> > > > > Cc: Michael S. Tsirkin <[email protected]>
> > > > > Cc: Paolo Bonzini <[email protected]>
> > > > > Cc: Peter Maydell <[email protected]>
> > > > > Cc: Philippe Mathieu-Daudé <[email protected]>
> > > > > Cc: Richard Henderson <[email protected]>
> > > > > Cc: Ard Biesheuvel <[email protected]>
> > > > > Link:
> > > > > https://lore.kernel.org/linux-efi/[email protected]/
> > > > > Signed-off-by: Jason A. Donenfeld <[email protected]>
> > > >
> > > > BTW what does it have to do with SEV?
> > > > Is this because SEV is not going to trust the data to be random anyway?
> > >
> > > Daniel (now CC'd) pointed out in one of the previous threads that this
> > > breaks SEV, because the image hash changes.
> > >
> > > Jason
> >
> > Oh I see. I'd add a comment maybe and definitely mention this
> > in the commit log.
>
> Sure, will do.
Actually, I'm wrong. This is already done implicitly below with a huge
comment:
/*
* If we're starting an encrypted VM, it will be OVMF based, which uses the
* efi stub for booting and doesn't require any values to be placed in the
* kernel header. We therefore don't update the header so the hash of the
* kernel on the other side of the fw_cfg interface matches the hash of the
* file the user passed in.
*/
if (!sev_enabled()) {
memcpy(setup, header, MIN(sizeof(header), setup_size));
}
So I'll remove the SEV bit from this commit. Whoops. Glad you asked
about it.
Jason