diff options
author | Tom Lendacky <thomas.lendacky@amd.com> | 2021-10-20 13:02:11 -0500 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2021-12-05 16:44:52 +0100 |
commit | 1ff2fc02862d52e18fd3daabcfe840ec27e920a8 (patch) | |
tree | 9ef2bb3e7a2c481969977ec48e72c94019c6b0bc /include/linux/efi.h | |
parent | fa55b7dcdc43c1aa1ba12bca9d2dd4318c2a0dbf (diff) | |
download | linux-1ff2fc02862d52e18fd3daabcfe840ec27e920a8.tar.gz linux-1ff2fc02862d52e18fd3daabcfe840ec27e920a8.tar.bz2 linux-1ff2fc02862d52e18fd3daabcfe840ec27e920a8.zip |
x86/sme: Explicitly map new EFI memmap table as encrypted
Reserving memory using efi_mem_reserve() calls into the x86
efi_arch_mem_reserve() function. This function will insert a new EFI
memory descriptor into the EFI memory map representing the area of
memory to be reserved and marking it as EFI runtime memory. As part
of adding this new entry, a new EFI memory map is allocated and mapped.
The mapping is where a problem can occur. This new memory map is mapped
using early_memremap() and generally mapped encrypted, unless the new
memory for the mapping happens to come from an area of memory that is
marked as EFI_BOOT_SERVICES_DATA memory. In this case, the new memory will
be mapped unencrypted. However, during replacement of the old memory map,
efi_mem_type() is disabled, so the new memory map will now be long-term
mapped encrypted (in efi.memmap), resulting in the map containing invalid
data and causing the kernel boot to crash.
Since it is known that the area will be mapped encrypted going forward,
explicitly map the new memory map as encrypted using early_memremap_prot().
Cc: <stable@vger.kernel.org> # 4.14.x
Fixes: 8f716c9b5feb ("x86/mm: Add support to access boot related data in the clear")
Link: https://lore.kernel.org/all/ebf1eb2940405438a09d51d121ec0d02c8755558.1634752931.git.thomas.lendacky@amd.com/
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
[ardb: incorporate Kconfig fix by Arnd]
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'include/linux/efi.h')
0 files changed, 0 insertions, 0 deletions