systemtap/SOURCES/rhbz1795196.patch

70 lines
2.8 KiB
Diff

commit 6053cecf4a4ffd19d1ac0a3bb3ffef100ab83fda
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Tue Jan 28 15:48:42 2020 -0500
RHBZ1795196: tolerate partial elf + missing dwarf vmlinuz for -d kernel
Previous code in dump_symbol_tables() couldn't tolerate the case where
new elfutils opened /boot/vmlinuz* as an elf file for the kernel, and
could not extract a symbol table from that (nor an absent -debuginfo).
New code instead emits a warning and moves on. A special error code
triggers return to the dump_kallsyms() path that prior elfutils/stap
versions rely on.
diff --git a/testsuite/systemtap.base/kallsyms.exp b/testsuite/systemtap.base/kallsyms.exp
index 8ee5242..13ca4ad 100644
--- a/testsuite/systemtap.base/kallsyms.exp
+++ b/testsuite/systemtap.base/kallsyms.exp
@@ -5,7 +5,10 @@ if {![installtest_p]} {untested $test; return}
set script {"probe timer.profile {print_stack(backtrace()); exit()}"}
set passed 0
+# don't let stap find kernel debuginfo!
setenv SYSTEMTAP_DEBUGINFO_PATH $srcdir
+setenv DEBUGINFOD_URLS ""
+setenv DEBUGINFOD_CACHE_PATH "/dev/null"
eval spawn stap --all-modules -e $script
expect {
diff --git a/translate.cxx b/translate.cxx
index f142667..9e30427 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -6786,7 +6786,17 @@ dump_symbol_tables (Dwfl_Module *m,
dwfl_module_info (m, NULL, NULL, &end, NULL, NULL, NULL, NULL);
int syments = dwfl_module_getsymtab(m);
- DWFL_ASSERT (_F("Getting symbol table for %s", modname), syments >= 0);
+ if (syments < 0) // RHBZ1795196: elfutils 0.178+ can open vmlinuz as elf.main but fail here
+ {
+ c->session.print_warning(_F("libdwfl failure getting symbol table for %s: %s",
+ modname, dwfl_errmsg(-1)));
+ return DWARF_CB_ABORT;
+
+ // signal to dump_unwindsyms() to not let things proceed all the way to
+ // dump_unwindsym_cxt(), which then believes it has all the info for a
+ // complete record about this module. In the kernel's case, this allows
+ // PR17921 fallback to /proc/kallsyms via dump_kallsyms().
+ }
// Look up the relocation basis for symbols
int n = dwfl_module_relocations (m);
commit 3d571c2ab5797b41d07b51a7bbff626270d1e263
Author: Craig Ringer <craig.ringer@2ndquadrant.com>
Date: Sun Dec 29 14:51:47 2019 -0500
PR25265: fix strict-prototypes nit autoconf-stack-trace-save-regs.c
diff --git a/runtime/linux/autoconf-stack-trace-save-regs.c b/runtime/linux/autoconf-stack-trace-save-regs.c
index 8bf3339..1fd515f 100644
--- a/runtime/linux/autoconf-stack-trace-save-regs.c
+++ b/runtime/linux/autoconf-stack-trace-save-regs.c
@@ -1,6 +1,6 @@
#include <linux/stacktrace.h>
-unsigned int foo ()
+unsigned int foo (void)
{
unsigned long e[10];
struct pt_regs* r = 0;