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.
This commit is contained in:
Andreas Kling 2021-02-13 01:16:57 +01:00
parent 62f0f73bf0
commit a5def4e98c
Notes: sideshowbarker 2024-07-18 22:22:34 +09:00

View File

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