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-4.1-testing] tools: hvmloader: attempt to SHUTDOWN_

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-4.1-testing] tools: hvmloader: attempt to SHUTDOWN_crash on BUG
From: Xen patchbot-4.1-testing <patchbot@xxxxxxx>
Date: Tue, 26 Apr 2011 11:35:10 +0100
Delivery-date: Tue, 26 Apr 2011 03:36:05 -0700
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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 Keir Fraser <keir@xxxxxxx>
# Date 1303734860 -3600
# Node ID 3a4e15f9b6d8345d1a1fb2c4751d19bc6697181f
# Parent  0545ae0f5c900e62c3e509c2739b0a36d025b957
tools: hvmloader: attempt to SHUTDOWN_crash on BUG

Executing UD2 (invalid opcode) triggers a triple fault which signals
reboot to the toolstack, rather than crash.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxx>
xen-unstable changeset:   23245:3539ef956a37
xen-unstable date:        Mon Apr 18 18:34:45 2011 +0100
---


diff -r 0545ae0f5c90 -r 3a4e15f9b6d8 tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Mon Apr 25 13:33:29 2011 +0100
+++ b/tools/firmware/hvmloader/hvmloader.c      Mon Apr 25 13:34:20 2011 +0100
@@ -704,6 +704,9 @@
     uint32_t etherboot_phys_addr, option_rom_phys_addr, bios32_addr;
     struct bios_info *bios_info;
 
+    /* Initialise hypercall stubs with RET, rendering them no-ops. */
+    memset((void *)HYPERCALL_PHYSICAL_ADDRESS, 0xc3 /* RET */, PAGE_SIZE);
+
     printf("HVM Loader\n");
 
     init_hypercalls();
diff -r 0545ae0f5c90 -r 3a4e15f9b6d8 tools/firmware/hvmloader/util.c
--- a/tools/firmware/hvmloader/util.c   Mon Apr 25 13:33:29 2011 +0100
+++ b/tools/firmware/hvmloader/util.c   Mon Apr 25 13:34:20 2011 +0100
@@ -25,6 +25,7 @@
 #include <stdint.h>
 #include <xen/xen.h>
 #include <xen/memory.h>
+#include <xen/sched.h>
 
 void wrmsr(uint32_t idx, uint64_t v)
 {
@@ -538,19 +539,27 @@
     return 0;
 }
 
+static void __attribute__((noreturn)) crash(void)
+{
+    struct sched_shutdown shutdown = { .reason = SHUTDOWN_crash };
+    printf("*** HVMLoader crashed.\n");
+    hypercall_sched_op(SCHEDOP_shutdown, &shutdown);
+    printf("*** Failed to crash. Halting.\n");
+    for ( ; ; )
+        asm volatile ( "hlt" );
+}
+
 void __assert_failed(char *assertion, char *file, int line)
 {
-    printf("HVMLoader assertion '%s' failed at %s:%d\n",
+    printf("*** HVMLoader assertion '%s' failed at %s:%d\n",
            assertion, file, line);
-    for ( ; ; )
-        asm volatile ( "ud2" );
+    crash();
 }
 
 void __bug(char *file, int line)
 {
-    printf("HVMLoader bug at %s:%d\n", file, line);
-    for ( ; ; )
-        asm volatile ( "ud2" );
+    printf("*** HVMLoader bug at %s:%d\n", file, line);
+    crash();
 }
 
 static void validate_hvm_info(struct hvm_info_table *t)

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-4.1-testing] tools: hvmloader: attempt to SHUTDOWN_crash on BUG, Xen patchbot-4 . 1-testing <=