Summary: | tapscripts using ustack, ubacktrace etc fail to compile on kernel 5.3 | ||
---|---|---|---|
Product: | systemtap | Reporter: | Craig Ringer <craig.ringer> |
Component: | runtime | Assignee: | Unassigned <systemtap> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | fche |
Priority: | P2 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
See Also: |
https://sourceware.org/bugzilla/show_bug.cgi?id=25266 https://sourceware.org/bugzilla/show_bug.cgi?id=25267 |
||
Host: | Target: | ||
Build: | Last reconfirmed: | ||
Attachments: | Fix invalid prototype in autoconf-stack-trace-save-regs.c test |
Description
Craig Ringer
2019-12-10 05:42:23 UTC
This probably relates to this kernel patch: https://patchwork.kernel.org/patch/10916651/ or the series it's part of like https://patchwork.kernel.org/patch/10916613/ I wonder if this is a redhat-ism (some local patch). The runtime looks like it already understands that "struct stack_trace" went away in Linux 5.2, given runtime/linux/autoconf-stack-trace-save-regs.c and the ifdef for STAPCONF_STACK_TRACE_SAVE_REGS in runtime/stack.c . I checked the generated module with stap -k. The generated header stapconf_458f21c1e2c146ca5cc99e95113a4f8b_799.h does not contain STAPCONF_STACK_TRACE_SAVE_REGS . Tweaking the Makefile so it doesn't swallow output of the configure tests (surely those should go to a log?) shows the following error: ``` make -f ./scripts/Makefile.build obj=/tmp/stapsiNon3 /tmp/stapsiNon3/stap_767845_src.i /usr/local/share/systemtap/runtime/linux/autoconf-stack-trace-save-regs.c:3:14: error: function declaration isn’t a prototype [-Werror=strict-prototypes] 3 | unsigned int foo () | ^~~ cc1: all warnings being treated as errors ``` When I fix that by adding a prototype to /usr/local/share/systemtap/runtime/linux/autoconf-stack-trace-save-regs.c ``` unsigned int foo(void); ``` and remove the generated header then re-make, the generated header now includes STAPCONF_STACK_TRACE_SAVE_REGS: ``` /tmp/stapsiNon3# grep -r STAPCONF_STACK_TRACE_SAVE_REGS stapconf_458f21c1e2c146ca5cc99e95113a4f8b_799.h:#define STAPCONF_STACK_TRACE_SAVE_REGS 1 ``` ... and the build fails at a later step due to `-Werror`. So in short, the configure test fails due to `-Werror` and a missing prototype, causing the runtime to fail to detect the new stack API in the kernel. A workaround if you just want to use stap is to patch `runtime.cxx` as follows ``` diff --git a/buildrun.cxx b/buildrun.cxx index 505902bc5..b29eeb797 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -235,6 +235,7 @@ compile_dyninst (systemtap_session& s) "gcc", "--std=gnu99", s.translated_source, "-o", module, "-fvisibility=hidden", "-O2", "-I" + s.runtime_path, "-D__DYNINST__", "-Wall", WERROR, "-Wno-unused", "-Wno-strict-aliasing", + "-Wno-error=implicit-fallthrough", "-Wno-error=strict-prototypes", "-pthread", "-lrt", "-fPIC", "-shared", }; ``` then recompile and reinstall. Created attachment 12116 [details]
Fix invalid prototype in autoconf-stack-trace-save-regs.c test
Fix title. I have no idea why I wrote 3.4 instead of 5.3. Any thoughts on applying this bugfix patch? thanks, merged! |