amd64: fix PKRU and swapout interaction

When vm_map_remove() is called from vm_swapout_map_deactivate_pages()
due to swapout, PKRU attributes for the removed range must be kept
intact.  Provide a variant of pmap_remove(), pmap_map_delete(), to
allow pmap to distinguish between real removes of the UVA mappings
and any other internal removes, e.g. swapout.

For non-amd64, pmap_map_delete() is stubbed by define to pmap_remove().

Reported by:	andrew
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D39556
This commit is contained in:
Konstantin Belousov
2023-04-13 14:37:35 +03:00
parent 485f783f88
commit 1e0e335b0f
8 changed files with 35 additions and 10 deletions
+1
View File
@@ -45,6 +45,7 @@ extern vm_offset_t virtual_end;
void *pmap_kenter_temporary(vm_paddr_t, int);
#define pmap_page_is_write_mapped(m) (((m)->a.flags & PGA_WRITEABLE) != 0)
void pmap_page_set_memattr(vm_page_t, vm_memattr_t);
#define pmap_map_delete(pmap, sva, eva) pmap_remove(pmap, sva, eva)
void *pmap_mapdev(vm_paddr_t, vm_size_t);
void pmap_unmapdev(void *, vm_size_t);