public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Stack unwind across signal frame
@ 2012-02-17 21:13 Alan Cooper
  2012-02-18  7:12 ` Hillf Danton
  2012-02-18 17:05 ` David Daney
  0 siblings, 2 replies; 3+ messages in thread
From: Alan Cooper @ 2012-02-17 21:13 UTC (permalink / raw)
  To: linux-mips, linux-kernel

I'm seeing a problem on both 2.6.37 and 3.3 MIPS kernels where I can't
unwind through a MIPS signal frame. It looks like this is caused by
the VDSO code that was added 2/2010. When the unwinder tries to find
the frame info for the caller of the signal handler (the trampoline in
VDSO), it can't find the eh_frame info because the address is in the
VDSO area and stops unwinding. It looks like other platforms solve
this by adding the eh_frame info for the VDSO area so the lookup
works.

This problem ends up breaking pthread cleanup for C++ programs because
the cleanup is done using a class with the expectation that the
destructor will be called when the thread gets canceled by a cancel
signal. This seems like a big problem for all current MIPS kernels so
I was wondering if I'm missing something?

If this is correct, then it seems like the best solution would be to
add the VDSO eh_frame info to MIPS.

Thanks
Al Cooper

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

* Re: Stack unwind across signal frame
  2012-02-17 21:13 Stack unwind across signal frame Alan Cooper
@ 2012-02-18  7:12 ` Hillf Danton
  2012-02-18 17:05 ` David Daney
  1 sibling, 0 replies; 3+ messages in thread
From: Hillf Danton @ 2012-02-18  7:12 UTC (permalink / raw)
  To: Alan Cooper; +Cc: linux-mips, linux-kernel

On Sat, Feb 18, 2012 at 5:13 AM, Alan Cooper <alcooperx@gmail.com> wrote:
> This problem ends up breaking pthread cleanup for C++ programs because
> the cleanup is done using a class with the expectation that the
> destructor will be called when the thread gets canceled by a cancel
> signal. This seems like a big problem for all current MIPS kernels so
> I was wondering if I'm missing something?
>
> If this is correct, then it seems like the best solution would be to
> add the VDSO eh_frame info to MIPS.
>
Feel free to send a patch after testing;)

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

* Re: Stack unwind across signal frame
  2012-02-17 21:13 Stack unwind across signal frame Alan Cooper
  2012-02-18  7:12 ` Hillf Danton
@ 2012-02-18 17:05 ` David Daney
  1 sibling, 0 replies; 3+ messages in thread
From: David Daney @ 2012-02-18 17:05 UTC (permalink / raw)
  To: Alan Cooper; +Cc: linux-mips, linux-kernel

On 02/17/2012 01:13 PM, Alan Cooper wrote:
> I'm seeing a problem on both 2.6.37 and 3.3 MIPS kernels where I can't
> unwind through a MIPS signal frame.
You don't tell us the version of the unwinder (likely from libgcc) you 
are using.  There was a lot of work in this area four or five years ago, 
I didn't take the time to do the required archaeology to determine the 
exact patch, but likely you are missing this.

>   It looks like this is caused by
> the VDSO code that was added 2/2010.
Some CPUs have errata necessitating a different signal frame layout, on 
these CPUs, you wouldn't be able to unwind either, even pre mips-vdso.

>   When the unwinder tries to find
> the frame info for the caller of the signal handler (the trampoline in
> VDSO), it can't find the eh_frame info because the address is in the
> VDSO area and stops unwinding. It looks like other platforms solve
> this by adding the eh_frame info for the VDSO area so the lookup
> works.

That's right.  However all 'modern' GCCs and GDBs can unwind through 
signal frames on all 2.4.x and later kernels.  I would recommend 
upgrading your GCC to 4.6.2, and see if you obtain better results.

> This problem ends up breaking pthread cleanup for C++ programs because
> the cleanup is done using a class with the expectation that the
> destructor will be called when the thread gets canceled by a cancel
> signal. This seems like a big problem for all current MIPS kernels so
> I was wondering if I'm missing something?

A modern libgcc I think.

>
> If this is correct, then it seems like the best solution would be to
> add the VDSO eh_frame info to MIPS.

Having a correct eh_frame in the vdso, would be nice, but is not the 
highest priority for me.


David Daney


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

end of thread, other threads:[~2012-02-18 17:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-17 21:13 Stack unwind across signal frame Alan Cooper
2012-02-18  7:12 ` Hillf Danton
2012-02-18 17:05 ` David Daney

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