diff --git a/.gitignore b/.gitignore index 8bcb45a..6ba9fd6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/systemtap-4.1.tar.gz +SOURCES/systemtap-4.2.tar.gz diff --git a/.systemtap.metadata b/.systemtap.metadata index bbcb4c0..e0f0963 100644 --- a/.systemtap.metadata +++ b/.systemtap.metadata @@ -1 +1 @@ -d3653e17960ac8bb23be3bb57dfa4b17dcb9d27d SOURCES/systemtap-4.1.tar.gz +efdb0d6e09ebdfa2acbfdb725542885db2195bb6 SOURCES/systemtap-4.2.tar.gz diff --git a/SOURCES/pr23074.patch b/SOURCES/pr23074.patch deleted file mode 100644 index 76e0201..0000000 --- a/SOURCES/pr23074.patch +++ /dev/null @@ -1,51 +0,0 @@ -commit 83071bc877b462eacca309fa49c9e8112fc16bdf -Author: Jafeer Uddin -Date: Thu May 9 16:18:46 2019 -0400 - - PR23074: fix guru mode issue with generated calls to register get/set - -diff --git a/elaborate.cxx b/elaborate.cxx -index 9ebf30b..fcd1d1d 100644 ---- a/elaborate.cxx -+++ b/elaborate.cxx -@@ -3073,7 +3073,7 @@ public: - } - - // Don't allow /* guru */ functions unless caller is privileged. -- if (!call->tok->location.file->privileged && -+ if (!call->synthetic && !call->tok->location.file->privileged && - s->tagged_p ("/* guru */")) - throw SEMANTIC_ERROR (_("function may not be used unless -g is specified"), - call->tok); -diff --git a/loc2stap.cxx b/loc2stap.cxx -index c1a48d0..d4fd051 100644 ---- a/loc2stap.cxx -+++ b/loc2stap.cxx -@@ -1745,6 +1745,7 @@ location_context::handle_GNU_parameter_ref (Dwarf_Op expr) - // it and we want to be able to restore the registers back. - functioncall *get_ptregs = new functioncall; - get_ptregs->tok = e->tok; -+ get_ptregs->synthetic = true; - if (this->userspace_p) - get_ptregs->function = std::string("__get_uregs"); - else -@@ -1870,6 +1871,7 @@ location_context::handle_GNU_parameter_ref (Dwarf_Op expr) - // Translation done, restore the pt_regs to its original value - functioncall *set_ptregs = new functioncall; - set_ptregs->tok = e->tok; -+ set_ptregs->synthetic = true; - if (this->userspace_p) - set_ptregs->function = std::string("__set_uregs"); - else -diff --git a/staptree.h b/staptree.h -index d63156f..2735808 100644 ---- a/staptree.h -+++ b/staptree.h -@@ -464,6 +464,7 @@ struct functioncall: public expression - interned_string function; - std::vector args; - std::vector referents; -+ bool synthetic; - functioncall (); - void print (std::ostream& o) const; - void visit (visitor* u); diff --git a/SOURCES/pr23875_bugfix.patch b/SOURCES/pr23875_bugfix.patch deleted file mode 100644 index 32884de..0000000 --- a/SOURCES/pr23875_bugfix.patch +++ /dev/null @@ -1,148 +0,0 @@ -commit e037dc796de75b0d9e7e893fba6a39c2837aca2b -Author: Serhei Makarov -Date: Wed Jul 31 13:25:19 2019 -0400 - - stapbpf pr23875 bugfix :: allocate actual keysize in foreach to avoid stack clobber - - * bpf-translate.cxx (bpf_unparser::visit_foreach_loop): allocate actual keysize. - * testsuite/systemtap.bpf/bpf_tests/foreach_string.stp: new partial PR23858 testcase, - added only the parts necessary to trigger a segfault when bugfix not applied. - -diff --git a/bpf-translate.cxx b/bpf-translate.cxx -index b254be693..720e23d4e 100644 ---- a/bpf-translate.cxx -+++ b/bpf-translate.cxx -@@ -1797,7 +1797,7 @@ bpf_unparser::visit_foreach_loop(foreach_loop* s) - this_prog.mk_jcond (this_ins, NE, this_prog.lookup_reg(BPF_REG_0), i0, - join_block, load_block); - -- this_prog.use_tmp_space(16); -+ this_prog.use_tmp_space(2*keysize); - - emit_jmp(load_block); - -diff --git a/testsuite/systemtap.bpf/bpf_tests/foreach_string.stp b/testsuite/systemtap.bpf/bpf_tests/foreach_string.stp -new file mode 100644 -index 000000000..956b1b409 ---- /dev/null -+++ b/testsuite/systemtap.bpf/bpf_tests/foreach_string.stp -@@ -0,0 +1,119 @@ -+global a[10], b[10] -+ -+probe begin { -+ printf("BEGIN\n") -+ -+ a["p"] = -1 -+ a["q"] = 0 -+ a["r"] = 1 -+ -+ b[-1] = "p" -+ b[0] = "q" -+ b[1] = "r" -+ -+ exit() -+} -+ -+global flag = 1 -+global _flag = 1 -+ -+// XXX Split into separate probes due to stack size constraint. -+global end_probes = 0 // TODO: Remove this workaround for PR24812. -+ -+probe end(1) { -+ printf("first end probe\n") -+ -+ /* TODO: Requires PR23858. -+ foreach (ks- in a limit -10) -+ flag = 0 -+ -+ foreach (ks- in a limit 0) -+ flag = 0 -+ -+ found = 0 -+ foreach (ks+ in a limit 1) { -+ found++ -+ if (a[ks] != -1) -+ flag = 0 -+ } -+ -+ foreach (k in b+ limit 1) { -+ found++ -+ if (k != -1) -+ flag = 0 -+ } -+ if (found != 2) -+ flag = 0 -+ -+ foreach (ks1 in a limit 0) -+ foreach (ks2 in a) -+ flag = 0 -+ -+ foreach (ks1 in a) -+ foreach (ks2 in a limit 0) -+ flag = 0 -+ */ -+ -+ x = 0 -+ foreach (ks in a) -+ x += a[ks] -+ flag = flag && x == 0 -+ -+ if (end_probes == 0) -+ end_probes++ -+ // { end_probes++; next; } // TODO: Investigate using next here. -+ else if (flag) -+ printf("END PASS\n") -+ else -+ printf("END FAIL\n") -+} -+ -+probe end(2) { -+ printf("second end probe\n") -+ -+ /* TODO: Requires PR23858. -+ x = -1 -+ foreach (ks+ in a) -+ flag = flag && x++ == a[ks] -+ flag = flag && x == 2 -+ -+ x = 1 -+ foreach (ks- in a) -+ { -+ flag = flag && x-- == a[ks] -+ } -+ flag = flag && x == -2 -+ -+ x = -1 -+ y = 2 -+ foreach (ks1+ in a) { -+ foreach (k2 in b-) -+ { -+ printf("got %s %d / %d %s\n", ks1, a[ks1], k2, b[k2]) -+ flag = flag && x == a[ks1] -+ && y-- == k2 -+ } -+ x++ -+ y = 2 -+ } -+ */ -+ -+ x = -1 -+ y = 1 -+ foreach (ks1+ in a) { -+ foreach (ks2- in a) -+ // TODO: Requires PR23858. -+ _flag = _flag && x == a[ks1] -+ && y-- == a[ks2] -+ x++ -+ y = 1 -+ } -+ -+ if (end_probes == 0) -+ end_probes++ -+ // { end_probes++; next; } // TODO: Investigate using next here. -+ else if (flag) -+ printf("END PASS\n") -+ else -+ printf("END FAIL\n") -+} diff --git a/SOURCES/rhbz1732173.patch b/SOURCES/rhbz1732173.patch deleted file mode 100644 index 3466649..0000000 --- a/SOURCES/rhbz1732173.patch +++ /dev/null @@ -1,32 +0,0 @@ -commit 7be7af0fda3633cd19e499617834cf4a5f51dd55 -Author: William Cohen -Date: Tue Jul 23 14:24:14 2019 -0400 - - Fix aarch64 to properly access arguments for wrapped syscalls - - Linux 4.18 added wrappers for aarch64 syscalls that pass a pointer to - a struct pt_regs holding the values for the actual arguments. The - syscall tapsets initialize CONTEXT->sregs to point at this data - structure. However, the aarch64 specific register access code was - using the CONTEXT->kregs and just getting the processor register state - when the kprobe triggered rather than the expected arguments in the - data structure being passed into the syscall. The aarch64 specific - register code now gets the syscall arguments from the correct pt_regs - structure. - -diff --git a/tapset/arm64/registers.stp b/tapset/arm64/registers.stp -index b2e5649..8773df2 100644 ---- a/tapset/arm64/registers.stp -+++ b/tapset/arm64/registers.stp -@@ -58,7 +58,10 @@ function uarch_bytes:long() { - function _stp_get_register_by_offset:long (offset:long) %{ /* pure */ - long value; - struct pt_regs *regs; -- regs = (CONTEXT->user_mode_p ? CONTEXT->uregs : CONTEXT->kregs); -+ if (CONTEXT->sregs) -+ regs = CONTEXT->sregs; -+ else -+ regs = (CONTEXT->user_mode_p ? CONTEXT->uregs : CONTEXT->kregs); - if (!regs) { - CONTEXT->last_error = "No registers available in this context"; - return; diff --git a/SOURCES/rhbz1788648.patch b/SOURCES/rhbz1788648.patch new file mode 100644 index 0000000..6b532af --- /dev/null +++ b/SOURCES/rhbz1788648.patch @@ -0,0 +1,65 @@ +commit ab4a060a82d0eb68189590ff3f48e8eb5617b6ae +Author: Frank Ch. Eigler +Date: Thu Jan 9 11:43:59 2020 -0500 + + RHBZ1788648: parse arm64 sys/sdt.h operand format [x?, x?] + + On arm64, the sys/sdt.h operand [x0, x1] was observed, and not + handled. New code in + sdt_uprobe_var_expanding_visitor::try_parse_arg_register_pair + recognizes that and parses it indirectly via + sdt_uprobe_var_expanding_visitor::try_parse_arg_effective_addr . + +diff --git a/tapsets.cxx b/tapsets.cxx +index 68ec74b..aab7c83 100644 +--- a/tapsets.cxx ++++ b/tapsets.cxx +@@ -6949,17 +6949,30 @@ sdt_uprobe_var_expanding_visitor::try_parse_arg_register_pair (target_symbol *e, + const string& asmarg, + long precision) + { ++ + // BZ1613157: for powerpc, accept "R,R", as an alias of "(Ra,Rb)" +- if (sess.architecture.substr(0,7) != "powerpc") +- return NULL; +- +- // test for BASE_REGISTER,INDEX_REGISTER +- string regexp = "^(" + regnames + "),(" + regnames + ")$"; +- vector matches; +- if (!regexp_match(asmarg, regexp, matches)) ++ if (sess.architecture.substr(0,7) == "powerpc") ++ { ++ // test for BASE_REGISTER,INDEX_REGISTER ++ string regexp = "^(" + regnames + "),(" + regnames + ")$"; ++ vector matches; ++ if (!regexp_match(asmarg, regexp, matches)) ++ { ++ // delegate to parenthetic syntax ++ return try_parse_arg_effective_addr (e, string("(")+asmarg+string(")"), precision); ++ } ++ } ++ else if (elf_machine == EM_AARCH64) // BZ1788648 + { +- // delegate to parenthetic syntax +- return try_parse_arg_effective_addr (e, string("(")+asmarg+string(")"), precision); ++ // test for [BASE_REGISTER, INDEX_REGISTER] ++ string regexp = "^\\[(" + regnames + "), (" + regnames + ")\\]$"; ++ vector matches; ++ if (!regexp_match(asmarg, regexp, matches)) ++ { ++ // delegate to parenthetic syntax ++ string regnames = asmarg.substr(1, asmarg.length()-2); // trim the [] ++ return try_parse_arg_effective_addr (e, string("(")+regnames+string(")"), precision); // add the () ++ } + } + + return NULL; +@@ -6975,7 +6988,7 @@ sdt_uprobe_var_expanding_visitor::try_parse_arg_effective_addr (target_symbol *e + // test for OFFSET(BASE_REGISTER,INDEX_REGISTER[,SCALE]) where OFFSET is +-N+-N+-N + // NB: Despite PR11821, we can use regnames here, since the parentheses + // make things unambiguous. (Note: gdb/stap-probe.c also parses this) +- string regexp = "^([+-]?[0-9]*)([+-][0-9]*)?([+-][0-9]*)?[(](" + regnames + "),(" + ++ string regexp = "^([+-]?[0-9]*)([+-][0-9]*)?([+-][0-9]*)?[(](" + regnames + "),[ ]?(" + + regnames + ")(,[1248])?[)]$"; + vector matches; + if (!regexp_match(asmarg, regexp, matches)) diff --git a/SOURCES/rhbz1788662.patch b/SOURCES/rhbz1788662.patch new file mode 100644 index 0000000..66162c6 --- /dev/null +++ b/SOURCES/rhbz1788662.patch @@ -0,0 +1,32 @@ +commit 2699450dde9af4cc609bdeca2b346a014840f0f0 +Author: Frank Ch. Eigler +Date: Thu Jan 23 13:35:30 2020 -0500 + + RHBZ1788662: check rcu_is_watching() before probe entry + + Some tracepoints are problematic because they are called from an idle + context, where RCU/lockdep is not legal to call. On lockdep kernels, + RCU warnings and even possibly-related panics have been reported. + + Kernel tracepoint handlers protect themselves by wrapping their + innards in rcu_irq_enter/rcu_irq_exit(), which flips the legality flag + back on (even during idle), but these functions are not + module-exported, and it's not clear they'd be sufficient anyway. So + we call the module-export'd rcu_is_watching() in + _stp_runtime_get_context() to reject any attempt to start a probe in + such an idling-cpu context. This covers the cpu_idle tracepoint as + well as others. + +diff --git a/runtime/linux/runtime_context.h b/runtime/linux/runtime_context.h +index 48894a6..db38bfc 100644 +--- a/runtime/linux/runtime_context.h ++++ b/runtime/linux/runtime_context.h +@@ -73,6 +73,8 @@ static void _stp_runtime_contexts_free(void) + + static inline struct context * _stp_runtime_get_context(void) + { ++ if (! rcu_is_watching()) // rcu operations are rejected in idle-cpu contexts ++ return 0; // in effect: skip probe + return rcu_dereference_sched(contexts[smp_processor_id()]); + } + diff --git a/SOURCES/rhbz1795196.patch b/SOURCES/rhbz1795196.patch new file mode 100644 index 0000000..7b63aa2 --- /dev/null +++ b/SOURCES/rhbz1795196.patch @@ -0,0 +1,69 @@ +commit 6053cecf4a4ffd19d1ac0a3bb3ffef100ab83fda +Author: Frank Ch. Eigler +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 +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 + +-unsigned int foo () ++unsigned int foo (void) + { + unsigned long e[10]; + struct pt_regs* r = 0; diff --git a/SPECS/systemtap.spec b/SPECS/systemtap.spec index fdd5b0c..0cc668b 100644 --- a/SPECS/systemtap.spec +++ b/SPECS/systemtap.spec @@ -14,7 +14,7 @@ %{!?elfutils_version: %global elfutils_version 0.142} %{!?pie_supported: %global pie_supported 1} %{!?with_boost: %global with_boost 0} -%ifarch %{ix86} x86_64 ppc ppc64 +%ifarch %{ix86} x86_64 ppc ppc64 ppc64le aarch64 %{!?with_dyninst: %global with_dyninst 0%{?fedora} >= 18 || 0%{?rhel} >= 7} %else %{!?with_dyninst: %global with_dyninst 0} @@ -38,6 +38,7 @@ %{!?with_python2_probes: %global with_python2_probes (0%{?fedora} <= 28 && 0%{?rhel} <= 7)} %{!?with_python3_probes: %global with_python3_probes (0%{?fedora} >= 23 || 0%{?rhel} > 7)} %{!?with_httpd: %global with_httpd 0} +%{!?with_specific_python: %global with_specific_python 0%{?fedora} >= 31} # Virt is supported on these arches, even on el7, but it's not in core EL7 %if 0%{?rhel} <= 7 @@ -86,7 +87,7 @@ %define __brp_mangle_shebangs_exclude_from .stp$ Name: systemtap -Version: 4.1 +Version: 4.2 Release: 6%{?release_override}%{?dist} # for version, see also configure.ac @@ -123,10 +124,9 @@ License: GPLv2+ URL: http://sourceware.org/systemtap/ Source: ftp://sourceware.org/pub/systemtap/releases/systemtap-%{version}.tar.gz -Patch10: pr23074.patch -Patch11: rhbz1732173.patch -Patch12: pr23875_bugfix.patch - +Patch10: rhbz1788648.patch +Patch11: rhbz1788662.patch +Patch12: rhbz1795196.patch # Build* BuildRequires: gcc-c++ @@ -135,7 +135,7 @@ BuildRequires: gettext-devel BuildRequires: pkgconfig(nss) BuildRequires: pkgconfig(avahi-client) %if %{with_dyninst} -BuildRequires: dyninst-devel >= 8.0 +BuildRequires: dyninst-devel >= 10.0 BuildRequires: pkgconfig(libselinux) %endif %if %{with_sqlite} @@ -208,6 +208,9 @@ BuildRequires: python-setuptools BuildRequires: python3-devel BuildRequires: python3-setuptools %endif +%if %{with_specific_python} +BuildRequires: /usr/bin/pathfix.py +%endif %if %{with_httpd} BuildRequires: libmicrohttpd-devel @@ -646,10 +649,6 @@ cd .. %configure %{?elfutils_config} %{dyninst_config} %{sqlite_config} %{crash_config} %{docs_config} %{pie_config} %{rpm_config} %{java_config} %{virt_config} %{dracut_config} %{python3_config} %{python2_probes_config} %{python3_probes_config} %{httpd_config} %{bpf_config} --disable-silent-rules --with-extra-version="rpm %{version}-%{release}" make %{?_smp_mflags} -%if %{with_emacsvim} -%{_emacs_bytecompile} emacs/systemtap-mode.el -%endif - %install make DESTDIR=$RPM_BUILD_ROOT install %find_lang %{name} @@ -776,6 +775,11 @@ done touch $RPM_BUILD_ROOT%{dracutstap}/params.conf %endif +%if %{with_specific_python} +# Some files got ambiguous python shebangs, we fix them after everything else is done +pathfix.py -pni "%{__python3} %{py3_shbang_opts}" %{buildroot}%{python3_sitearch} %{buildroot}%{_bindir}/* +%endif + %pre runtime getent group stapusr >/dev/null || groupadd -f -g 156 -r stapusr getent group stapsys >/dev/null || groupadd -f -g 157 -r stapsys @@ -1266,6 +1270,24 @@ done # PRERELEASE %changelog +* Tue Feb 11 2020 Frank Ch. Eigler - 4.2-6 +- rhbz1795196 cont'd: autoconf fix for kernel change to stack_trace_save_regs + +* Tue Jan 28 2020 Frank Ch. Eigler - 4.2-5 +- rhbz1795196: kallsyms vs. elfutils/vmlinuz + +* Thu Jan 23 2020 Frank Ch. Eigler - 4.2-4 +- rhbz1788662: check for rcu_is_watching() during prologue + +* Fri Jan 10 2020 Frank Ch. Eigler - 4.2-3 +- rhbz1788544: stop bytecompiling systemtap-mode.el + +* Fri Jan 10 2020 Frank Ch. Eigler - 4.2-2 +- rhbz1788648: aarch64 sdt.h parse [x0, x1] + +* Tue Nov 19 2019 Frank Ch. Eigler - 4.2-1 +- rhbz1744989: Upstream release. + * Tue Aug 06 2019 Frank Ch. Eigler - 4.1-6 - rhbz1732514: add java-devel prereq to systemtap-runtime-java