Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Feb 2018 15:36:28 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329215 - head/sys/vm
Message-ID:  <201802131536.w1DFaSbn035081@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Feb 13 15:36:28 2018
New Revision: 329215
URL: https://svnweb.freebsd.org/changeset/base/329215

Log:
  Do not leak rv->psind in some specific situations.
  
  Suppose that we have an object with a mapped superpage, and that all
  pages in the superpages are held (by some driver).  Additionally,
  suppose that the object is terminated, e.g. because the only process
  mapping it is exiting.  Then the reservation is broken, but the pages
  cannot be freed until later, when they are unheld.  In this situation,
  the reservation code cannot clean psind, since no pages are freed, and
  the page is freed and then reused with invalid psind.
  
  Clean psind on vm_reserv_break() to avoid the situation.
  
  Reported and tested by:	Slava Shwartsman
  Reviewed by:	markj
  Sponsored by:	Mellanox Technologies
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D14335

Modified:
  head/sys/vm/vm_reserv.c

Modified: head/sys/vm/vm_reserv.c
==============================================================================
--- head/sys/vm/vm_reserv.c	Tue Feb 13 15:30:31 2018	(r329214)
+++ head/sys/vm/vm_reserv.c	Tue Feb 13 15:36:28 2018	(r329215)
@@ -949,6 +949,7 @@ vm_reserv_break(vm_reserv_t rv, vm_page_t m)
 
 	vm_domain_free_assert_locked(VM_DOMAIN(rv->domain));
 	vm_reserv_remove(rv);
+	rv->pages->psind = 0;
 	if (m != NULL) {
 		/*
 		 * Since the reservation is being broken, there is no harm in



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