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-ia64-devel

[Xen-ia64-devel] [PATCH 12/23] vti domain save/restore: fix stack unwind

To: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-ia64-devel] [PATCH 12/23] vti domain save/restore: fix stack unwinder
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Fri, 12 Oct 2007 12:51:36 +0900
Cc: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Delivery-date: Thu, 11 Oct 2007 20:53:01 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
# HG changeset patch
# User yamahata@xxxxxxxxxxxxx
# Date 1191996703 -32400
# Node ID 551fb6d7048179dcc8c5daca7350998f99e6577e
# Parent  679f88a2f502b318b41a708d9cf0e52854804915
fix stack unwinder.
- fix find_save_locs() and unw_unwind().
  instruction pointer check should be suite for xen.
- fix unw_unwind_to_user()
  VTi domain fault handler doesn't always updatevcpu->on_stack so that
  the pUStk check fails. Add more checking to stop winding.
PATCHNAME: fix_stack_unwinder

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff -r 679f88a2f502 -r 551fb6d70481 xen/arch/ia64/linux-xen/unwind.c
--- a/xen/arch/ia64/linux-xen/unwind.c  Wed Oct 10 15:40:20 2007 +0900
+++ b/xen/arch/ia64/linux-xen/unwind.c  Wed Oct 10 15:11:43 2007 +0900
@@ -1847,6 +1847,16 @@ run_script (struct unw_script *script, s
        goto redo;
 }
 
+#ifdef XEN
+static inline int
+is_hypervisor_virt(unsigned long addr)
+{
+       return IS_VMM_ADDRESS(addr) &&
+               (HYPERVISOR_VIRT_START <= addr) &&
+               (addr < HYPERVISOR_VIRT_END);
+}
+#endif
+
 static int
 find_save_locs (struct unw_frame_info *info)
 {
@@ -1857,6 +1867,8 @@ find_save_locs (struct unw_frame_info *i
        if ((info->ip & (local_cpu_data->unimpl_va_mask | 0xf))
 #ifndef XEN
            || info->ip < TASK_SIZE
+#else
+           || !is_hypervisor_virt(info->ip)
 #endif
                ) {
                /* don't let obviously bad addresses pollute the cache */
@@ -1915,7 +1927,11 @@ unw_unwind (struct unw_frame_info *info)
                return -1;
        }
        ip = info->ip = *info->rp_loc;
+#ifndef XEN
        if (ip < GATE_ADDR) {
+#else
+       if (!is_hypervisor_virt(info->ip)) {
+#endif
                UNW_DPRINT(2, "unwind.%s: reached user-space (ip=0x%lx)\n", 
__FUNCTION__, ip);
                STAT(unw.stat.api.unwind_time += ia64_get_itc() - start; 
local_irq_restore(flags));
                return -1;
@@ -1993,6 +2009,21 @@ unw_unwind_to_user (struct unw_frame_inf
                if (unw_is_intr_frame(info) &&
                    (pr & (1UL << PRED_USER_STACK)))
                        return 0;
+#ifdef XEN
+               /*
+                * vmx fault handlers don't always update vcpu->on_stack
+                * so that the above (pr & (1UL << PRED_USER_STACK)) condition
+                * isn't always true.
+                * hypercall path of break_fault does set pUStk=1,
+                * other fault paths don't set.
+                *
+                * we need to stop unwinding somehow.
+                */
+               if (unw_is_intr_frame(info) &&
+                   info->task->domain->arch.is_vti &&
+                   info->pr_loc == &vcpu_regs(info->task)->pr)
+                       return 0;
+#endif
                if (unw_get_pr (info, &pr) < 0) {
                        unw_get_rp(info, &ip);
                        UNW_DPRINT(0, "unwind.%s: failed to read "

Attachment: 16060_551fb6d70481_fix_stack_unwinder.patch
Description: Text Data

_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-ia64-devel] [PATCH 12/23] vti domain save/restore: fix stack unwinder, Isaku Yamahata <=