Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1488951

Re: [RFC PATCH v1 09/28] x86/efi: Access EFI data as encrypted when SEV is active

From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH v1 09/28] x86/efi: Access EFI data as encrypted when SEV is active
Date 2016-09-22 16:50 +0200
Message-ID <skdu1-7CL-19@gated-at.bofh.it> (permalink)
References <s9ea6-KG-5@gated-at.bofh.it> <skdkl-7zs-17@gated-at.bofh.it> <skdkl-7zs-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 22/09/2016 16:35, Borislav Petkov wrote:
>> > @@ -230,6 +230,10 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
>> >  	efi_scratch.efi_pgt = (pgd_t *)__sme_pa(efi_pgd);
>> >  	pgd = efi_pgd;
>> >  
>> > +	flags = _PAGE_NX | _PAGE_RW;
>> > +	if (sev_active)
>> > +		flags |= _PAGE_ENC;
> So this is confusing me. There's this patch which says EFI data is
> accessed in the clear:
> 
> https://lkml.kernel.org/r/20160822223738.29880.6909.stgit@tlendack-t1.amdoffice.net
> 
> but now here it is encrypted when SEV is enabled.
> 
> Do you mean, it is encrypted here because we're in the guest kernel?

I suspect this patch is untested, and also wrong. :)

The main difference between the SME and SEV encryption, from the point
of view of the kernel, is that real-mode always writes unencrypted in
SME and always writes encrypted in SEV.  But UEFI can run in 64-bit mode
and learn about the C bit, so EFI boot data should be unprotected in SEV
guests.

Because the firmware volume is written to high memory in encrypted form,
and because the PEI phase runs in 32-bit mode, the firmware code will be
encrypted; on the other hand, data that is placed in low memory for the
kernel can be unencrypted, thus limiting differences between SME and SEV.

	Important: I don't know what you guys are doing for SEV and
	Windows guests, but if you are doing something I would really
	appreciate doing things in the open.  If Linux and Windows end
	up doing different things with EFI boot data, ACPI tables, etc.
	it will be a huge pain.  On the other hand, if we can enjoy
	being first, that's great.

In fact, I have suggested in the QEMU list that SEV guests should always
use UEFI; because BIOS runs in real-mode or 32-bit non-paging protected
mode, BIOS must always write encrypted data, which becomes painful in
the kernel.

And regarding the above "important" point, all I know is that Microsoft
for sure will be happy to restrict SEV to UEFI guests. :)

There are still some differences, mostly around the real mode trampoline
executed by the kernel, but they should be much smaller.

Paolo

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [RFC PATCH v1 09/28] x86/efi: Access EFI data as encrypted when  SEV is active Borislav Petkov <bp@suse.de> - 2016-09-22 16:40 +0200
  Re: [RFC PATCH v1 09/28] x86/efi: Access EFI data as encrypted when  SEV is active Paolo Bonzini <pbonzini@redhat.com> - 2016-09-22 16:50 +0200
    Re: [RFC PATCH v1 09/28] x86/efi: Access EFI data as encrypted when  SEV is active Paolo Bonzini <pbonzini@redhat.com> - 2016-09-22 17:10 +0200
      Re: [RFC PATCH v1 09/28] x86/efi: Access EFI data as encrypted when  SEV is active Paolo Bonzini <pbonzini@redhat.com> - 2016-09-22 19:10 +0200
        Re: [RFC PATCH v1 09/28] x86/efi: Access EFI data as encrypted when  SEV is active Borislav Petkov <bp@suse.de> - 2016-09-22 19:30 +0200
      Re: [RFC PATCH v1 09/28] x86/efi: Access EFI data as encrypted when  SEV is active Borislav Petkov <bp@suse.de> - 2016-09-22 19:10 +0200
        Re: [RFC PATCH v1 09/28] x86/efi: Access EFI data as encrypted when  SEV is active Borislav Petkov <bp@suse.de> - 2016-09-22 21:20 +0200
          Re: [RFC PATCH v1 09/28] x86/efi: Access EFI data as encrypted when  SEV is active Borislav Petkov <bp@suse.de> - 2016-09-22 22:20 +0200
    Re: [RFC PATCH v1 09/28] x86/efi: Access EFI data as encrypted when  SEV is active Borislav Petkov <bp@suse.de> - 2016-09-22 17:10 +0200
    Re: [RFC PATCH v1 09/28] x86/efi: Access EFI data as encrypted when  SEV is active Paolo Bonzini <pbonzini@redhat.com> - 2016-09-22 21:00 +0200
  Re: [RFC PATCH v1 09/28] x86/efi: Access EFI data as encrypted when  SEV is active Paolo Bonzini <pbonzini@redhat.com> - 2016-09-22 20:30 +0200
    Re: [RFC PATCH v1 09/28] x86/efi: Access EFI data as encrypted when  SEV is active Borislav Petkov <bp@suse.de> - 2016-09-22 20:40 +0200
      Re: [RFC PATCH v1 09/28] x86/efi: Access EFI data as encrypted when  SEV is active Kai Huang <kaih.linux@gmail.com> - 2016-09-23 11:40 +0200
        Re: [RFC PATCH v1 09/28] x86/efi: Access EFI data as encrypted when  SEV is active Borislav Petkov <bp@suse.de> - 2016-09-23 12:00 +0200

csiph-web