diff options
author | Andreas Kling <awesomekling@gmail.com> | 2020-01-10 19:24:01 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2020-01-10 19:24:01 +0100 |
commit | 5c3c2a9bacf75831716bbe028f84d9f1cd4dad74 (patch) | |
tree | 08b5a27c47f3c208e4c531c3f947135525e04a21 /Kernel/VM | |
parent | 8c5cd97b45897b01269ab41b4de5989caed63a61 (diff) | |
download | serenity-5c3c2a9bacf75831716bbe028f84d9f1cd4dad74.zip |
Kernel: Copy Region's "is_mmap" flag when cloning regions for fork()
Otherwise child processes will not be allowed to munmap(), madvise(),
etc. on the cloned regions!
Diffstat (limited to 'Kernel/VM')
-rw-r--r-- | Kernel/VM/Region.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp index 5a0917d44c..244103a4f2 100644 --- a/Kernel/VM/Region.cpp +++ b/Kernel/VM/Region.cpp @@ -65,7 +65,9 @@ NonnullOwnPtr<Region> Region::clone() vaddr().get()); #endif // Create a new region backed by the same VMObject. - return Region::create_user_accessible(m_range, m_vmobject, m_offset_in_vmobject, m_name, m_access); + auto region = Region::create_user_accessible(m_range, m_vmobject, m_offset_in_vmobject, m_name, m_access); + region->set_mmap(m_mmap); + return region; } #ifdef MM_DEBUG @@ -87,6 +89,7 @@ NonnullOwnPtr<Region> Region::clone() ASSERT(vmobject().is_anonymous()); clone_region->set_stack(true); } + clone_region->set_mmap(m_mmap); return clone_region; } |