summaryrefslogtreecommitdiff
path: root/Kernel/VM
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-02-13 01:16:57 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-13 01:18:03 +0100
commita5def4e98cae47e13022e9d1461eba84520b972f (patch)
tree74951d6556d55f07237806932cfbbc02f77cbde8 /Kernel/VM
parent62f0f73bf0e15e9830486a51c2114ae8399dbade (diff)
downloadserenity-a5def4e98cae47e13022e9d1461eba84520b972f.zip
Kernel: Sanity check the VM range when constructing a Region
This should help us catch bogus VM ranges ending up in a process's address space sooner.
Diffstat (limited to 'Kernel/VM')
-rw-r--r--Kernel/VM/Region.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp
index f26273ea1c..b24101ada1 100644
--- a/Kernel/VM/Region.cpp
+++ b/Kernel/VM/Region.cpp
@@ -49,6 +49,10 @@ Region::Region(const Range& range, NonnullRefPtr<VMObject> vmobject, size_t offs
, m_cacheable(cacheable)
, m_kernel(kernel)
{
+ ASSERT(m_range.base().is_page_aligned());
+ ASSERT(m_range.size());
+ ASSERT((m_range.size() % PAGE_SIZE) == 0);
+
m_vmobject->ref_region();
register_purgeable_page_ranges();
MM.register_region(*this);