From dbc77148c9774b0c851293dee79b612350d6fa1c Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Sat, 17 Jul 2021 03:21:38 -0700 Subject: [PATCH] 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 --- Kernel/VM/RangeAllocator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Kernel/VM/RangeAllocator.cpp b/Kernel/VM/RangeAllocator.cpp index 475a86d148..2621f87275 100644 --- a/Kernel/VM/RangeAllocator.cpp +++ b/Kernel/VM/RangeAllocator.cpp @@ -143,7 +143,9 @@ Optional 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) {