rpms/kernel/F-11 linux-2.6-xen-clean-up-warnings.patch, NONE, 1.1 linux-2.6-xen-fix-brkpoints-hw-watchpoints.patch, NONE, 1.1 kernel.spec, 1.1718, 1.1719

Justin M. Forbes jforbes at fedoraproject.org
Thu Aug 27 19:40:55 UTC 2009


Author: jforbes

Update of /cvs/pkgs/rpms/kernel/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv23393

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-xen-clean-up-warnings.patch 
	linux-2.6-xen-fix-brkpoints-hw-watchpoints.patch 
Log Message:
xen: Fix guest crash when trying to debug. (#458385)

linux-2.6-xen-clean-up-warnings.patch:
 enlighten.c |   22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

--- NEW FILE linux-2.6-xen-clean-up-warnings.patch ---
From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Date: Fri, 24 Apr 2009 07:22:08 +0000 (-0700)
Subject: xen/x86-64: clean up warnings about IST-using traps
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fjeremy%2Fxen.git;a=commitdiff_plain;h=19a1071c33c4aa7531ac5c5a634a12607aefa90a

xen/x86-64: clean up warnings about IST-using traps

Ignore known IST-using traps.  Aside from the debugger traps, they're
low-level faults which Xen will handle for us, so the kernel needn't
worry about them.  Keep warning in case unknown trap starts using IST.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
---

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 16afbc3..cbb31eb 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -439,12 +439,30 @@ static int cvt_gate_to_trap(int vector, const gate_desc *val,
 
 	addr = gate_offset(*val);
 #ifdef CONFIG_X86_64
+	/*
+	 * Look for known traps using IST, and substitute them
+	 * appropriately.  The debugger ones are the only ones we care
+	 * about.  Xen will handle faults like double_fault and
+	 * machine_check, so we should never see them.  Warn if
+	 * there's an unexpected IST-using fault handler.
+	 */
 	if (addr == (unsigned long)debug)
 		addr = (unsigned long)xen_debug;
 	else if (addr == (unsigned long)int3)
 		addr = (unsigned long)xen_int3;
-	else
-		WARN_ON(val->ist != 0);
+	else if (addr == (unsigned long)double_fault ||
+		 addr == (unsigned long)stack_segment) {
+		/* Don't need to handle these */
+		return 0;
+#ifdef CONFIG_X86_MCE
+	} else if (addr == (unsigned long)machine_check) {
+		return 0;
+#endif
+	} else {
+		/* Some other trap using IST? */
+		if (WARN_ON(val->ist != 0))
+			return 0;
+	}
 #endif	/* CONFIG_X86_64 */
 	info->address = addr;
 

linux-2.6-xen-fix-brkpoints-hw-watchpoints.patch:
 include/asm/traps.h |    2 ++
 kernel/entry_64.S   |    4 ++++
 xen/enlighten.c     |   17 ++++++++++++++++-
 3 files changed, 22 insertions(+), 1 deletion(-)

--- NEW FILE linux-2.6-xen-fix-brkpoints-hw-watchpoints.patch ---
From: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Date: Mon, 30 Mar 2009 02:56:29 +0000 (-0700)
Subject: xen/x86-64: fix breakpoints and hardware watchpoints
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fjeremy%2Fxen.git;a=commitdiff_plain;h=bb2105d9743a902fd6035ba6d72cef6cda871664

xen/x86-64: fix breakpoints and hardware watchpoints

Native x86-64 uses the IST mechanism to run int3 and debug traps on
an alternative stack.  Xen does not do this, and so the frames were
being misinterpreted by the ptrace code.  This change special-cases
these two exceptions by using Xen variants which run on the normal
kernel stack properly.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
---

diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h
index 0d53425..d696185 100644
--- a/arch/x86/include/asm/traps.h
+++ b/arch/x86/include/asm/traps.h
@@ -13,6 +13,8 @@ asmlinkage void divide_error(void);
 asmlinkage void debug(void);
 asmlinkage void nmi(void);
 asmlinkage void int3(void);
+asmlinkage void xen_debug(void);
+asmlinkage void xen_int3(void);
 asmlinkage void overflow(void);
 asmlinkage void bounds(void);
 asmlinkage void invalid_op(void);
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index a331ec3..649db62 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1378,6 +1378,10 @@ END(xen_failsafe_callback)
 
 paranoidzeroentry_ist debug do_debug DEBUG_STACK
 paranoidzeroentry_ist int3 do_int3 DEBUG_STACK
+#ifdef CONFIG_XEN
+zeroentry xen_debug do_debug
+zeroentry xen_int3 do_int3
+#endif
 paranoiderrorentry stack_segment do_stack_segment
 errorentry general_protection do_general_protection
 errorentry page_fault do_page_fault
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 12a3159..16afbc3 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -20,6 +20,7 @@
 #include <linux/delay.h>
 #include <linux/start_kernel.h>
 #include <linux/sched.h>
+#include <linux/kprobes.h>
 #include <linux/bootmem.h>
 #include <linux/module.h>
 #include <linux/mm.h>
@@ -44,6 +45,7 @@
 #include <asm/processor.h>
 #include <asm/proto.h>
 #include <asm/msr-index.h>
+#include <asm/traps.h>
 #include <asm/setup.h>
 #include <asm/desc.h>
 #include <asm/pgtable.h>
@@ -428,11 +430,24 @@ static void xen_write_ldt_entry(struct desc_struct *dt, int entrynum,
 static int cvt_gate_to_trap(int vector, const gate_desc *val,
 			    struct trap_info *info)
 {
+	unsigned long addr;
+
 	if (val->type != GATE_TRAP && val->type != GATE_INTERRUPT)
 		return 0;
 
 	info->vector = vector;
-	info->address = gate_offset(*val);
+
+	addr = gate_offset(*val);
+#ifdef CONFIG_X86_64
+	if (addr == (unsigned long)debug)
+		addr = (unsigned long)xen_debug;
+	else if (addr == (unsigned long)int3)
+		addr = (unsigned long)xen_int3;
+	else
+		WARN_ON(val->ist != 0);
+#endif	/* CONFIG_X86_64 */
+	info->address = addr;
+
 	info->cs = gate_segment(*val);
 	info->flags = val->dpl;
 	/* interrupt gates clear IF */


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/kernel.spec,v
retrieving revision 1.1718
retrieving revision 1.1719
diff -u -p -r1.1718 -r1.1719
--- kernel.spec	27 Aug 2009 19:01:31 -0000	1.1718
+++ kernel.spec	27 Aug 2009 19:40:55 -0000	1.1719
@@ -650,6 +650,10 @@ Patch800: linux-2.6-crash-driver.patch
 
 Patch1000: linux-2.6-neigh_-fix-state-transition-INCOMPLETE-_FAILED-via-Netlink-request.patch
 
+# Virt Patches
+Patch1200: linux-2.6-xen-fix-brkpoints-hw-watchpoints.patch
+Patch1201: linux-2.6-xen-clean-up-warnings.patch
+
 Patch1515: linux-2.6.29-lirc.patch
 Patch1517: hid-ignore-all-recent-imon-devices.patch
 Patch1518: hdpvr-ir-enable.patch
@@ -1247,6 +1251,11 @@ ApplyPatch linux-2.6-neigh_-fix-state-tr
 # add ich9 lan
 ApplyPatch linux-2.6-e1000-ich9.patch
 
+# Virt Fixes
+# Xen Guest
+ApplyPatch linux-2.6-xen-fix-brkpoints-hw-watchpoints.patch
+ApplyPatch linux-2.6-xen-clean-up-warnings.patch
+
 # Misc fixes
 # The input layer spews crap no-one cares about.
 ApplyPatch linux-2.6-input-kill-stupid-messages.patch
@@ -1938,6 +1947,9 @@ fi
 # and build.
 
 %changelog
+* Thu Aug 27 2009 Justin M. Forbes <jforbes at redhat.com> 2.6.30.5-40
+- xen: Fix guest crash when trying to debug. (#458385)
+
 * Thu Aug 27 2009 John W. Linville <linville at redhat.com> 2.6.30.5-39
 - zd1211rw: adding 083a:e503 as a ZD1211B device (#518538)
 




More information about the fedora-extras-commits mailing list