WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] libxc: Verify Magic number when reading dump

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] libxc: Verify Magic number when reading dump
From: Horms <horms@xxxxxxxxxxxx>
Date: Mon, 6 Mar 2006 19:09:03 +0900
Delivery-date: Mon, 06 Mar 2006 13:07:23 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.11+cvs20060126
libxc: Verify Magic number when reading dump

The xen core files record a magic number, 
but when they are loaded it isn't checked.
This patch resolves this.

Signed-Off-By: Horms <horms@xxxxxxxxxxxx>

diff -r e3e7f3d900ae -r 213695460d71 tools/libxc/xc_core.c
--- a/tools/libxc/xc_core.c     Wed Mar  1 15:26:43 2006 +0900
+++ b/tools/libxc/xc_core.c     Wed Mar  1 17:09:17 2006 +0900
@@ -61,7 +61,7 @@ xc_domain_dumpcore(int xc_handle,
  
     nr_pages = info.nr_pages;
 
-    header.xch_magic = 0xF00FEBED; 
+    header.xch_magic = XC_CORE_MAGIC;
     header.xch_nr_vcpus = nr_vcpus;
     header.xch_nr_pages = nr_pages;
     header.xch_ctxt_offset = sizeof(struct xc_core_header);
diff -r e3e7f3d900ae -r 213695460d71 tools/libxc/xc_ptrace_core.c
--- a/tools/libxc/xc_ptrace_core.c      Wed Mar  1 15:26:43 2006 +0900
+++ b/tools/libxc/xc_ptrace_core.c      Wed Mar  1 17:09:17 2006 +0900
@@ -186,6 +186,13 @@ xc_waitdomain_core(
         if (read(domfd, &header, sizeof(header)) != sizeof(header))
             return -1;
 
+        if (header.xch_magic != XC_CORE_MAGIC) {
+                printf("Magic number missmatch: 0x%08x (file) != "
+                                        " 0x%08x (code)\n", header.xch_magic,
+                                        XC_CORE_MAGIC);
+                return -1;
+        }
+
         nr_pages = header.xch_nr_pages;
         nr_vcpus = header.xch_nr_vcpus;
         pages_offset = header.xch_pages_offset;
diff -r e3e7f3d900ae -r 213695460d71 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Wed Mar  1 15:26:43 2006 +0900
+++ b/tools/libxc/xenctrl.h     Wed Mar  1 17:09:17 2006 +0900
@@ -92,6 +92,7 @@ typedef struct xc_core_header {
     unsigned int xch_pages_offset;
 } xc_core_header_t;
 
+#define XC_CORE_MAGIC 0xF00FEBED
 
 long xc_ptrace_core(
     int xc_handle,

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] libxc: Verify Magic number when reading dump, Horms <=