This is a note to let you know that I've just added the patch titled efi/x86: Fix the missing KASLR_FLAG bit in boot_params->hdr.loadflags to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: efi-x86-fix-the-missing-kaslr_flag-bit-in-boot_params-hdr.loadflags.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From stable+bounces-25911-greg=kroah.com@xxxxxxxxxxxxxxx Mon Mar 4 12:21:17 2024 From: Ard Biesheuvel <ardb+git@xxxxxxxxxx> Date: Mon, 4 Mar 2024 12:19:56 +0100 Subject: efi/x86: Fix the missing KASLR_FLAG bit in boot_params->hdr.loadflags To: stable@xxxxxxxxxxxxxxx Cc: linux-efi@xxxxxxxxxxxxxxx, Yuntao Wang <ytcoode@xxxxxxxxx>, Ard Biesheuvel <ardb@xxxxxxxxxx> Message-ID: <20240304111937.2556102-38-ardb+git@xxxxxxxxxx> From: Ard Biesheuvel <ardb+git@xxxxxxxxxx> From: Yuntao Wang <ytcoode@xxxxxxxxx> [ Commit 01638431c465741e071ab34acf3bef3c2570f878 upstream ] When KASLR is enabled, the KASLR_FLAG bit in boot_params->hdr.loadflags should be set to 1 to propagate KASLR status from compressed kernel to kernel, just as the choose_random_location() function does. Currently, when the kernel is booted via the EFI stub, the KASLR_FLAG bit in boot_params->hdr.loadflags is not set, even though it should be. This causes some functions, such as kernel_randomize_memory(), not to execute as expected. Fix it. Fixes: a1b87d54f4e4 ("x86/efistub: Avoid legacy decompressor when doing EFI boot") Signed-off-by: Yuntao Wang <ytcoode@xxxxxxxxx> [ardb: drop 'else' branch clearing KASLR_FLAG] Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/firmware/efi/libstub/x86-stub.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/firmware/efi/libstub/x86-stub.c +++ b/drivers/firmware/efi/libstub/x86-stub.c @@ -781,6 +781,8 @@ static efi_status_t efi_decompress_kerne efi_debug("AMI firmware v2.0 or older detected - disabling physical KASLR\n"); seed[0] = 0; } + + boot_params_ptr->hdr.loadflags |= KASLR_FLAG; } status = efi_random_alloc(alloc_size, CONFIG_PHYSICAL_ALIGN, &addr, Patches currently in stable-queue which might be from kroah.com@xxxxxxxxxxxxxxx are queue-6.1/x86-decompressor-avoid-magic-offsets-for-efi-handover-entrypoint.patch queue-6.1/x86-efistub-avoid-placing-the-kernel-below-load_physical_addr.patch queue-6.1/x86-efistub-avoid-legacy-decompressor-when-doing-efi-boot.patch queue-6.1/x86-efistub-perform-4-5-level-paging-switch-from-the-stub.patch queue-6.1/x86-boot-rename-conflicting-boot_params-pointer-to-boot_params_ptr.patch queue-6.1/x86-efistub-perform-snp-feature-test-while-running-in-the-firmware.patch queue-6.1/x86-efistub-simplify-and-clean-up-handover-entry-code.patch queue-6.1/efi-libstub-add-memory-attribute-protocol-definitions.patch queue-6.1/efi-libstub-add-limit-argument-to-efi_random_alloc.patch queue-6.1/efi-x86-fix-the-missing-kaslr_flag-bit-in-boot_params-hdr.loadflags.patch queue-6.1/arm64-efi-limit-allocations-to-48-bit-addressable-physical-region.patch queue-6.1/x86-efistub-prefer-efi-memory-attributes-protocol-over-dxe-services.patch queue-6.1/efi-efivars-prevent-double-registration.patch queue-6.1/x86-boot-efistub-assign-global-boot_params-variable.patch queue-6.1/x86-efistub-clear-bss-in-efi-handover-protocol-entrypoint.patch queue-6.1/x86-decompressor-factor-out-kernel-decompression-and-relocation.patch queue-6.1/efi-x86-avoid-physical-kaslr-on-older-dell-systems.patch