Author: kib
Date: Wed Sep 11 04:55:10 2019
New Revision: 352202
URL: https://svnweb.freebsd.org/changeset/base/352202

Log:
  MFC r351830:
  madvise(MADV_FREE): Quick fix to time rewind.
  
  PR:   240061

Modified:
  stable/12/sys/vm/vm_map.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/vm/vm_map.c
==============================================================================
--- stable/12/sys/vm/vm_map.c   Wed Sep 11 03:25:30 2019        (r352201)
+++ stable/12/sys/vm/vm_map.c   Wed Sep 11 04:55:10 2019        (r352202)
@@ -2735,6 +2735,18 @@ vm_map_madvise(
                        if (current->eflags & MAP_ENTRY_IS_SUB_MAP)
                                continue;
 
+                       /*
+                        * MADV_FREE would otherwise rewind time to
+                        * the creation of the shadow object.  Because
+                        * we hold the VM map read-locked, neither the
+                        * entry's object nor the presence of a
+                        * backing object can change.
+                        */
+                       if (behav == MADV_FREE &&
+                           current->object.vm_object != NULL &&
+                           current->object.vm_object->backing_object != NULL)
+                               continue;
+
                        pstart = OFF_TO_IDX(current->offset);
                        pend = pstart + atop(current->end - current->start);
                        useStart = current->start;
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to