From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Keir Fraser <keir@xen.org>, Jan Beulich <JBeulich@suse.com>,
Tim Deegan <tim@xen.org>
Subject: [Patch v3 3/4] x86/stack: Change show_stack_overflow() to use frame pointers if available
Date: Mon, 18 Nov 2013 19:34:23 +0000 [thread overview]
Message-ID: <1384803264-1093-4-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1384803264-1093-1-git-send-email-andrew.cooper3@citrix.com>
Pass a full set of cpu_user_regs, and defer the hand-coded stack printing to
__show_trace(), which will correctly use frame pointers if available.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Tim Deegan <tim@xen.org>
---
xen/arch/x86/traps.c | 14 ++++----------
xen/arch/x86/x86_64/traps.c | 2 +-
xen/include/asm-x86/processor.h | 2 +-
3 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index d68f93c..67be3c4 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -316,11 +316,11 @@ void show_stack(struct cpu_user_regs *regs)
show_trace(regs);
}
-void show_stack_overflow(unsigned int cpu, unsigned long esp)
+void show_stack_overflow(unsigned int cpu, const struct cpu_user_regs *regs)
{
#ifdef MEMORY_GUARD
+ unsigned long esp = regs->rsp;
unsigned long esp_top, esp_bottom;
- unsigned long *stack, addr;
esp_bottom = (esp | (STACK_SIZE - 1)) + 1;
esp_top = esp_bottom - PRIMARY_STACK_SIZE;
@@ -340,16 +340,10 @@ void show_stack_overflow(unsigned int cpu, unsigned long esp)
if ( esp < esp_top )
esp = esp_top;
- printk("Xen stack overflow (dumping trace %p-%p):\n ",
+ printk("Xen stack overflow (dumping trace %p-%p):\n",
(void *)esp, (void *)esp_bottom);
- stack = (unsigned long *)esp;
- while ( ((long)stack & (STACK_SIZE-BYTES_PER_LONG)) != 0 )
- {
- addr = *stack++;
- if ( is_active_kernel_text(addr) )
- printk("%p: [<%p>] %pS\n", stack, _p(addr), _p(addr));
- }
+ __show_trace(esp, regs->rbp);
printk("\n");
#endif
diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c
index 8e6a7c1..bcf72b6 100644
--- a/xen/arch/x86/x86_64/traps.c
+++ b/xen/arch/x86/x86_64/traps.c
@@ -248,7 +248,7 @@ void do_double_fault(struct cpu_user_regs *regs)
printk("CPU: %d\n", cpu);
_show_registers(regs, crs, CTXT_hypervisor, NULL);
- show_stack_overflow(cpu, regs->rsp);
+ show_stack_overflow(cpu, regs);
panic("DOUBLE FAULT -- system shutdown\n");
}
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index 73a3202..c120460 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -509,7 +509,7 @@ extern always_inline void prefetchw(const void *x)
#endif
void show_stack(struct cpu_user_regs *regs);
-void show_stack_overflow(unsigned int cpu, unsigned long esp);
+void show_stack_overflow(unsigned int cpu, const struct cpu_user_regs *regs);
void show_registers(struct cpu_user_regs *regs);
void show_execution_state(struct cpu_user_regs *regs);
#define dump_execution_state() run_in_exception_handler(show_execution_state)
--
1.7.10.4
next prev parent reply other threads:[~2013-11-18 19:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-18 19:34 [Patch v3 0/4] Xen stack trace printing improvements Andrew Cooper
2013-11-18 19:34 ` [Patch v3 1/4] x86/stack: Refactor show_trace() Andrew Cooper
2013-11-20 9:43 ` Jan Beulich
2013-11-18 19:34 ` [Patch v3 2/4] x86/stack: Adjust boundary conditions for printed stacks Andrew Cooper
2013-11-20 9:49 ` Jan Beulich
2013-11-18 19:34 ` Andrew Cooper [this message]
2013-11-20 9:51 ` [Patch v3 3/4] x86/stack: Change show_stack_overflow() to use frame pointers if available Jan Beulich
2013-11-18 19:34 ` [Patch v3 4/4] DO NOT APPLY: Test code for interesting stack overflows Andrew Cooper
2013-11-19 10:10 ` [Patch v3 0/4] Xen stack trace printing improvements George Dunlap
2013-11-19 10:50 ` Andrew Cooper
2013-11-19 11:01 ` George Dunlap
2013-11-19 16:07 ` Keir Fraser
2013-11-19 16:10 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1384803264-1093-4-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).