diff options
author | neel <neel@FreeBSD.org> | 2012-10-03 01:18:51 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2012-10-03 01:18:51 +0000 |
commit | 77ab4804ac42198ff996def6bc2d7acc841626a5 (patch) | |
tree | d29d281e1e26f6804bb0ef51c890f15893e3d79d /sys/amd64/vmm/vmm.c | |
parent | 3e50e0220bcda77b0a8e06a5f6095a206368e01b (diff) | |
download | FreeBSD-src-77ab4804ac42198ff996def6bc2d7acc841626a5.zip FreeBSD-src-77ab4804ac42198ff996def6bc2d7acc841626a5.tar.gz |
Get rid of assumptions in the hypervisor that the host physical memory
associated with guest physical memory is contiguous.
Add check to vm_gpa2hpa() that the range indicated by [gpa,gpa+len) is all
contained within a single 4KB page.
Diffstat (limited to 'sys/amd64/vmm/vmm.c')
-rw-r--r-- | sys/amd64/vmm/vmm.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c index 62bb753..3dabbd6 100644 --- a/sys/amd64/vmm/vmm.c +++ b/sys/amd64/vmm/vmm.c @@ -404,6 +404,11 @@ vm_malloc(struct vm *vm, vm_paddr_t gpa, size_t len) vm_paddr_t vm_gpa2hpa(struct vm *vm, vm_paddr_t gpa, size_t len) { + vm_paddr_t nextpage; + + nextpage = rounddown(gpa + PAGE_SIZE, PAGE_SIZE); + if (len > nextpage - gpa) + panic("vm_gpa2hpa: invalid gpa/len: 0x%016lx/%lu", gpa, len); return (VMMMAP_GET(vm->cookie, gpa)); } |