[Bug runtime/24904] New: stack_trace struct undefined on kernel 5.2

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug runtime/24904] New: stack_trace struct undefined on kernel 5.2

glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=24904

            Bug ID: 24904
           Summary: stack_trace struct undefined on kernel 5.2
           Product: systemtap
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: runtime
          Assignee: systemtap at sourceware dot org
          Reporter: info at kleisauke dot nl
  Target Milestone: ---

print_ubacktrace() is broken on Fedora 30, with kernel 5.2.7-200 and systemtap
4.1-1.

$ stap -v -e 'probe process.function("*") { print_ubacktrace(); exit() }' -x
1087
Pass 1: parsed user script and 488 library scripts using
355536virt/129556res/9300shr/119992data kb, in 190usr/40sys/223real ms.
Pass 2: analyzed script: 5181 probes, 2 functions, 0 embeds, 0 globals using
379508virt/154036res/10196shr/143964data kb, in 110usr/0sys/133real ms.
Pass 3: translated to C into
"/tmp/stapxd395N/stap_750ab0efc72dfcc1dbb01db1071e2bf9_1742296_src.c" using
381044virt/155896res/10452shr/145500data kb, in 120usr/40sys/165real ms.
In file included from
/tmp/stapxd395N/stap_750ab0efc72dfcc1dbb01db1071e2bf9_1742296_src.c:90:
/usr/share/systemtap/runtime/stack.c:51:14: error: ‘struct stack_trace’
declared inside parameter list will not be visible outside of this definition
or declaration [-Werror]
   51 |       struct stack_trace *trace);
      |              ^~~~~~~~~~~
/usr/share/systemtap/runtime/stack.c: In function ‘_stp_stack_print_fallback’:
/usr/share/systemtap/runtime/stack.c:171:21: error: storage size of ‘trace’
isn’t known
  171 |  struct stack_trace trace;
      |                     ^~~~~
cc1: all warnings being treated as errors
make[1]: *** [scripts/Makefile.build:278:
/tmp/stapxd395N/stap_750ab0efc72dfcc1dbb01db1071e2bf9_1742296_src.o] Error 1
make: *** [Makefile:1601: _module_/tmp/stapxd395N] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compiled C into "stap_750ab0efc72dfcc1dbb01db1071e2bf9_1742296.ko" in
6970usr/1440sys/8406real ms.
Pass 4: compilation failed.  [man error::pass4]

It seems that the root cause of this is due to this commit:
https://github.com/torvalds/linux/commit/214d8ca6ee854f696f75e75511fe66b409e656db#diff-ba4af21f3a043f2139272bcc0bced588R64

(if ARCH_STACKWALK is set, the stack_trace struct is undefined)

--
You are receiving this mail because:
You are the assignee for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug runtime/24904] stack_trace struct undefined on kernel 5.2

glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=24904

--- Comment #1 from Kleis Auke Wolthuizen <info at kleisauke dot nl> ---
It seems that there is also a problem with regard to
perf_event_create_kernel_counter:

$ stap -v -e 'global s; probe timer.profile { s[backtrace()] <<< 1; } probe end
{ foreach (i in s+) { print_stack(i); printf("\t%d\n", @count(s[i])); } } probe
timer.s(60) { exit(); }' > out.stap-stacks
Pass 1: parsed user script and 488 library scripts using
355536virt/129684res/9428shr/119992data kb, in 190usr/30sys/223real ms.
Pass 2: analyzed script: 3 probes, 7 functions, 1 embed, 1 global using
360024virt/134296res/9564shr/124480data kb, in 20usr/0sys/17real ms.
Pass 3: translated to C into
"/tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c" using
360024virt/134296res/9564shr/124480data kb, in 0usr/0sys/0real ms.
In file included from
/tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:260:
/usr/share/systemtap/runtime/stack.c:51:14: error: ‘struct stack_trace’
declared inside parameter list will not be visible outside of this definition
or declaration [-Werror]
   51 |       struct stack_trace *trace);
      |              ^~~~~~~~~~~
