[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] - Stacktrace modification



This patch aids the quick diagnosis of stack overflow bugs.
In the debug build when showing a stack trace, show stack limits
and stack frame addresses.  This results in the follow
appearance:

    (XEN) Stack base:ffff830000234000 limit:ffff830000233000
    (XEN) Xen call trace:
    (XEN)    ffff830000233c28[<ffff830000144fe4>] put_page_type+0xf8/0x455
(XEN) ffff830000233c48[<ffff830000140d0a>] put_page_and_type+0x15/0x20 (XEN) ffff830000233c88[<ffff830000142271>] put_page_from_l1e+0x12a/0x1ad
    (XEN)    ffff830000233cf8[<ffff83000014b7d9>] revalidate_l1+0x18f/0x1a7
    (XEN)    ffff830000233d88[<ffff83000014ba93>] ptwr_flush+0x2a2/0x4fb
(XEN) ffff830000233da8[<ffff83000014cd86>] cleanup_writable_pagetable+0x68/0x88
    (XEN)    ffff830000233f08[<ffff8300001469cf>] do_mmuext_op+0xd4/0xaf5
    (XEN)    00007cffffdcc0b7[<ffff8300001ca45d>] syscall_enter+0xad/0x107

Signed-off-by: Robert S. Phillips (rphillips@xxxxxxxxxxxxxxx)
# HG changeset patch
# User rphillips@rphillips
# Node ID f5480845f7080594723fe107e04fb4b9e4223b74
# Parent  204450e59b0a80a99ae335ef9cdf33de0caaaa77

This patch aids the quick diagnosis of stack overflow bugs.
In the debug build when showing a stack trace, show stack limits
and stack frame addresses.  This results in the follow
appearance:

     (XEN) Stack base:ffff830000234000 limit:ffff830000233000
     (XEN) Xen call trace:
     (XEN)    ffff830000233c28[<ffff830000144fe4>] put_page_type+0xf8/0x455
     (XEN)    ffff830000233c48[<ffff830000140d0a>] put_page_and_type+0x15/0x20
     (XEN)    ffff830000233c88[<ffff830000142271>] put_page_from_l1e+0x12a/0x1ad
     (XEN)    ffff830000233cf8[<ffff83000014b7d9>] revalidate_l1+0x18f/0x1a7
     (XEN)    ffff830000233d88[<ffff83000014ba93>] ptwr_flush+0x2a2/0x4fb
     (XEN)    ffff830000233da8[<ffff83000014cd86>] 
cleanup_writable_pagetable+0x68/0x88
     (XEN)    ffff830000233f08[<ffff8300001469cf>] do_mmuext_op+0xd4/0xaf5
     (XEN)    00007cffffdcc0b7[<ffff8300001ca45d>] syscall_enter+0xad/0x107

Signed-off-by: Robert S. Phillips (rphillips@xxxxxxxxxxxxxxx)

diff -r 204450e59b0a -r f5480845f708 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Tue May 16 11:26:53 2006 -0400
+++ b/xen/arch/x86/traps.c      Tue May 16 11:47:06 2006 -0400
@@ -198,20 +198,22 @@
 
 static void show_trace(struct cpu_user_regs *regs)
 {
-    unsigned long *frame, next, addr, low, high;
-
-    printk("Xen call trace:\n   ");
-
-    printk("[<%p>]", _p(regs->eip));
-    print_symbol(" %s\n   ", regs->eip);
+    unsigned long *frame, next, addr, low, high, bos, los;
 
     /* Bounds for range of valid frame pointer. */
     low  = (unsigned long)(ESP_BEFORE_EXCEPTION(regs) - 2);
     high = (low & ~(STACK_SIZE - 1)) + 
         (STACK_SIZE - sizeof(struct cpu_info) - 2*sizeof(unsigned long));
-
+    bos = (low & ~(STACK_SIZE - 1)) + STACK_SIZE;
+    los = bos - PAGE_SIZE;
+    printk("Stack base:%p limit:%p\n", _p(bos), _p(los));
+    printk("Xen call trace:\n   ");
+    
     /* The initial frame pointer. */
     next = regs->ebp;
+    
+    printk("%p[<%p>]", _p(next), _p(regs->eip));
+    print_symbol(" %s\n   ", regs->eip);
 
     for ( ; ; )
     {
@@ -239,7 +241,7 @@
             addr  = frame[1];
         }
 
-        printk("[<%p>]", _p(addr));
+        printk("%p[<%p>]", _p(next), _p(addr));
         print_symbol(" %s\n   ", addr);
 
         low = (unsigned long)&frame[2];
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.