[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Add some sanity check when creating 3-level 1:1 page table



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 5e943af66571bd9361b8865a2c9718b1098fe3fb
# Parent  1cdc469bf78d8807a4b11737b851986b860fc179
Add some sanity check when creating 3-level 1:1 page table
in VMX domain builder.
 - Add check for empty l2e page entry.
 - Add check for failed vl1tab map.

Signed-off-by: Yunhong Jiang <yunhong.jiang@xxxxxxxxx>
Signed-off-by: Asit Mallick <asit.k.mallick@xxxxxxxxx>

diff -r 1cdc469bf78d -r 5e943af66571 tools/libxc/xc_vmx_build.c
--- a/tools/libxc/xc_vmx_build.c        Wed Sep 14 13:28:45 2005
+++ b/tools/libxc/xc_vmx_build.c        Wed Sep 14 13:34:14 2005
@@ -169,21 +169,35 @@
    l2_pgentry_t *vl2tab;
  
    mmio_addr = mmio_range_start & PAGE_MASK;
-   for (; mmio_addr < mmio_range_end; mmio_addr += PAGE_SIZE) {
+   for ( ; mmio_addr < mmio_range_end; mmio_addr += PAGE_SIZE )
+   {
        vl3e = vl3tab[l3_table_offset(mmio_addr)];
-       if (vl3e == 0)
+       if ( vl3e == 0 )
            continue;
-       vl2tab = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
-               PROT_READ|PROT_WRITE, vl3e >> PAGE_SHIFT);
-       if (vl2tab == 0) {
+
+       vl2tab = xc_map_foreign_range(
+           xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, vl3e>>PAGE_SHIFT);
+       if ( vl2tab == NULL )
+       {
            PERROR("Failed zap MMIO range");
            return -1;
        }
+
        vl2e = vl2tab[l2_table_offset(mmio_addr)];
-       if (vl2e == 0)
+       if ( vl2e == 0 )
+       {
+           munmap(vl2tab, PAGE_SIZE);
            continue;
-       vl1tab = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
-               PROT_READ|PROT_WRITE, vl2e >> PAGE_SHIFT);
+       }
+
+       vl1tab = xc_map_foreign_range(
+           xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, vl2e>>PAGE_SHIFT);
+       if ( vl1tab == NULL )
+       {
+           PERROR("Failed zap MMIO range");
+           munmap(vl2tab, PAGE_SIZE);
+           return -1;
+       }
 
        vl1tab[l1_table_offset(mmio_addr)] = 0;
        munmap(vl2tab, PAGE_SIZE);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.