Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Sep 2019 04:55:10 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r352202 - stable/12/sys/vm
Message-ID:  <201909110455.x8B4tAn9062844@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909110455.x8B4tAn9062844>