Tracing: Fixes for 5.12
Steven Rostedt
maintainercover Tracing: Fixes for 5.12
Two fixes:
- Fix an unsafe printf string usage in a kmem trace event
- Fix spelling in output from the latency-collector tool
Colin Ian King (1):
tracing/tools: fix a couple of spelling mistakes
Steven Rostedt (VMware) (1):
mm, tracing: Fix kmem_cache_free trace event to not print stale pointers
----
include/trace/events/kmem.h | 6 +++--- tools/tracing/latency/latency-collector.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
Steven Rostedt
maintainerPATCH 1/2 mm, tracing: Fix kmem_cache_free trace event to not print stale pointers
From: "Steven Rostedt (VMware)" <[email protected]>
The update to kmem_cache_free trace event added printing of the slab name in the trace event. But it only stores the pointer of the name which will be printed as a string when the event is read some time in the future. This is dangerous because the name could be freed in the mean time and when reading the trace event it would try to dereference the string name by the pointer to the name that has been freed.
Instead, use the trace event helper macros __string(), __assign_str(), and __get_str() that are for this very case.
--- include/trace/events/kmem.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/trace/events/kmem.h +3 -3
@@ -144,17 +144,17 @@ TRACE_EVENT(kmem_cache_free,TP_STRUCT__entry (__field (unsigned long ,call_site ) __field( const void *, ptr ) - __field( const char *, name ) +__string ( name, name ) ),TP_fast_assign ( __entry->call_site = call_site; __entry->ptr = ptr; - __entry->name = name; +__assign_str (name, name); ),TP_printk ("call_site=%pS ptr=%p name=%s" , - (void *)__entry->call_site, __entry->ptr, __entry->name) + (void *)__entry->call_site, __entry->ptr,__get_str (name)) ); TRACE_EVENT(mm_page_free,
Signature · 1 line
2.30.0
Steven Rostedt
maintainerPATCH 2/2 tracing/tools: fix a couple of spelling mistakes
In reply to Steven RostedtFrom: Colin Ian King <[email protected]>
There is a spelling mistake in the -g help option, I believe it should be "graph". There is also a spelling mistake in a warning message. Fix both mistakes.
--- tools/tracing/latency/latency-collector.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/tracing/latency/latency-collector.c +3 -3
@@ -1650,7 +1650,7 @@ static void start_printthread(void)if (ufd <0 ||read (ufd, seed,sizeof (*seed)) !=sizeof (*seed)) {printf ( -"Warning! Using trivial random nummer seed, since %s not available\n" , +"Warning! Using trivial random number seed, since %s not available\n" ,DEV_URANDOM );fflush (stdout); *seed = i;
@@ -1711,8 +1711,8 @@ static void show_usage(void)"\t\t\tbeginning, end, and backtrace.\n\n" "-g, --graph\t\tEnable the display-graph option in trace_option. This\n" -"\t\t\toption causes ftrace to show the functionph of how\n" -"\t\t\tfunctions are calling other functions.\n\n" +"\t\t\toption causes ftrace to show the graph of how functions\n" +"\t\t\tare calling other functions.\n\n" "-c, --policy POL\tRun the program with scheduling policy POL. POL can be\n" "\t\t\tother, batch, idle, rr or fifo. The default is rr. When\n"
Signature · 1 line
2.30.0