From cedec9751a1a0ac1d1eb517ac3ff1c2ca0bf12b5 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Sat, 4 Jun 2022 19:59:34 +0200 Subject: [PATCH] Kernel: Decrease the amount of address space offset randomization This is basically unchanged since the beginning of 2020, which is a year before we had proper ASLR. Now that we have a proper ASLR implementation, we can turn this down a bit, as it is no longer our only protection against predictable dynamic loader addresses, and it actually obstructs the default loading address of x86_64 quite frequently. --- Kernel/Memory/AddressSpace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/Memory/AddressSpace.cpp b/Kernel/Memory/AddressSpace.cpp index 50cd70eb73..3c4b801313 100644 --- a/Kernel/Memory/AddressSpace.cpp +++ b/Kernel/Memory/AddressSpace.cpp @@ -28,7 +28,7 @@ ErrorOr> AddressSpace::try_create(AddressSpace const return parent->m_region_tree.total_range(); constexpr FlatPtr userspace_range_base = USER_RANGE_BASE; FlatPtr const userspace_range_ceiling = USER_RANGE_CEILING; - size_t random_offset = (get_fast_random() % 32 * MiB) & PAGE_MASK; + size_t random_offset = (get_fast_random() % 2 * MiB) & PAGE_MASK; FlatPtr base = userspace_range_base + random_offset; return VirtualRange(VirtualAddress { base }, userspace_range_ceiling - base); }();