Skip to contentSkip to conversation

i386: fix one case of stuck dwarf2 unwinder

PATCH Chuck Ebbert 2 participants 3 messages Aug 6, 2006

lore
Share & tools
lore
#0 lore raw

In-Reply-To: <[email protected]>

Quoted 4 lines · Andi Kleen
Quoted 2 lines

+extern void stext(void); /* real start of kernel text */

Can't you use _stext[] from asm/sections.h?

OK.

[patch] i386: fix one case of stuck dwarf2 unwinder

When the dwarf2 unwinder does its thing, sometimes it ends up in kernel startup code in head.S. Changing arch_unw_user_mode() to treat that case as if it were user mode is the easy fix.

include/asm-i386/unwind.h +3 -1
@@ -13,6 +13,7 @@
 #include <asm/fixmap.h>
 #include <asm/ptrace.h>
 #include <asm/uaccess.h>
+#include <asm/sections.h>
 
 struct unwind_frame_info
 {
@@ -71,13 +72,14 @@ extern asmlinkage int arch_unwind_init_r
                                                                           void *arg),
                                                void *arg);
 
+/* check if unwind has reached either user mode or kernel startup code */
 static inline int arch_unw_user_mode(const struct unwind_frame_info *info)
 {
 #if 0 /* This can only work when selector register and EFLAGS saves/restores
          are properly annotated (and tracked in UNW_REGISTER_INFO). */
 	return user_mode_vm(&info->regs);
 #else
-	return info->regs.eip < PAGE_OFFSET
+	return info->regs.eip < (unsigned long)_stext
 	       || (info->regs.eip >= __fix_to_virt(FIX_VDSO)
 	            && info->regs.eip < __fix_to_virt(FIX_VDSO) + PAGE_SIZE)
 	       || info->regs.esp < PAGE_OFFSET;
Signature · 1 line
Chuck
#1 lore raw
Quoted 9 lines · Chuck Ebbert

In-Reply-To: <[email protected]>

Quoted 4 lines · Andi Kleen
Quoted 2 lines

+extern void stext(void); /* real start of kernel text */

Can't you use _stext[] from asm/sections.h?

OK.

Applied thanks. I did a similar x86-64 change.

-Andi

#2 lore raw

Re: [patch] i386: fix one case of stuck dwarf2 unwinder II

In reply to Chuck Ebbert
Quoted 9 lines · Chuck Ebbert

In-Reply-To: <[email protected]>

Quoted 4 lines · Andi Kleen
Quoted 2 lines

+extern void stext(void); /* real start of kernel text */

Can't you use _stext[] from asm/sections.h?

OK.

Hmm, actually I applied it but then I had doubts it actually works -- I think you don't need _stext but the code before the first call in head. Since head.S doesn't do a call that's probably start_kernel

Can you please resubmit a patch that does this properly?

-Andi