[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libunwind] Unwinding using the context passed to a signal handler (

From: David Mosberger
Subject: Re: [libunwind] Unwinding using the context passed to a signal handler (doesn't work)
Date: Tue, 23 Mar 2004 13:29:02 -0800

>>>>> On Mon, 22 Mar 2004 10:08:59 +0100, address@hidden (Matthieu Delahaye) 
>>>>> said:

  Matthieu> The attached program and tests/bt.c are both using
  Matthieu> unw_get_proc_name.  The "Thread and signal safety" section
  Matthieu> of the related man page specify it is not safe to use from
  Matthieu> a signal handler.  In this two files, this function is
  Matthieu> used inside of a signal handler.

Yes, indeed.

  Matthieu> So my questions: - What is dangerous by calling this
  Matthieu> function inside of a signal handler?  - What is the
  Matthieu> safiest way? Dumping the stack and resume the control into
  Matthieu> "normal" mode to analyse the stack once again? [If it is
  Matthieu> possible].

The main concern is deadlock.  If libunwind were to aquire a lock in
unw_get_proc_name() without disabling all signal delivery, you could
get a deadlock if a signal handler was invoked and an attempt were
made to reaquire that same lock.

Perhaps I should allow unw_get_proc_name() to be called from a
signal-handler.  I'm pretty sure the current code would be OK, but I
want to think some more about it before making a final decision.

Thanks for pointing out this issue.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]