All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL][PATCH] tracing/kprobes: Have uname use __get_str() in print_fmt
@ 2020-01-27 16:04 Steven Rostedt
  2020-01-29  2:45 ` pr-tracker-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2020-01-27 16:04 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: LKML, Ingo Molnar, Andrew Morton, stable, Masami Hiramatsu,
	Thomas Richter


Linus,

[ This is not a merge window pull, I was waiting on a tested-by from
  the reporter ]

Kprobe events added "ustring" to distinguish reading strings
from kernel space or user space. But the creating of the event format
file only checks for "string" to display string formats. "ustring" must
also be handled.


Please pull the latest trace-v5.5-rc7 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-v5.5-rc7

Tag SHA1: 83993af56b45a4c0b34401ee5bdd96c94180d77d
Head SHA1: 20279420ae3a8ef4c5d9fedc360a2c37a1dbdf1b


Steven Rostedt (VMware) (1):
      tracing/kprobes: Have uname use __get_str() in print_fmt

----
 kernel/trace/trace_probe.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---------------------------
commit 20279420ae3a8ef4c5d9fedc360a2c37a1dbdf1b
Author: Steven Rostedt (VMware) <rostedt@goodmis.org>
Date:   Fri Jan 24 10:07:42 2020 -0500

    tracing/kprobes: Have uname use __get_str() in print_fmt
    
    Thomas Richter reported:
    
    > Test case 66 'Use vfs_getname probe to get syscall args filenames'
    > is broken on s390, but works on x86. The test case fails with:
    >
    >  [root@m35lp76 perf]# perf test -F 66
    >  66: Use vfs_getname probe to get syscall args filenames
    >            :Recording open file:
    >  [ perf record: Woken up 1 times to write data ]
    >  [ perf record: Captured and wrote 0.004 MB /tmp/__perf_test.perf.data.TCdYj\
    >        (20 samples) ]
    >  Looking at perf.data file for vfs_getname records for the file we touched:
    >   FAILED!
    >   [root@m35lp76 perf]#
    
    The root cause was the print_fmt of the kprobe event that referenced the
    "ustring"
    
    > Setting up the kprobe event using perf command:
    >
    >  # ./perf probe "vfs_getname=getname_flags:72 pathname=filename:ustring"
    >
    > generates this format file:
    >   [root@m35lp76 perf]# cat /sys/kernel/debug/tracing/events/probe/\
    >         vfs_getname/format
    >   name: vfs_getname
    >   ID: 1172
    >   format:
    >     field:unsigned short common_type; offset:0; size:2; signed:0;
    >     field:unsigned char common_flags; offset:2; size:1; signed:0;
    >     field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
    >     field:int common_pid; offset:4; size:4; signed:1;
    >
    >     field:unsigned long __probe_ip; offset:8; size:8; signed:0;
    >     field:__data_loc char[] pathname; offset:16; size:4; signed:1;
    >
    >     print fmt: "(%lx) pathname=\"%s\"", REC->__probe_ip, REC->pathname
    
    Instead of using "__get_str(pathname)" it referenced it directly.
    
    Link: http://lkml.kernel.org/r/20200124100742.4050c15e@gandalf.local.home
    
    Cc: stable@vger.kernel.org
    Fixes: 88903c464321 ("tracing/probe: Add ustring type for user-space string")
    Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
    Reported-by: Thomas Richter <tmricht@linux.ibm.com>
    Tested-by: Thomas Richter <tmricht@linux.ibm.com>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 9ae87be422f2..ab8b6436d53f 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -876,7 +876,8 @@ static int __set_print_fmt(struct trace_probe *tp, char *buf, int len,
 	for (i = 0; i < tp->nr_args; i++) {
 		parg = tp->args + i;
 		if (parg->count) {
-			if (strcmp(parg->type->name, "string") == 0)
+			if ((strcmp(parg->type->name, "string") == 0) ||
+			    (strcmp(parg->type->name, "ustring") == 0))
 				fmt = ", __get_str(%s[%d])";
 			else
 				fmt = ", REC->%s[%d]";
@@ -884,7 +885,8 @@ static int __set_print_fmt(struct trace_probe *tp, char *buf, int len,
 				pos += snprintf(buf + pos, LEN_OR_ZERO,
 						fmt, parg->name, j);
 		} else {
-			if (strcmp(parg->type->name, "string") == 0)
+			if ((strcmp(parg->type->name, "string") == 0) ||
+			    (strcmp(parg->type->name, "ustring") == 0))
 				fmt = ", __get_str(%s)";
 			else
 				fmt = ", REC->%s";

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

* Re: [GIT PULL][PATCH] tracing/kprobes: Have uname use __get_str() in print_fmt
  2020-01-27 16:04 [GIT PULL][PATCH] tracing/kprobes: Have uname use __get_str() in print_fmt Steven Rostedt
@ 2020-01-29  2:45 ` pr-tracker-bot
  0 siblings, 0 replies; 2+ messages in thread
From: pr-tracker-bot @ 2020-01-29  2:45 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Linus Torvalds, LKML, Ingo Molnar, Andrew Morton, stable,
	Masami Hiramatsu, Thomas Richter

The pull request you sent on Mon, 27 Jan 2020 11:04:49 -0500:

> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git trace-v5.5-rc7

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/a78416d97425551b6790dc56626ac5c87415f3fc

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker

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

end of thread, other threads:[~2020-01-29  2:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-27 16:04 [GIT PULL][PATCH] tracing/kprobes: Have uname use __get_str() in print_fmt Steven Rostedt
2020-01-29  2:45 ` pr-tracker-bot

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.