Skip to contentSkip to conversation

tracing: Last minute fixes for 6.14

PATCH New Steven Rostedt 1 participant 3 messages Jan 22, 2025 Tracing

lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

cover tracing: Last minute fixes for 6.14

git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/for-next

Head SHA1: 8f21943e101a15f56a8f02970a80edc936de8ec8

Steven Rostedt (2):
tracing: Fix allocation of printing set_event file content
tracing: Fix output of set_event for some cached module events

----

 kernel/trace/trace_events.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
author maintainer
#1 lore raw

PATCH 1/2 tracing: Fix allocation of printing set_event file content

From: Steven Rostedt <[email protected]>

The adding of cached events for modules not loaded yet required a descriptor to separate the iteration of events with the iteration of cached events for a module. But the allocation used the size of the pointer and not the size of the contents to allocate its data and caused a slab-out-of-bounds.

Cc Masami Hiramatsu <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Cc Linus Torvalds <[email protected]>
Fixes b355247df104e ("tracing: Cache ":mod:" events for modules not loaded yet")
---
 kernel/trace/trace_events.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_events.c +1 -1
index 51c5014877e8..5217dcddcb4c 100644
@@ -1588,7 +1588,7 @@ static void *s_start(struct seq_file *m, loff_t *pos)
 	struct set_event_iter *iter;
 	loff_t l;
 
-	iter = kzalloc(sizeof(iter), GFP_KERNEL);
+	iter = kzalloc(sizeof(*iter), GFP_KERNEL);
 	if (!iter)
 		return NULL;
 
Signature · 1 line
2.45.2
author maintainer
#2 lore raw

PATCH 2/2 tracing: Fix output of set_event for some cached module events

In reply to Steven Rostedt

From: Steven Rostedt <[email protected]>

The following works fine:

~# echo ':mod:trace_events_sample' > /sys/kernel/tracing/set_event ~# cat /sys/kernel/tracing/set_event *:*:mod:trace_events_sample
~#

But if a name is given without a ':' where it can match an event name or system name, the output of the cached events does not include a new line:

~# echo 'foo_bar:mod:trace_events_sample' > /sys/kernel/tracing/set_event ~# cat /sys/kernel/tracing/set_event foo_bar:mod:trace_events_sample~#

Add the '\n' to that as well.

Cc Masami Hiramatsu <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Fixes b355247df104e ("tracing: Cache ":mod:" events for modules not loaded yet")
---
 kernel/trace/trace_events.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_events.c +1 -1
index 5217dcddcb4c..a9d7d02bbb20 100644
@@ -1634,7 +1634,7 @@ static int s_show(struct seq_file *m, void *v)
 
 	/* When match is set, system and event are not */
 	if (iter->event_mod->match) {
-		seq_printf(m, "%s:mod:%s", iter->event_mod->match,
+		seq_printf(m, "%s:mod:%s\n", iter->event_mod->match,
 			   iter->event_mod->module);
 		return 0;
 	}
Signature · 1 line
2.45.2