Browse Source

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.
Andreas Kling 5 years ago
parent
commit
05a441afb2
1 changed files with 2 additions and 1 deletions
  1. 2 1
      Kernel/VM/Region.cpp

+ 2 - 1
Kernel/VM/Region.cpp

@@ -57,7 +57,8 @@ NonnullOwnPtr<Region> Region::clone()
     // NOTE: Kernel-only regions should never be cloned.
     // NOTE: Kernel-only regions should never be cloned.
     ASSERT(is_user_accessible());
     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);
         ASSERT(!m_stack);
 #ifdef MM_DEBUG
 #ifdef MM_DEBUG
         dbgprintf("%s<%u> Region::clone(): sharing %s (V%p)\n",
         dbgprintf("%s<%u> Region::clone(): sharing %s (V%p)\n",