[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0012cd4d-d432-ae14-1041-5e8b62973b37@amd.com>
Date: Thu, 22 Sep 2016 13:47:59 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: Paolo Bonzini <pbonzini@...hat.com>, Borislav Petkov <bp@...e.de>,
"Brijesh Singh" <brijesh.singh@....com>
CC: <simon.guinot@...uanux.org>, <linux-efi@...r.kernel.org>,
<kvm@...r.kernel.org>, <rkrcmar@...hat.com>,
<matt@...eblueprint.co.uk>, <linus.walleij@...aro.org>,
<linux-mm@...ck.org>, <paul.gortmaker@...driver.com>,
<hpa@...or.com>, <dan.j.williams@...el.com>, <aarcange@...hat.com>,
<sfr@...b.auug.org.au>, <andriy.shevchenko@...ux.intel.com>,
<herbert@...dor.apana.org.au>, <bhe@...hat.com>,
<xemul@...allels.com>, <joro@...tes.org>, <x86@...nel.org>,
<mingo@...hat.com>, <msalter@...hat.com>,
<ross.zwisler@...ux.intel.com>, <dyoung@...hat.com>,
<jroedel@...e.de>, <keescook@...omium.org>, <toshi.kani@....com>,
<mathieu.desnoyers@...icios.com>, <devel@...uxdriverproject.org>,
<tglx@...utronix.de>, <mchehab@...nel.org>,
<iamjoonsoo.kim@....com>, <labbott@...oraproject.org>,
<tony.luck@...el.com>, <alexandre.bounine@....com>,
<kuleshovmail@...il.com>, <linux-kernel@...r.kernel.org>,
<mcgrof@...nel.org>, <linux-crypto@...r.kernel.org>,
<akpm@...ux-foundation.org>, <davem@...emloft.net>
Subject: Re: [RFC PATCH v1 09/28] x86/efi: Access EFI data as encrypted when
SEV is active
On 09/22/2016 09:45 AM, Paolo Bonzini wrote:
>
>
> 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. :)
Yes, it is untested but not sure that it is wrong... It all depends on
how we add SEV support to the guest UEFI BIOS. My take would be to have
the EFI data and ACPI tables encrypted.
>
> 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.
I like the idea of limiting the differences but it would leave the EFI
data and ACPI tables exposed and able to be manipulated.
>
> 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.
We haven't discussed Windows guests under SEV yet, but as you say, we
need to do things the same.
Thanks,
Tom
>
> 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
>
Powered by blists - more mailing lists