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

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


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>
  • Date: Wed, 14 Sep 2005 18:18:20 +0800
  • Delivery-date: Wed, 14 Sep 2005 10:16:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AcW5FaHBQBFP4NCcRIKXiSAN/gRL/w==
  • Thread-topic: [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@xxxxxxxxxxxxxxxxxxxxxxxxxx
# 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@xxxxxxxxx>
Signed-off-by: Asit Mallick <asit.k.mallick@xxxxxxxxx>

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);

Attachment: check.diff
Description: check.diff

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

 


Rackspace

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