Kernel: Convert RangeAllocator VERIFY to proper error handling

If a user allocates above 0x0 and below the allowable usermode
virtual address space, we need to return error instead of asserting.

Fixes: #8484
This commit is contained in:
Brian Gianforcaro 2021-07-17 03:21:38 -07:00 committed by Andreas Kling
parent a5a62f99c5
commit dbc77148c9
Notes: sideshowbarker 2024-07-18 08:53:46 +09:00

View file

@ -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) {