Kernel: Disable KASLR on i686

The 32-bit CI runners don't seem to happy with KASLR, so let's make it
x86-64 only for now.
This commit is contained in:
Andreas Kling 2022-03-22 02:47:27 +01:00
parent 9b9d32dfb2
commit b6e767f953
Notes: sideshowbarker 2024-07-17 16:57:47 +09:00

View file

@ -95,10 +95,13 @@ extern "C" [[noreturn]] void init()
#else
FlatPtr kernel_load_base = 0x2000200000;
#endif
#if ARCH(X86_64)
// KASLR
static constexpr auto maximum_offset = 256 * MiB;
kernel_load_base = kernel_load_base + (generate_secure_seed() % maximum_offset);
kernel_load_base = kernel_load_base & ~(PAGE_SIZE - 1);
#endif
FlatPtr kernel_load_end = 0;
for (size_t i = 0; i < kernel_elf_header.e_phnum; i++) {