Skip to contentSkip to conversation

Add some sanity check when creating 3 level 1:1 page table

PATCH New Jiang, Yunhong 1 participant 1 message Sep 14, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 [email protected]
# 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.

tools/libxc/xc_vmx_build.c +12 -1
diff -r bc3ad53b9868 -r 5fd22c273f2c tools/libxc/xc_vmx_build.c
@@ -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);

# HG changeset patch
# User [email protected]
# 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.

tools/libxc/xc_vmx_build.c +12 -1
diff -r bc3ad53b9868 -r 5fd22c273f2c tools/libxc/xc_vmx_build.c
@@ -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
[email protected]
http://lists.xensource.com/xen-devel