Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 May 2016 18:45:11 +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: r300863 - head/sys/amd64/amd64
Message-ID:  <201605271845.u4RIjB8a001762@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri May 27 18:45:11 2016
New Revision: 300863
URL: https://svnweb.freebsd.org/changeset/base/300863

Log:
  In pmap_advise(), avoid leaking DI start for EPT pmaps which needs A/D
  emulation.  Assert that syscalls do not leak DI.
  
  Reported by:	gjb
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/amd64/amd64/trap.c

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c	Fri May 27 18:40:38 2016	(r300862)
+++ head/sys/amd64/amd64/pmap.c	Fri May 27 18:45:11 2016	(r300863)
@@ -6060,7 +6060,6 @@ pmap_advise(pmap_t pmap, vm_offset_t sva
 
 	if (advice != MADV_DONTNEED && advice != MADV_FREE)
 		return;
-	pmap_delayed_invl_started();
 
 	/*
 	 * A/D bit emulation requires an alternate code path when clearing
@@ -6077,6 +6076,7 @@ pmap_advise(pmap_t pmap, vm_offset_t sva
 	PG_V = pmap_valid_bit(pmap);
 	PG_RW = pmap_rw_bit(pmap);
 	anychanged = FALSE;
+	pmap_delayed_invl_started();
 	PMAP_LOCK(pmap);
 	for (; sva < eva; sva = va_next) {
 		pml4e = pmap_pml4e(pmap, sva);

Modified: head/sys/amd64/amd64/trap.c
==============================================================================
--- head/sys/amd64/amd64/trap.c	Fri May 27 18:40:38 2016	(r300862)
+++ head/sys/amd64/amd64/trap.c	Fri May 27 18:45:11 2016	(r300863)
@@ -959,6 +959,10 @@ amd64_syscall(struct thread *td, int tra
 	KASSERT(td->td_pcb->pcb_save == get_pcb_user_save_td(td),
 	    ("System call %s returning with mangled pcb_save",
 	     syscallname(td->td_proc, sa.code)));
+	KASSERT(td->td_md.md_invl_gen.gen == 0,
+	    ("System call %s returning with leaked invl_gen %lu",
+	    syscallname(td->td_proc, sa.code), td->td_md.md_invl_gen.gen));
+
 
 	syscallret(td, error, &sa);
 



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