Преглед на файлове

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.
Tim Schumacher преди 3 години
родител
ревизия
cedec9751a
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      Kernel/Memory/AddressSpace.cpp

+ 1 - 1
Kernel/Memory/AddressSpace.cpp

@@ -28,7 +28,7 @@ ErrorOr<NonnullOwnPtr<AddressSpace>> AddressSpace::try_create(AddressSpace const
             return parent->m_region_tree.total_range();
             return parent->m_region_tree.total_range();
         constexpr FlatPtr userspace_range_base = USER_RANGE_BASE;
         constexpr FlatPtr userspace_range_base = USER_RANGE_BASE;
         FlatPtr const userspace_range_ceiling = USER_RANGE_CEILING;
         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;
         FlatPtr base = userspace_range_base + random_offset;
         return VirtualRange(VirtualAddress { base }, userspace_range_ceiling - base);
         return VirtualRange(VirtualAddress { base }, userspace_range_ceiling - base);
     }();
     }();