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-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] libxc: Verify Magic number when reading dump
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 06 Mar 2006 16:32:13 +0000
Delivery-date: Mon, 06 Mar 2006 16:32:52 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 9de50910defdde100c9598570a317152cba6f8c1
# Parent  0161a721bad5ab40557868d1bd6d3022cf972bb7
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 0161a721bad5 -r 9de50910defd tools/libxc/xc_core.c
--- a/tools/libxc/xc_core.c     Mon Mar  6 14:02:26 2006
+++ b/tools/libxc/xc_core.c     Mon Mar  6 14:04:18 2006
@@ -61,7 +61,7 @@
  
     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 0161a721bad5 -r 9de50910defd tools/libxc/xc_ptrace_core.c
--- a/tools/libxc/xc_ptrace_core.c      Mon Mar  6 14:02:26 2006
+++ b/tools/libxc/xc_ptrace_core.c      Mon Mar  6 14:04:18 2006
@@ -111,6 +111,13 @@
         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 0161a721bad5 -r 9de50910defd tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Mon Mar  6 14:02:26 2006
+++ b/tools/libxc/xenctrl.h     Mon Mar  6 14:04:18 2006
@@ -92,6 +92,7 @@
     unsigned int xch_pages_offset;
 } xc_core_header_t;
 
+#define XC_CORE_MAGIC 0xF00FEBED
 
 long xc_ptrace_core(
     int xc_handle,

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] libxc: Verify Magic number when reading dump, Xen patchbot -unstable <=