[Bug runtime/32695] New: The static array size of STAP_KPROBE_PROBE_STR_module cause -Werror=string-compare with GCC-15

wcohen at redhat dot com sourceware-bugzilla@sourceware.org
Fri Feb 14 16:49:44 GMT 2025


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

            Bug ID: 32695
           Summary: The static array size of STAP_KPROBE_PROBE_STR_module
                    cause -Werror=string-compare with GCC-15
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: runtime
          Assignee: systemtap at sourceware dot org
          Reporter: wcohen at redhat dot com
  Target Milestone: ---

On Fedora rawhide gcc-15 nine of the systemtap testsuite tests fail due to the
compile time determination that runtime/linux/kprobes.c strcmp is always going
to indicate that the strings are different and flagged as an error.  This can
be demonstrated with:

 sudo make installcheck RUNTESTFLAGS="systemtap.base/at_register.exp"

In the output of systemtap.log see:

Running /usr/share/systemtap/testsuite/systemtap.base/at_register.exp ...
Executing on host: gcc 
/usr/share/systemtap/testsuite/systemtap.base/at_register.c   -O2 -g  -lm  -o
at_register    (timeout = 300)
spawn -ignore SIGHUP gcc
/usr/share/systemtap/testsuite/systemtap.base/at_register.c -O2 -g -lm -o
at_register
executing: stap -v
/usr/share/systemtap/testsuite/systemtap.base/at_register.stp -g -c
./at_register -w
spawn stap -v /usr/share/systemtap/testsuite/systemtap.base/at_register.stp -g
-c ./at_register -w
Pass 1: parsed user script and 615 library scripts using
728748virt/700100res/14828shr/687076data kb, in 1430usr/180sys/1622real ms.
Pass 2: analyzed script: 6 probes, 9 functions, 1 embed, 6 globals using
1006028
virt/756792res/22408shr/736188data kb, in 280usr/190sys/477real ms.
Pass 3: translated to C into
"/tmp/stapnAC0m7/stap_7613d7535989d78c81a7f316cfa3264e_10852_src.c" using
1006048virt/757152res/22768shr/736208data kb, in 110usr/1
20sys/224real ms.
In file included from stap_7613d7535989d78c81a7f316cfa3264e_10852_src.c:2046:
In function 'stapkp_init',
    inlined from 'systemtap_module_init' at
stap_7613d7535989d78c81a7f316cfa3264e_10852_src.c:2896:8,
    inlined from '_stp_handle_start' at
/usr/share/systemtap/runtime/transport/transport.c:274:14,
    inlined from '_stp_ctl_write_cmd' at
/usr/share/systemtap/runtime/transport/control.c:83:17:
/usr/share/systemtap/runtime/linux/kprobes.c:807:18: error: 'strcmp' of a
string of length 6 and an array of size 1 evaluates to nonzero
[-Werror=string-compare]
  807 |               || strcmp(skp->module, "kernel") == 0)) {
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[4]: ***
[/usr/src/kernels/6.14.0-0.rc2.22.fc43.x86_64/scripts/Makefile.build:207:
stap_7613d7535989d78c81a7f316cfa3264e_10852_src.o] Error 1
make[3]: *** [/usr/src/kernels/6.14.0-0.rc2.22.fc43.x86_64/Makefile:2040: .]
Error 2
make[2]: *** [Makefile:263: __sub-make] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compiled C into "stap_7613d7535989d78c81a7f316cfa3264e_10852.ko" in
24840usr/3760sys/15878real ms.
Pass 4: compilation failed.  [man error::pass4]
Kernel version 6.14.0 is outside tested range 3.10 ... 6.13-rc
FAIL: at_register startup (eof)


This appears to be occurring because of the following optimization to encode
the strings in fixed sized array to reduce the number of relocations.  If the
following commit is defeated so "const char *" are used the at_register.exp
test passes:


git commit 606fd9c839a91aa0db6c925764efcea441164f6b
Author: fche <fche>  2008-01-26 15:22:09
Committer: fche <fche>  2008-01-26 15:22:09
Parent: fb10329303b55f4b7af98237e65d72c030df13b0 (* runtime/uprobes/uprobes.c:
Within a probed process, serialize)
Child:  044427bcdfa2a1d58a912bf96546892bef82b717 (Merge branch 'master' of
git://sources.redhat.com/git/systemtap)
Child:  e2de7195efa37921953248d2a4af565e99bfd249 (2008-01-27  Frank Ch. Eigler 
<fche@elastic.org>)
Branches: master, remotes/origin/master and many more (69)
Follows: release-0.6
Precedes: release-0.6.2

    PR5673: reduce total size of generated .ko's from wildly wildcarded scripts

    2008-01-26  Frank Ch. Eigler  <fche@elastic.org>

        PR 5673.
        * tapsets.cxx (dwarf_derived_probe_group): Split stap_dwarf_probes[]
        into bss-carried kprobes structs.  Tune embedded strings for
        minimizing relocation-vs-fixed-buffer wastage.
        * tapsets.cxx (dwarf_derived_probe): Impose .maxactive() limits.

    2008-01-26  Frank Ch. Eigler  <fche@elastic.org>

        PR 5673.
        * testsuite/parseko/maxactive{04,05}.stp: New tests.

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


More information about the Systemtap mailing list