[Bug runtime/30406] New: C symbol conflicts when using Fedora 36's 6.2 kernels and -DDEBUG_MEM

agentzh at gmail dot com sourceware-bugzilla@sourceware.org
Sun Apr 30 04:33:55 GMT 2023


https://sourceware.org/bugzilla/show_bug.cgi?id=30406

            Bug ID: 30406
           Summary: C symbol conflicts when using Fedora 36's 6.2 kernels
                    and -DDEBUG_MEM
           Product: systemtap
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: runtime
          Assignee: systemtap at sourceware dot org
          Reporter: agentzh at gmail dot com
  Target Milestone: ---

When using Fedora 36 x86_64's own 6.2 kernel with the latest stap and the
`-DDEBUG_MEM` option, there is symbol conflicts with the kernel headers. It can
be reproduced by the following minimal example:

```
probe tcp.receive {
    println("Hit");
    exit();
}
```

And the compilation error when building the .ko file is like this:

```
$ /opt/stap/bin/stap -DDEBUG_MEM a.stp
In file included from ./include/linux/filter.h:9,
                 from ./include/net/sock_reuseport.h:5,
                 from ./include/net/tcp.h:35,
                 from
/tmp/stapciuh4P/stap_231a49b04a681bf897ea581eaa269a03_18995_src.c:40:
./include/linux/bpf.h:524:9: error: redeclaration of enumerator ‘MEM_PERCPU’
  524 |         MEM_PERCPU              = BIT(4 + BPF_BASE_TYPE_BITS),
      |         ^~~~~~~~~~
In file included from /opt/stap/share/systemtap/runtime/linux/runtime.h:265,
                 from /opt/stap/share/systemtap/runtime/runtime.h:26,
                 from
/tmp/stapciuh4P/stap_231a49b04a681bf897ea581eaa269a03_18995_src.c:21:
/opt/stap/share/systemtap/runtime/linux/alloc.c:56:47: note: previous
definition of ‘MEM_PERCPU’ with type ‘enum _stp_memtype’
   56 | enum _stp_memtype { MEM_KMALLOC, MEM_VMALLOC, MEM_PERCPU };
      |                                               ^~~~~~~~~~
make[1]: *** [scripts/Makefile.build:252:
/tmp/stapciuh4P/stap_231a49b04a681bf897ea581eaa269a03_18995_src.o] Error 1
make: *** [Makefile:2025: /tmp/stapciuh4P] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compilation failed.  [man error::pass4]
```

It is the symbol MEM_PERCPU in conflict. I'll propose a patch to add the `STP_`
prefix to stap runtime's symbols there to avoid such issues.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Systemtap mailing list