From: Alexander van Heukelum <heukelum@fastmail.fm>
To: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Alexander van Heukelum <heukelum@fastmail.fm>
Subject: [PATCH] dumpstack: x86: add "end" parameter to valid_stack_ptr and print_context_stack
Date: Sat, 4 Oct 2008 23:12:42 +0200 [thread overview]
Message-ID: <1223154766-19350-4-git-send-email-heukelum@fastmail.fm> (raw)
In-Reply-To: <1223154766-19350-3-git-send-email-heukelum@fastmail.fm>
- Add "end" parameter to valid_stack_ptr and print_context_stack
- use sizeof(long) as the size of a word on the stack
Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
---
arch/x86/kernel/dumpstack_32.c | 19 +++++++++++++------
arch/x86/kernel/dumpstack_64.c | 2 +-
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index 62f71c8..09cd37c 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -28,10 +28,16 @@ void printk_address(unsigned long address, int reliable)
}
static inline int valid_stack_ptr(struct thread_info *tinfo,
- void *p, unsigned int size)
+ void *p, unsigned int size, void *end)
{
void *t = tinfo;
- return p > t && p <= t + THREAD_SIZE - size;
+ if (end) {
+ if (p < end && p >= (end-THREAD_SIZE))
+ return 1;
+ else
+ return 0;
+ }
+ return p > t && p < t + THREAD_SIZE - size;
}
/* The form of the top of the frame on the stack */
@@ -43,16 +49,17 @@ struct stack_frame {
static inline unsigned long
print_context_stack(struct thread_info *tinfo,
unsigned long *stack, unsigned long bp,
- const struct stacktrace_ops *ops, void *data)
+ const struct stacktrace_ops *ops, void *data,
+ unsigned long *end)
{
struct stack_frame *frame = (struct stack_frame *)bp;
- while (valid_stack_ptr(tinfo, stack, sizeof(*stack))) {
+ while (valid_stack_ptr(tinfo, stack, sizeof(*stack), end)) {
unsigned long addr;
addr = *stack;
if (__kernel_text_address(addr)) {
- if ((unsigned long) stack == bp + 4) {
+ if ((unsigned long) stack == bp + sizeof(long)) {
ops->address(data, addr, 1);
frame = frame->next_frame;
bp = (unsigned long) frame;
@@ -96,7 +103,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
context = (struct thread_info *)
((unsigned long)stack & (~(THREAD_SIZE - 1)));
- bp = print_context_stack(context, stack, bp, ops, data);
+ bp = print_context_stack(context, stack, bp, ops, data, NULL);
/*
* Should be after the line below, but somewhere
* in early boot context comes out corrupted and we
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index f215f1c..9e40357 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -141,7 +141,7 @@ print_context_stack(struct thread_info *tinfo,
addr = *stack;
if (__kernel_text_address(addr)) {
- if ((unsigned long) stack == bp + 8) {
+ if ((unsigned long) stack == bp + sizeof(long)) {
ops->address(data, addr, 1);
frame = frame->next_frame;
bp = (unsigned long) frame;
--
1.5.4.3
next prev parent reply other threads:[~2008-10-04 21:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-04 21:12 [PATCH] dumpstack: x86: various small unification steps Alexander van Heukelum
2008-10-04 21:12 ` [PATCH] dumpstack: x86: move die_nmi to dumpstack_32.c Alexander van Heukelum
2008-10-04 21:12 ` [PATCH] dumpstack: x86: make printk_address equal Alexander van Heukelum
2008-10-04 21:12 ` Alexander van Heukelum [this message]
2008-10-04 21:12 ` [PATCH] dumptrace: x86: consistently include loglevel, print stack switch Alexander van Heukelum
2008-10-04 21:12 ` [PATCH] dumpstack: x86: use log_lvl and unify trace formatting Alexander van Heukelum
2008-10-04 21:12 ` [PATCH] dumpstack: i386: make kstack= an early boot-param and add oops=panic Alexander van Heukelum
2008-10-04 21:12 ` [PATCH] dumpstack: x86: various small unification steps Alexander van Heukelum
2008-10-06 9:35 ` Louis Rilling
2008-10-06 9:43 ` Alexander van Heukelum
2008-10-05 9:35 ` Ingo Molnar
2008-10-05 9:46 ` Ingo Molnar
2008-10-05 10:39 ` Alexander van Heukelum
2008-10-05 16:38 ` Ingo Molnar
2008-10-05 11:40 ` Alexander van Heukelum
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=1223154766-19350-4-git-send-email-heukelum@fastmail.fm \
--to=heukelum@fastmail.fm \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®