/usr/share/systemtap/runtime/stack.c: In function ‘_stp_stack_print_fallback’:
/usr/share/systemtap/runtime/stack.c:171:21: error: storage size of ‘trace’
isn’t known
  171 |  struct stack_trace trace;
      |                     ^~~~~
In file included from
/tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:1159:
/usr/share/systemtap/runtime/linux/perf.c: In function ‘_stp_perf_init’:
/usr/share/systemtap/runtime/linux/perf.c:49:18: error: passing argument 3 of
‘perf_event_create_kernel_counter’ makes pointer from integer without a cast
[-Werror=int-conversion]
   49 |              task->pid,
      |              ~~~~^~~~~
      |                  |
      |                  pid_t {aka int}
In file included from /usr/share/systemtap/runtime/linux/runtime.h:236,
                 from /usr/share/systemtap/runtime/runtime.h:26,
                 from
/tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:28:
./include/linux/perf_event.h:899:1: note: expected ‘struct task_struct *’ but
argument is of type ‘pid_t’ {aka ‘int’}
  899 | perf_event_create_kernel_counter(struct perf_event_attr *attr,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from
/tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:1159:
/usr/share/systemtap/runtime/linux/perf.c:44:34: error: too few arguments to
function ‘perf_event_create_kernel_counter’
   44 |      stp->e.t.per_thread_event =
perf_event_create_kernel_counter(&stp->attr,
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/share/systemtap/runtime/linux/runtime.h:236,
                 from /usr/share/systemtap/runtime/runtime.h:26,
                 from
/tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:28:
./include/linux/perf_event.h:899:1: note: declared here
  899 | perf_event_create_kernel_counter(struct perf_event_attr *attr,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from
/tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:1159:
/usr/share/systemtap/runtime/linux/perf.c:100:13: error: passing argument 3 of
‘perf_event_create_kernel_counter’ makes pointer from integer without a cast
[-Werror=int-conversion]
  100 |             -1,
      |             ^~
      |             |
      |             int
In file included from /usr/share/systemtap/runtime/linux/runtime.h:236,
                 from /usr/share/systemtap/runtime/runtime.h:26,
                 from
/tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:28:
./include/linux/perf_event.h:899:1: note: expected ‘struct task_struct *’ but
argument is of type ‘int’
  899 | perf_event_create_kernel_counter(struct perf_event_attr *attr,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from
/tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:1159:
/usr/share/systemtap/runtime/linux/perf.c:95:15: error: too few arguments to
function ‘perf_event_create_kernel_counter’
   95 |      *event = perf_event_create_kernel_counter(&stp->attr,
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/share/systemtap/runtime/linux/runtime.h:236,
                 from /usr/share/systemtap/runtime/runtime.h:26,
                 from
/tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:28:
./include/linux/perf_event.h:899:1: note: declared here
  899 | perf_event_create_kernel_counter(struct perf_event_attr *attr,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [scripts/Makefile.build:278:
/tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.o] Error 1
make: *** [Makefile:1601: _module_/tmp/stapS4JOAT] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compiled C into "stap_7a9f78085e38311a1bb8015256b67067_2952.ko" in
6780usr/1500sys/8282real ms.
Pass 4: compilation failed.  [man error::pass4]

--
You are receiving this mail because:
You are the assignee for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug runtime/24904] stack_trace struct undefined on kernel 5.2

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=24904

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |fche at redhat dot com
         Resolution|---                         |FIXED

--- Comment #2 from Frank Ch. Eigler <fche at redhat dot com> ---
Let's keep this PR set aside for the stack trace changes,
which are now fixed with commit 49fa913a61e7f2.  Cloning for the perf parts.

--
You are receiving this mail because:
You are the assignee for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug runtime/24904] stack_trace struct undefined on kernel 5.2

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=24904

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |24923


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=24923
[Bug 24923] perf_event_create_kernel_counter changed on kernel 5.2
--
You are receiving this mail because:
You are the assignee for the bug.