mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 23:25:20 +00:00
Kernel: Use the whole kernel PD range when randomizing the KASLR offset
Now that we reclaim the memory range that is created by KASLR before the start of the kernel image, there's no need to be conservative with the KASLR offset.
This commit is contained in:
committed by
Idan Horowitz
parent
e0c7727934
commit
f0166efe8c
@@ -97,7 +97,7 @@ extern "C" [[noreturn]] void init()
|
||||
#endif
|
||||
|
||||
// KASLR
|
||||
static constexpr auto maximum_offset = 256 * MiB;
|
||||
FlatPtr maximum_offset = (FlatPtr)KERNEL_PD_SIZE - MAX_KERNEL_SIZE - 2 * MiB; // The first 2 MiB are used for mapping the pre-kernel
|
||||
FlatPtr kernel_load_base = default_kernel_load_base + (generate_secure_seed() % maximum_offset);
|
||||
kernel_load_base &= ~(2 * MiB - 1);
|
||||
|
||||
@@ -184,7 +184,6 @@ extern "C" [[noreturn]] void init()
|
||||
info.end_of_prekernel_image = (PhysicalPtr)end_of_prekernel_image;
|
||||
info.physical_to_virtual_offset = kernel_load_base - kernel_physical_base;
|
||||
info.kernel_mapping_base = kernel_mapping_base;
|
||||
info.default_kernel_load_base = default_kernel_load_base;
|
||||
info.kernel_load_base = kernel_load_base;
|
||||
#if ARCH(X86_64)
|
||||
info.gdt64ptr = (PhysicalPtr)gdt64ptr;
|
||||
|
||||
Reference in New Issue
Block a user