gcc7/gcc-4.9.1-libbacktrace-fix-null-callback.patch
Eugene Shatokhin d268577515 Fixed: state->fileline_fn could be 0 in libbacktrace in some cases
This lead, among other things, to crashes of the apps built with TSan
enabled. When the app (or, to be exact, TSan) tried to output a
backtrace of a suspicious event, backtrace_pcinfo() was invoked.

At the end it called state->fileline_fn() which should have been set
before. However, it was not always the case. If debug info was missing
from some library used by the app or it was in a format that
libbacktrace did not understand, libbacktrace did not set
state->fileline_fn. The latter remained 0 and that resulted in a
segfault in backtrace_pcinfo().

Should now be fixed. The fix makes sure that the callback is always
initialized.
2014-08-13 13:33:03 +04:00

11 lines
417 B
Diff

--- gcc-linaro-4.9-2014.07/libbacktrace/elf.c.orig 2014-03-07 09:07:56.000000000 +0400
+++ gcc-linaro-4.9-2014.07/libbacktrace/elf.c 2014-08-13 12:56:23.285272323 +0400
@@ -925,7 +925,7 @@
int ret;
int found_sym;
int found_dwarf;
- fileline elf_fileline_fn;
+ fileline elf_fileline_fn = elf_nodebug;
struct phdr_data pd;
ret = elf_add (state, descriptor, 0, error_callback, data, &elf_fileline_fn,