mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:37:35 +00:00
Kernel: Use get_fast_random() for MAP_RANDOMIZED addresses
Let's not block sys$mmap() on kernel randomness.
This commit is contained in:
parent
d8fa479d05
commit
19fc62f445
1 changed files with 1 additions and 1 deletions
|
@ -90,7 +90,7 @@ Optional<Range> RangeAllocator::allocate_randomized(size_t size, size_t alignmen
|
||||||
// FIXME: I'm sure there's a smarter way to do this.
|
// FIXME: I'm sure there's a smarter way to do this.
|
||||||
static constexpr size_t maximum_randomization_attempts = 1000;
|
static constexpr size_t maximum_randomization_attempts = 1000;
|
||||||
for (size_t i = 0; i < maximum_randomization_attempts; ++i) {
|
for (size_t i = 0; i < maximum_randomization_attempts; ++i) {
|
||||||
VirtualAddress random_address { round_up_to_power_of_two(get_good_random<FlatPtr>(), alignment) };
|
VirtualAddress random_address { round_up_to_power_of_two(get_fast_random<FlatPtr>(), alignment) };
|
||||||
|
|
||||||
if (!m_total_range.contains(random_address, size))
|
if (!m_total_range.contains(random_address, size))
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue