How to use backtrace() safely in signal handler.

Paul Guo
Fri Dec 6 02:08:00 GMT 2019

On Thu, Dec 5, 2019 at 10:02 PM Carlos O'Donell <>

> On Thu, Dec 5, 2019 at 8:16 AM Paul Guo <> wrote:
> > but I want to know how unsafe it is and see if I could use that safely in
> > signal handler with some limitations.
> Why do you want to call backtrace() from a signal handler?

Typically program sigsegv handler wants a backtrace and saves them somwhere
then rethrows the signal (and then program quits). This is a very
convenient practice
and seems to be not unusual in some softwares.

In the past this was the accepted practice for doing crash backtrace
> handling.
> In-process crash backtrace handling is a security risk and unsafe.
> Is there any reason why you don't pursue out-of-process handling?
> Cheers,
> Carlos.

More information about the Libc-help mailing list