vmm/svm: iopm_bitmap and msr_bitmap must be contiguous in physical memory
To achieve that the whole svm_softc is allocated with contigmalloc now. It would be more effient to de-embed those arrays and allocate only them with contigmalloc. Previously, if malloc(9) used non-contiguous pages for the arrays, then random bits in physical pages next to the first page would be used to determine permissions for I/O port and MSR accesses. That could result in a guest dangerously modifying the host hardware configuration. One example is that sometimes NMI watchdog driver in a Linux guest would be able to configure a performance counter on a host system. The counter would generate an interrupt and if hwpmc(4) driver is loaded on the host, then the interrupt would be delivered as an NMI. Discussed with: jhb Reviewed by: grehan MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D8321
This commit is contained in:
parent
50b6282e47
commit
7d3b940604
@ -517,7 +517,8 @@ svm_vminit(struct vm *vm, pmap_t pmap)
|
||||
vm_paddr_t msrpm_pa, iopm_pa, pml4_pa;
|
||||
int i;
|
||||
|
||||
svm_sc = malloc(sizeof (struct svm_softc), M_SVM, M_WAITOK | M_ZERO);
|
||||
svm_sc = contigmalloc(sizeof (*svm_sc), M_SVM, M_WAITOK | M_ZERO,
|
||||
0, BUS_SPACE_MAXADDR, PAGE_SIZE, 0);
|
||||
svm_sc->vm = vm;
|
||||
svm_sc->nptp = (vm_offset_t)vtophys(pmap->pm_pml4);
|
||||
|
||||
@ -2042,7 +2043,7 @@ svm_vmcleanup(void *arg)
|
||||
{
|
||||
struct svm_softc *sc = arg;
|
||||
|
||||
free(sc, M_SVM);
|
||||
contigfree(sc, sizeof (*sc), M_SVM);
|
||||
}
|
||||
|
||||
static register_t *
|
||||
|
Loading…
x
Reference in New Issue
Block a user