1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:55:08 +00:00

Kernel: Don't turn private read-only regions into shared ones on fork

Even if they are read-only now, they can be mprotect(PROT_WRITE)'d in
the future, so we have to make sure they are CoW mapped.
This commit is contained in:
Andreas Kling 2019-12-15 16:53:46 +01:00
parent 3fbc50a350
commit 05a441afb2

View file

@ -57,7 +57,8 @@ NonnullOwnPtr<Region> Region::clone()
// NOTE: Kernel-only regions should never be cloned.
ASSERT(is_user_accessible());
if (m_shared || (is_readable() && !is_writable())) {
// FIXME: What should we do for privately mapped InodeVMObjects?
if (m_shared || vmobject().is_inode()) {
ASSERT(!m_stack);
#ifdef MM_DEBUG
dbgprintf("%s<%u> Region::clone(): sharing %s (V%p)\n",