All of lore.kernel.org
 help / color / mirror / Atom feed
* [for-linus][PATCH 0/2] Tracing: Fixes for 5.12
@ 2021-02-26  2:47 Steven Rostedt
  2021-02-26  2:47 ` [for-linus][PATCH 1/2] mm, tracing: Fix kmem_cache_free trace event to not print stale pointers Steven Rostedt
  2021-02-26  2:47 ` [for-linus][PATCH 2/2] tracing/tools: fix a couple of spelling mistakes Steven Rostedt
  0 siblings, 2 replies; 3+ messages in thread
From: Steven Rostedt @ 2021-02-26  2:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton


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(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [for-linus][PATCH 1/2] mm, tracing: Fix kmem_cache_free trace event to not print stale pointers
  2021-02-26  2:47 [for-linus][PATCH 0/2] Tracing: Fixes for 5.12 Steven Rostedt
@ 2021-02-26  2:47 ` Steven Rostedt
  2021-02-26  2:47 ` [for-linus][PATCH 2/2] tracing/tools: fix a couple of spelling mistakes Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2021-02-26  2:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Jacob Wen

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

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.

Cc: Jacob Wen <jian.w.wen@oracle.com>
Fixes: 3544de8ee6e4 ("mm, tracing: record slab name for kmem_cache_free()")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 include/trace/events/kmem.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index 40845b0d5dad..3a60b6b6db32 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -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,
-- 
2.30.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [for-linus][PATCH 2/2] tracing/tools: fix a couple of spelling mistakes
  2021-02-26  2:47 [for-linus][PATCH 0/2] Tracing: Fixes for 5.12 Steven Rostedt
  2021-02-26  2:47 ` [for-linus][PATCH 1/2] mm, tracing: Fix kmem_cache_free trace event to not print stale pointers Steven Rostedt
@ 2021-02-26  2:47 ` Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2021-02-26  2:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Colin Ian King, Viktor Rosendahl

From: Colin Ian King <colin.king@canonical.com>

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.

Link: https://lkml.kernel.org/r/20210225165248.22050-2-Viktor.Rosendahl@bmw.de

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Viktor Rosendahl <Viktor.Rosendahl@bmw.de>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tools/tracing/latency/latency-collector.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/tracing/latency/latency-collector.c b/tools/tracing/latency/latency-collector.c
index 57b20802e71b..b69de9263ee6 100644
--- a/tools/tracing/latency/latency-collector.c
+++ b/tools/tracing/latency/latency-collector.c
@@ -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"
-- 
2.30.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-26  2:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-26  2:47 [for-linus][PATCH 0/2] Tracing: Fixes for 5.12 Steven Rostedt
2021-02-26  2:47 ` [for-linus][PATCH 1/2] mm, tracing: Fix kmem_cache_free trace event to not print stale pointers Steven Rostedt
2021-02-26  2:47 ` [for-linus][PATCH 2/2] tracing/tools: fix a couple of spelling mistakes Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.