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
This commit is contained in:
kib 2016-05-27 18:45:11 +00:00
parent 8bea5267cd
commit b049cb19c0
2 changed files with 5 additions and 1 deletions

View File

@ -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);

View File

@ -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);