summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-07-17 03:21:38 -0700
committerAndreas Kling <kling@serenityos.org>2021-07-17 13:00:21 +0200
commitdbc77148c9774b0c851293dee79b612350d6fa1c (patch)
tree5100b3da26b554231d033bf3dd4dd31ce5564168 /Kernel
parenta5a62f99c54aae004357bc12b8b12c6086d12903 (diff)
downloadserenity-dbc77148c9774b0c851293dee79b612350d6fa1c.zip
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
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/VM/RangeAllocator.cpp4
1 files changed, 3 insertions, 1 deletions
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<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) {