Jiang, Yunhong
2005-Sep-14 10:18 UTC
[Xen-devel] [PATCH][VT]Add some sanity check when creating 3 level 1:1 page table
This patch add some check zap_mmio_range when create 3 level 1:1 page table. Thanks Yunhong Jiang # HG changeset patch # User yjiang5@vtsmp-build32.sh.intel.com # Node ID 5fd22c273f2c6e93b08ae9da2c8202b3d275f30d # Parent bc3ad53b98688df03679bafec3c03ee2b5bcc10f Add some sanity check when creating 3 level 1:1 page table. Add check for empty l2e page entry. Add check for faile vl1tab map. Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com> Signed-off-by: Asit Mallick <asit.k.mallick@intel.com> diff -r bc3ad53b9868 -r 5fd22c273f2c tools/libxc/xc_vmx_build.c --- a/tools/libxc/xc_vmx_build.c Wed Sep 14 10:03:10 2005 +++ b/tools/libxc/xc_vmx_build.c Wed Sep 14 10:03:16 2005 @@ -188,6 +188,8 @@ mmio_addr = mmio_range_start & PAGE_MASK; for (; mmio_addr < mmio_range_end; mmio_addr += PAGE_SIZE) { + vl2tab = NULL; + vl1tab = NULL; vl3e = vl3tab[l3_table_offset(mmio_addr)]; if (vl3e == 0) continue; @@ -198,10 +200,19 @@ return -1; } vl2e = vl2tab[l2_table_offset(mmio_addr)]; - if (vl2e == 0) + if (vl2e == 0){ + if(vl2tab) + munmap(vl2tab, PAGE_SIZE); continue; + } vl1tab = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, vl2e >> PAGE_SHIFT); + + if (vl1tab == 0) { + PERROR("Failed zap MMIO range"); + munmap(vl2tab, PAGE_SIZE); + return -1; + } vl1tab[l1_table_offset(mmio_addr)] = 0; munmap(vl2tab, PAGE_SIZE); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel