public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] i386: fix one case of stuck dwarf2 unwinder
@ 2006-08-05 20:36 Chuck Ebbert
  2006-08-06  2:30 ` Andi Kleen
  0 siblings, 1 reply; 4+ messages in thread
From: Chuck Ebbert @ 2006-08-05 20:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jan Beulich, Andi Kleen, Dave Jones, Jesper Juhl, Andrew Morton

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.

Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>

---

I copied people who posted traces where this happened. Can anyone
test if this fixes the problem?

--- 2.6.18-rc3-d4.orig/include/asm-i386/unwind.h
+++ 2.6.18-rc3-d4/include/asm-i386/unwind.h
@@ -71,13 +71,14 @@ extern asmlinkage int arch_unwind_init_r
                                                                           void *arg),
                                                void *arg);
 
+extern void stext(void); /* real start of kernel text */
 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;
-- 
Chuck

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] i386: fix one case of stuck dwarf2 unwinder
  2006-08-05 20:36 [patch] i386: fix one case of stuck dwarf2 unwinder Chuck Ebbert
@ 2006-08-06  2:30 ` Andi Kleen
  0 siblings, 0 replies; 4+ messages in thread
From: Andi Kleen @ 2006-08-06  2:30 UTC (permalink / raw)
  To: Chuck Ebbert
  Cc: linux-kernel, Jan Beulich, Dave Jones, Jesper Juhl, Andrew Morton


> --- 2.6.18-rc3-d4.orig/include/asm-i386/unwind.h
> +++ 2.6.18-rc3-d4/include/asm-i386/unwind.h
> @@ -71,13 +71,14 @@ extern asmlinkage int arch_unwind_init_r
>                                                                            void *arg),
>                                                 void *arg);
>  
> +extern void stext(void); /* real start of kernel text */

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

-Andi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] i386: fix one case of stuck dwarf2 unwinder
@ 2006-08-06  5:00 Chuck Ebbert
  2006-08-06  6:01 ` Andi Kleen
  0 siblings, 1 reply; 4+ messages in thread
From: Chuck Ebbert @ 2006-08-06  5:00 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Andrew Morton, Jesper Juhl, Dave Jones, Jan Beulich, linux-kernel

In-Reply-To: <200608060430.06935.ak@suse.de>

On Sun, 6 Aug 2006 04:30:06 +0200, Andi Kleen wrote:
> 
> > +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.

Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>

--- 2.6.18-rc3-32.orig/include/asm-i386/unwind.h
+++ 2.6.18-rc3-32/include/asm-i386/unwind.h
@@ -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;
-- 
Chuck

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] i386: fix one case of stuck dwarf2 unwinder
  2006-08-06  5:00 Chuck Ebbert
@ 2006-08-06  6:01 ` Andi Kleen
  0 siblings, 0 replies; 4+ messages in thread
From: Andi Kleen @ 2006-08-06  6:01 UTC (permalink / raw)
  To: Chuck Ebbert
  Cc: Andrew Morton, Jesper Juhl, Dave Jones, Jan Beulich, linux-kernel

On Sunday 06 August 2006 07:00, Chuck Ebbert wrote:
> In-Reply-To: <200608060430.06935.ak@suse.de>
> 
> On Sun, 6 Aug 2006 04:30:06 +0200, Andi Kleen wrote:
> > 
> > > +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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-08-06  6:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-05 20:36 [patch] i386: fix one case of stuck dwarf2 unwinder Chuck Ebbert
2006-08-06  2:30 ` Andi Kleen
  -- strict thread matches above, loose matches on Subject: below --
2006-08-06  5:00 Chuck Ebbert
2006-08-06  6:01 ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox