[PATCH 4/5] Support backtracing through elfutils (#70746)

Peter Hutterer peter.hutterer at who-t.net
Fri Nov 1 00:40:31 CET 2013


On Thu, Oct 31, 2013 at 03:39:18PM +0100, Jan Kratochvil wrote:
> On Thu, 31 Oct 2013 11:28:14 +0100, Jan Kratochvil wrote:
> > Calling backtrace() for the first time also is not signal-safe:
> > glibc/sysdeps/x86_64/backtrace.c init() calls __libc_dlopen().
> > Maybe xorg could call backtrace() just during init to get backtrace()
> > initialized, I am not completely sure it will be signal-safe then but it may be.
> 
> That initialization is already done in xserver as shown by Adam Jackson:
> 	http://cgit.freedesktop.org/xorg/xserver/commit/?id=0b131a5cd91cea54240777c66a9cd385029e8cb2
> 
> 
> > To get .symtab symbols resolution the only safe way is to do fork()+exec().
> 
> Surprisingly libunwind is mostly signal-safe, similarly like backtrace() is.
> As pointer out by Jakub Jelinek, they are not completely safe wrt
> _dl_load_lock dependency of dl_iterate_phdr() which is used by both.
> But that should not matter too much in practice for xserver.
> 
> I would still find safer to run external backtracer via fork()+exec() than
> doing the whole backtrace from SIGSEGV handler, for example due to memory
> corruption inside xserver.
> 
> That is without fork()+exec() libunwind is currently the best there is for
> xserver.

ok, in that case I'll leave libunwind in for the time being because right
now I don't really have the time to work around this otherwise.

Cheers,
   Peter



More information about the xorg-devel mailing list