diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-01 11:08:28 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-01 11:23:10 +0100 |
commit | 48bbfe51fba186f995aefd7cfc5b1fc6ddf8ab01 (patch) | |
tree | f6e51c72a2cd2efaca47941aea9ee87bc701eb46 /Kernel/VM/Region.cpp | |
parent | 88b334135b37304e76bd2fbd4745001138563a46 (diff) | |
download | serenity-48bbfe51fba186f995aefd7cfc5b1fc6ddf8ab01.zip |
Kernel: Add some InodeVMObject type assertions in Region::clone()
Let's make sure that we're never cloning shared inode-backed objects
as if they were private, and vice versa.
Diffstat (limited to 'Kernel/VM/Region.cpp')
-rw-r--r-- | Kernel/VM/Region.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp index a9f6b69727..dbe4e363c8 100644 --- a/Kernel/VM/Region.cpp +++ b/Kernel/VM/Region.cpp @@ -71,6 +71,9 @@ NonnullOwnPtr<Region> Region::clone() #ifdef MM_DEBUG dbg() << "Region::clone(): Sharing " << name() << " (" << vaddr() << ")"; #endif + if (vmobject().is_inode()) + ASSERT(vmobject().is_shared_inode()); + // Create a new region backed by the same VMObject. auto region = Region::create_user_accessible(m_range, m_vmobject, m_offset_in_vmobject, m_name, m_access); region->set_mmap(m_mmap); @@ -78,6 +81,9 @@ NonnullOwnPtr<Region> Region::clone() return region; } + if (vmobject().is_inode()) + ASSERT(vmobject().is_private_inode()); + #ifdef MM_DEBUG dbg() << "Region::clone(): CoWing " << name() << " (" << vaddr() << ")"; #endif |