0

After a kernel update from 5.2 to 5.3.5 my SystemTAP (stap) probes are failing with errors like

/usr/share/systemtap/runtime/map-gen.c: In function ‘hash_si’:
/usr/share/systemtap/runtime/map-gen.c:114:28: error: this statement may fall through [-Werror=implicit-fallthrough=]
  114 |                 case 3: k1 ^= tail[2] << 16; \
      |                         ~~~^~~~~~~~~~~~~~~~
/usr/share/systemtap/runtime/map-gen.c:131:19: note: in expansion of macro ‘MURMUR_STRING’
  131 | #define KEY1_HASH MURMUR_STRING(key1)
      |                   ^~~~~~~~~~~~~
/usr/share/systemtap/runtime/map-gen.c:664:9: note: in expansion of macro ‘KEY1_HASH’
  664 |         KEY1_HASH;
      |         ^~~~~~~~~
/usr/share/systemtap/runtime/map-gen.c:115:17: note: here
  115 |                 case 2: k1 ^= tail[1] << 8; \
      |                 ^~~~

Why?

Craig Ringer
  • 307,061
  • 76
  • 688
  • 778

2 Answers2

1

It's unclear why this happened after a kernel update as it seems more usually to be a gcc/toolchain change. It looks to be related/similar to a prior issue:

In any case, it can be locally worked around with a minor hack to the systemtap runtime code to disable the warning. In the files:

  • /usr/share/systemtap/runtime/vsprintf.c
  • /usr/share/systemtap/runtime/map-gen.c

insert the following two lines at the start of each file

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"

and this line at the end of the file:

#pragma GCC diagnostic pop

Edit: posted bug https://sourceware.org/bugzilla/show_bug.cgi?id=25267 for systemtap

Edit: A cleaner fix if you don't mind recompiling systemtap is to modify runtime.cxx like this:

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. That works around both these systemtap bugs:

Craig Ringer
  • 307,061
  • 76
  • 688
  • 778
1

Most likely this is due to -Werror=implicit-fallthru being enabled in the kernel build (which affects external modules as well) since the 5.3 kernel release: https://lwn.net/Articles/794944/ - in other words, the systemtap upstream needs to some work to properly support 5.3.

Presumably the other -Wimplicit-fallthru fixes you linked were all for the userspace parts of systemtap which are compiled with different compiler settings (old kernel versions have most likely had -Wimplicit-fallthru disabled in the build).