mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-29 11:00:29 +00:00
UserspaceEmulator: Honor alignment requests in virt$mmap(MAP_RANDOMIZED)
This commit is contained in:
parent
0bf457f715
commit
397f564144
Notes:
sideshowbarker
2024-07-18 21:34:46 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/397f564144f
1 changed files with 1 additions and 2 deletions
|
@ -81,8 +81,7 @@ Optional<Range> RangeAllocator::allocate_randomized(size_t size, size_t alignmen
|
|||
// FIXME: I'm sure there's a smarter way to do this.
|
||||
static constexpr size_t maximum_randomization_attempts = 1000;
|
||||
for (size_t i = 0; i < maximum_randomization_attempts; ++i) {
|
||||
VirtualAddress random_address { get_random<FlatPtr>() };
|
||||
random_address.mask(PAGE_MASK);
|
||||
VirtualAddress random_address { round_up_to_power_of_two(get_random<FlatPtr>(), alignment) };
|
||||
|
||||
if (!m_total_range.contains(random_address, size))
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue