Re: [RFC PATCH v1 10/18] x86/efi: Access EFI related tables in the clear

From: Matt Fleming
Date: Tue May 10 2016 - 09:44:09 EST


On Tue, 26 Apr, at 05:57:40PM, Tom Lendacky wrote:
> The EFI tables are not encrypted and need to be accessed as such. Be sure
> to memmap them without the encryption attribute set. For EFI support that
> lives outside of the arch/x86 tree, create a routine that uses the __weak
> attribute so that it can be overridden by an architecture specific routine.
>
> When freeing boot services related memory, since it has been mapped as
> un-encrypted, be sure to change the mapping to encrypted for future use.
>
> Signed-off-by: Tom Lendacky <thomas.lendacky@xxxxxxx>
> ---
> arch/x86/include/asm/cacheflush.h | 3 +
> arch/x86/include/asm/mem_encrypt.h | 22 +++++++++++
> arch/x86/kernel/setup.c | 6 +--
> arch/x86/mm/mem_encrypt.c | 56 +++++++++++++++++++++++++++
> arch/x86/mm/pageattr.c | 75 ++++++++++++++++++++++++++++++++++++
> arch/x86/platform/efi/efi.c | 26 +++++++-----
> arch/x86/platform/efi/efi_64.c | 9 +++-
> arch/x86/platform/efi/quirks.c | 12 +++++-
> drivers/firmware/efi/efi.c | 18 +++++++--
> drivers/firmware/efi/esrt.c | 12 +++---
> include/linux/efi.h | 3 +
> 11 files changed, 212 insertions(+), 30 deletions(-)

The size of this change is completely unexpected. Why is there so much
churn to workaround this new feature?

Is it not possible to maintain some kind of kernel virtual address
mapping so memremap*() and friends can figure out when to twiddle the
mapping attributes and map with/without encryption?

These API changes place an undue burden on developers that don't even
care about SME.