Skip to content

Commit

Permalink
Kernel: Convert RangeAllocator VERIFY to proper error handling
Browse files Browse the repository at this point in the history
If a user allocates above 0x0 and below the allowable usermode
virtual address space, we need to return error instead of asserting.

Fixes: SerenityOS#8484
  • Loading branch information
bgianfo authored and awesomekling committed Jul 17, 2021
1 parent a5a62f9 commit dbc7714
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Kernel/VM/RangeAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ Optional<Range> RangeAllocator::allocate_specific(VirtualAddress base, size_t si
VERIFY((size % PAGE_SIZE) == 0);

Range const allocated_range(base, size);
VERIFY(m_total_range.contains(allocated_range));
if (!m_total_range.contains(allocated_range)) {
return {};
}

ScopedSpinLock lock(m_lock);
for (auto it = m_available_ranges.begin(); !it.is_end(); ++it) {
Expand Down

0 comments on commit dbc7714

Please sign in to comment.