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.
This commit is contained in:
Tim Schumacher 2022-06-04 19:59:34 +02:00 committed by Linus Groh
parent cead476816
commit cedec9751a
Notes: sideshowbarker 2024-07-17 10:02:46 +09:00

View File

@ -28,7 +28,7 @@ ErrorOr<NonnullOwnPtr<AddressSpace>> 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<u8>() % 32 * MiB) & PAGE_MASK;
size_t random_offset = (get_fast_random<u8>() % 2 * MiB) & PAGE_MASK;
FlatPtr base = userspace_range_base + random_offset;
return VirtualRange(VirtualAddress { base }, userspace_range_ceiling - base);
}();