[PATCH] Handle kernel 6.18 DECLARE_TRACE_EVENT refactor
T K Sourabh
sourabhtk37@gmail.com
Thu Feb 26 16:00:51 GMT 2026
>From afa56fd2b5c3b730a8938e95a24ebb5a175bfb80 Mon Sep 17 00:00:00 2001
From: T K Sourab <thagsour@amazon.de>
Date: Thu, 26 Feb 2026 15:54:37 +0000
Subject: [PATCH] Handle kernel 6.18 DECLARE_TRACE_EVENT refactor
Kernel 6.18 commit ac01fa73f530 ("tracepoint: Have tracepoints
created with DECLARE_TRACE() have _tp suffix") refactored
tracepoint.h so that TRACE_EVENT, TRACE_EVENT_FN, DEFINE_EVENT,
etc. now route through DECLARE_TRACE_EVENT instead of
DECLARE_TRACE. This completely bypasses systemtap's DECLARE_TRACE
override, breaking all tracepoint discovery on kernel 6.18+.
Add redirects for the new DECLARE_TRACE_EVENT,
DECLARE_TRACE_EVENT_CONDITION, and DECLARE_TRACE_EVENT_SYSCALL
macros to feed back into DECLARE_TRACE. On kernel <=6.17 where
these macros don't exist, #undef is a no-op and the #define sits
unused.
Also add TRACE_EVENT_SYSCALL override in the BPF cooked
tracepoint path, which was missing since kernel 6.13 commit
0e6caab8db8b ("tracing: Declare system call tracepoints with
TRACE_EVENT_SYSCALL") introduced that macro.
Signed-off-by: T K Sourab <thagsour@amazon.de>
---
tapsets.cxx | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tapsets.cxx b/tapsets.cxx
index 95bdc00..72891ac 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -13007,6 +13007,19 @@
tracepoint_builder::get_tracequery_modules(systemtap_session& s,
osrc << "#define DECLARE_TRACE_SYSCALL(name, proto, args) \\" << endl;
osrc << " DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))" << endl;
+ // 6.18 routes TRACE_EVENT* through DECLARE_TRACE_EVENT instead
of DECLARE_TRACE
+ osrc << "#undef DECLARE_TRACE_EVENT" << endl;
+ osrc << "#define DECLARE_TRACE_EVENT(name, proto, args) \\" << endl;
+ osrc << " DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))" << endl;
+
+ osrc << "#undef DECLARE_TRACE_EVENT_CONDITION" << endl;
+ osrc << "#define DECLARE_TRACE_EVENT_CONDITION(name, proto,
args, cond) \\" << endl;
+ osrc << " DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))" << endl;
+
+ osrc << "#undef DECLARE_TRACE_EVENT_SYSCALL" << endl;
+ osrc << "#define DECLARE_TRACE_EVENT_SYSCALL(name, proto, args)
\\" << endl;
+ osrc << " DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))" << endl;
+
// 2.6.35 added the NOARGS variant, but it's the same for us
osrc << "#undef DECLARE_TRACE_NOARGS" << endl;
osrc << "#define DECLARE_TRACE_NOARGS(name) \\" << endl;
@@ -13081,6 +13094,10 @@
tracepoint_builder::get_tracequery_modules(systemtap_session& s,
osrc << "#define TRACE_EVENT_FN(name, proto, args,
tstruct, assign, print, reg, unreg) \\" << endl;
osrc << " struct stapprobe_##name { unsigned long long
pad; struct { tstruct } data; } stapprobe_##name;" << endl;
+ osrc << "#undef TRACE_EVENT_SYSCALL" << endl;
+ osrc << "#define TRACE_EVENT_SYSCALL(name, proto, args,
tstruct, assign, print, reg, unreg) \\" << endl;
+ osrc << " struct stapprobe_##name { unsigned long long
pad; struct { tstruct } data; } stapprobe_##name;" << endl;
+
osrc << "#undef TRACE_EVENT_CONDITION" << endl;
osrc << "#define TRACE_EVENT_CONDITION(name, proto,
args, cond, tstruct, assign, print) \\" << endl;
osrc << " struct stapprobe_##name { unsigned long long
pad; struct { tstruct } data; } stapprobe_##name;" << endl;
--
2.47.3
More information about the Systemtap
mailing list