aboutsummaryrefslogtreecommitdiff
path: root/sys/vm/vm_map.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/vm/vm_map.c')
-rw-r--r--sys/vm/vm_map.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 50289e5a34cd..29105726a8de 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -2736,6 +2736,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;