mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
efi/x86: Fix the missing KASLR_FLAG bit in boot_params->hdr.loadflags
From: Yuntao Wang <ytcoode@gmail.com>
[ 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: a1b87d54f4 ("x86/efistub: Avoid legacy decompressor when doing EFI boot")
Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
[ardb: drop 'else' branch clearing KASLR_FLAG]
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
3a396c409a
commit
2402392bed
@@ -781,6 +781,8 @@ static efi_status_t efi_decompress_kernel(unsigned long *kernel_entry)
|
|||||||
efi_debug("AMI firmware v2.0 or older detected - disabling physical KASLR\n");
|
efi_debug("AMI firmware v2.0 or older detected - disabling physical KASLR\n");
|
||||||
seed[0] = 0;
|
seed[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boot_params_ptr->hdr.loadflags |= KASLR_FLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = efi_random_alloc(alloc_size, CONFIG_PHYSICAL_ALIGN, &addr,
|
status = efi_random_alloc(alloc_size, CONFIG_PHYSICAL_ALIGN, &addr,
|
||||||
|
|||||||
Reference in New Issue
Block a user