On Tue, 30 Jun 2026 16:05:44 -0400
Steven Rostedt <[email protected]> wrote:
> > TP_printk("offset %08x: value %08x",
> > - (u32)(__entry->addr - __entry->edma->membase), __entry->value)
> > + (u32)(__entry->addr - __entry->membase), __entry->value)
>
> Hmm, I think I should update the TP_printk checks at boot to cover this too.
I created the following to catch this:
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index c46e623e7e0d..2da3c02bea54 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -400,10 +400,37 @@ static bool process_string(const char *fmt, int len,
struct trace_event_call *ca
return true;
}
+static void test_double_dereference(const char *str, int len,
+ struct trace_event_call *call)
+{
+ const char *ptr;
+ const char *end = str + len;
+
+ ptr = strstr(str, "REC->");
+
+ while (ptr && ptr < end) {
+
+ ptr += 5;
+ for (; ptr < end; ptr++) {
+ if (ptr[0] == '-' && ptr[1] == '>') {
+ WARN_ONCE(1, "Event %s has double dereference
in TP_printk: %*s\n",
+ trace_event_name(call), len, str);
+ return;
+ }
+ if (!isalnum(*ptr) && *ptr != '_')
+ break;
+ }
+
+ ptr = strstr(ptr, "REC->");
+ }
+}
+
static void handle_dereference_arg(const char *arg_str, u64 string_flags, int
len,
u64 *dereference_flags, int arg,
struct trace_event_call *call)
{
+ test_double_dereference(arg_str, len, call);
+
if (string_flags & (1ULL << arg)) {
if (process_string(arg_str, len, call))
*dereference_flags &= ~(1ULL << arg);
Enabled this event to see if it would trigger, but instead it found *another*
BUG!
[ 0.719012][ T0] ------------[ cut here ]------------
[ 0.720850][ T0] Event ufshcd_exception_event has double dereference in
TP_printk: dev_name(REC->hba->dev), REC->status
[ 0.724646][ T0] WARNING: kernel/trace/trace_events.c:416 at
handle_dereference_arg+0x342/0x5a0, CPU#0: swapper/0/0
I'll go make a fix for the ufshcd_exception_event event, and then I will
definitely add this patch to make sure this bug isn't in other places.
-- Steve