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!
This commit is contained in:
Andreas Kling 2020-01-10 19:24:01 +01:00
parent 8c5cd97b45
commit 5c3c2a9bac
Notes: sideshowbarker 2024-07-19 10:13:00 +09:00

View file

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