From: Arjan van de Ven <arjan@infradead.org>
To: linux-kernel@vger.kernel.org
Cc: mingo@elte.hu, akpm@linux-foundation.org, torvalds@linux-foundation.org
Subject: Make the 32 bit Frame Pointer backtracer fall back to traditional
Date: Wed, 9 Jan 2008 22:05:08 -0800 [thread overview]
Message-ID: <20080109220508.686bbda4@laptopd505.fenrus.org> (raw)
Subject: Make the 32 bit Frame Pointer backtracer fall back to traditional
From: Arjan van de Ven <arjan@linux.intel.com>
The 32 bit Frame Pointer backtracer code checks if the EBP is valid
to do a backtrace; however currently on a failure it just gives up
and prints nothing. That's not very nice; we can do better and still
print a decent backtrace.
This patch changes the backtracer to fall back to the non-framepointer
backtracer if the EBP value isn't within the expected range; so on weird
stack corruption cases we get at least something out...
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
arch/x86/kernel/traps_32.c | 43 ++++++++++++++++++++++---------------------
1 file changed, 22 insertions(+), 21 deletions(-)
Index: linux-2.6.24-rc7/arch/x86/kernel/traps_32.c
===================================================================
--- linux-2.6.24-rc7.orig/arch/x86/kernel/traps_32.c
+++ linux-2.6.24-rc7/arch/x86/kernel/traps_32.c
@@ -119,26 +119,28 @@ static inline unsigned long print_contex
{
#ifdef CONFIG_FRAME_POINTER
struct stack_frame *frame = (struct stack_frame *)ebp;
- while (valid_stack_ptr(tinfo, frame, sizeof(*frame))) {
- struct stack_frame *next;
- unsigned long addr;
-
- addr = frame->return_address;
- if (__kernel_text_address(addr))
- ops->address(data, addr);
- /*
- * break out of recursive entries (such as
- * end_of_stack_stop_unwind_function). Also,
- * we can never allow a frame pointer to
- * move downwards!
- */
- next = frame->next_frame;
- ebp = (unsigned long) next;
- if (next <= frame)
- break;
- frame = next;
- }
-#else
+ if (valid_stack_ptr(tinfo, frame, sizeof(*frame)))
+ while (valid_stack_ptr(tinfo, frame, sizeof(*frame))) {
+ struct stack_frame *next;
+ unsigned long addr;
+
+ addr = frame->return_address;
+ if (__kernel_text_address(addr))
+ ops->address(data, addr);
+ /*
+ * break out of recursive entries (such as
+ * end_of_stack_stop_unwind_function). Also,
+ * we can never allow a frame pointer to
+ * move downwards!
+ */
+ next = frame->next_frame;
+ ebp = (unsigned long) next;
+ if (next <= frame)
+ break;
+ frame = next;
+ }
+ else
+#endif
while (valid_stack_ptr(tinfo, stack, sizeof(*stack))) {
unsigned long addr;
@@ -146,7 +148,6 @@ static inline unsigned long print_contex
if (__kernel_text_address(addr))
ops->address(data, addr);
}
-#endif
return ebp;
}
--
If you want to reach me at my work email, use arjan@linux.intel.com
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
next reply other threads:[~2008-01-10 6:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-10 6:05 Arjan van de Ven [this message]
2008-01-10 6:21 ` Harvey Harrison
2008-01-10 12:46 ` Ingo Molnar
2008-01-10 15:15 ` Arjan van de Ven
2008-01-10 6:55 ` Ingo Molnar
2008-01-10 16:36 ` Linus Torvalds
2008-01-10 16:49 ` Arjan van de Ven
2008-01-11 4:35 ` Arjan van de Ven
2008-01-11 11:54 ` Olaf Dietsche
2008-01-11 19:41 ` Linus Torvalds
2008-01-11 19:56 ` Arjan van de Ven
2008-01-11 22:01 ` Theodore Tso
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=20080109220508.686bbda4@laptopd505.fenrus.org \
--to=arjan@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®