efi/x86: Only copy the compressed kernel image in efi_relocate_kernel()
authorArvind Sankar <nivedita@alum.mit.edu>
Sun, 11 Oct 2020 14:20:12 +0000 (10:20 -0400)
committerArd Biesheuvel <ardb@kernel.org>
Mon, 26 Oct 2020 07:06:36 +0000 (08:06 +0100)
commit688eb28211abdf82a3f51e8997f1c8137947227d
tree23baec172b555cb0efd66668a796440358999715
parentbc13809f1c47245cd584f4ad31ad06a5c5f40e54
efi/x86: Only copy the compressed kernel image in efi_relocate_kernel()

The image_size argument to efi_relocate_kernel() is currently specified
as init_size, but this is unnecessarily large. The compressed kernel is
much smaller, in fact, its image only extends up to the start of _bss,
since at this point, the .bss section is still uninitialized.

Depending on compression level, this can reduce the amount of data
copied by 4-5x.

Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Link: https://lore.kernel.org/r/20201011142012.96493-1-nivedita@alum.mit.edu
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/libstub/x86-stub.c