-
- Downloads
efi: Avoid cold plugged memory for placing the kernel
commit ba69e0750b0362870294adab09339a0c39c3beaf upstream. UEFI 2.11 introduced EFI_MEMORY_HOT_PLUGGABLE to annotate system memory regions that are 'cold plugged' at boot, i.e., hot pluggable memory that is available from early boot, and described as system RAM by the firmware. Existing loaders and EFI applications running in the boot context will happily use this memory for allocating data structures that cannot be freed or moved at runtime, and this prevents the memory from being unplugged. Going forward, the new EFI_MEMORY_HOT_PLUGGABLE attribute should be tested, and memory annotated as such should be avoided for such allocations. In the EFI stub, there are a couple of occurrences where, instead of the high-level AllocatePages() UEFI boot service, a low-level code sequence is used that traverses the EFI memory map and carves out the requested number of pages from a free region. This is needed, e.g., for allocating as low as possible, or for allocating pages at random. While AllocatePages() should presumably avoid special purpose memory and cold plugged regions, this manual approach needs to incorporate this logic itself, in order to prevent the kernel itself from ending up in a hot unpluggable region, preventing it from being unplugged. So add the EFI_MEMORY_HOTPLUGGABLE macro definition, and check for it where appropriate. Cc: stable@vger.kernel.org Signed-off-by:Ard Biesheuvel <ardb@kernel.org> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
parent
bb7ef531
No related branches found
No related tags found
Showing
- drivers/firmware/efi/efi.c 4 additions, 2 deletionsdrivers/firmware/efi/efi.c
- drivers/firmware/efi/libstub/randomalloc.c 3 additions, 0 deletionsdrivers/firmware/efi/libstub/randomalloc.c
- drivers/firmware/efi/libstub/relocate.c 3 additions, 0 deletionsdrivers/firmware/efi/libstub/relocate.c
- include/linux/efi.h 1 addition, 0 deletionsinclude/linux/efi.h
Loading
Please register or sign in to comment