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] [xen-unstable] [IA64] Fix incorrect NVRAM saving if doma

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [IA64] Fix incorrect NVRAM saving if domain is destroyed by config error
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 27 Jul 2007 02:50:42 -0700
Delivery-date: Fri, 27 Jul 2007 02:48:44 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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 Alex Williamson <alex.williamson@xxxxxx>
# Date 1183388724 21600
# Node ID 38d0618868738b03611bdbb9f3fe29c73f1c34dd
# Parent  89596982890b78ebceffc4c5803662adc3dddc73
[IA64] Fix incorrect NVRAM saving if domain is destroyed by config error

Nvram saving is always executed even if a domain is destroyed by a
configuration parameter error.  In this case, Nvram saving function
will get a bad address for the NVRAM data and save garbage into the
NVRAM file. Configuring a wrong vif parameter can expose this issue.

This patch fixes the issue by adding an address check function in
NVRAM saving path.

Signed-off-by: Zhang Xin <xing.z.zhang@xxxxxxxxx>
---
 tools/libxc/ia64/xc_ia64_hvm_build.c |   21 ++++++++++++++++++++-
 xen/include/public/arch-ia64.h       |    6 ++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff -r 89596982890b -r 38d061886873 tools/libxc/ia64/xc_ia64_hvm_build.c
--- a/tools/libxc/ia64/xc_ia64_hvm_build.c      Mon Jul 02 08:51:59 2007 -0600
+++ b/tools/libxc/ia64/xc_ia64_hvm_build.c      Mon Jul 02 09:05:24 2007 -0600
@@ -623,6 +623,21 @@ copy_from_nvram_to_GFW(int xc_handle, ui
 
 
 /*
+ *Check is the address where NVRAM data located valid
+ */
+static int is_valid_address(void *addr)
+{
+    struct nvram_save_addr *p = (struct nvram_save_addr *)addr;        
+
+    if ( p->signature == NVRAM_VALID_SIG )
+        return 1;
+    else {
+        PERROR("Invalid nvram signature. Nvram save failed!\n");
+        return 0;
+    }
+}
+
+/*
  * GFW use 4k page. when doing foreign map, we should 16k align
  * the address and map one more page to guarantee all 64k nvram data 
  * can be got.
@@ -667,7 +682,11 @@ copy_from_GFW_to_nvram(int xc_handle, ui
         return -1;
     }
 
-    addr_from_GFW_4k_align = *((uint64_t *)tmp_ptr);
+    /* Check is NVRAM data vaild */
+    if ( !is_valid_address(tmp_ptr) )
+        return -1;
+
+    addr_from_GFW_4k_align = ((struct nvram_save_addr *)tmp_ptr)->addr;
     munmap(tmp_ptr, PAGE_SIZE);
 
     // align address to 16k
diff -r 89596982890b -r 38d061886873 xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h    Mon Jul 02 08:51:59 2007 -0600
+++ b/xen/include/public/arch-ia64.h    Mon Jul 02 09:05:24 2007 -0600
@@ -116,6 +116,12 @@ typedef unsigned long xen_ulong_t;
 /* Nvram belongs to GFW memory space  */
 #define NVRAM_SIZE       (MEM_K * 64)
 #define NVRAM_START      (GFW_START + 10 * MEM_M)
+
+#define NVRAM_VALID_SIG 0x4650494e45584948             // "HIXENIPF"
+struct nvram_save_addr {
+    unsigned long addr;
+    unsigned long signature;
+};
 
 struct pt_fpreg {
     union {

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [IA64] Fix incorrect NVRAM saving if domain is destroyed by config error, Xen patchbot-unstable <=