summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2016-05-27 18:45:11 +0000
committerkib <kib@FreeBSD.org>2016-05-27 18:45:11 +0000
commitb049cb19c0e2192f68bd1903ff4d517a02eea556 (patch)
treee1183babf4087a05e1660259647a6e11a530ca97 /sys/amd64
parent8bea5267cd2d0c7a1e5509f3e61b0a91e08fc9d0 (diff)
downloadFreeBSD-src-b049cb19c0e2192f68bd1903ff4d517a02eea556.zip
FreeBSD-src-b049cb19c0e2192f68bd1903ff4d517a02eea556.tar.gz
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
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/pmap.c2
-rw-r--r--sys/amd64/amd64/trap.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index cc76974..7a93e76 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -6060,7 +6060,6 @@ pmap_advise(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, int advice)
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, vm_offset_t eva, int advice)
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);
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index 620a461..1b85b32 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -959,6 +959,10 @@ amd64_syscall(struct thread *td, int traced)
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);
OpenPOWER on IntegriCloud