* FAILED: patch "[PATCH] tracing/eprobes: Fix reading of string fields" failed to apply to 5.15-stable tree
@ 2022-08-22 7:37 gregkh
2022-08-22 18:06 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2022-08-22 7:37 UTC (permalink / raw)
To: rostedt, akpm, mhiramat, mingo, tz.stoyanov, zanussi; +Cc: stable
The patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From f04dec93466a0481763f3b56cdadf8076e28bfbf Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
Date: Sat, 20 Aug 2022 09:43:19 -0400
Subject: [PATCH] tracing/eprobes: Fix reading of string fields
Currently when an event probe (eprobe) hooks to a string field, it does
not display it as a string, but instead as a number. This makes the field
rather useless. Handle the different kinds of strings, dynamic, static,
relational/dynamic etc.
Now when a string field is used, the ":string" type can be used to display
it:
echo "e:sw sched/sched_switch comm=$next_comm:string" > dynamic_events
Link: https://lkml.kernel.org/r/20220820134400.959640191@goodmis.org
Cc: stable@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
Cc: Tom Zanussi <zanussi@kernel.org>
Fixes: 7491e2c44278 ("tracing: Add a probe that attaches to trace events")
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
diff --git a/kernel/trace/trace_eprobe.c b/kernel/trace/trace_eprobe.c
index 550671985fd1..a1d3423ab74f 100644
--- a/kernel/trace/trace_eprobe.c
+++ b/kernel/trace/trace_eprobe.c
@@ -311,6 +311,27 @@ static unsigned long get_event_field(struct fetch_insn *code, void *rec)
addr = rec + field->offset;
+ if (is_string_field(field)) {
+ switch (field->filter_type) {
+ case FILTER_DYN_STRING:
+ val = (unsigned long)(rec + (*(unsigned int *)addr & 0xffff));
+ break;
+ case FILTER_RDYN_STRING:
+ val = (unsigned long)(addr + (*(unsigned int *)addr & 0xffff));
+ break;
+ case FILTER_STATIC_STRING:
+ val = (unsigned long)addr;
+ break;
+ case FILTER_PTR_STRING:
+ val = (unsigned long)(*(char *)addr);
+ break;
+ default:
+ WARN_ON_ONCE(1);
+ return 0;
+ }
+ return val;
+ }
+
switch (field->size) {
case 1:
if (field->is_signed)
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: FAILED: patch "[PATCH] tracing/eprobes: Fix reading of string fields" failed to apply to 5.15-stable tree
2022-08-22 7:37 FAILED: patch "[PATCH] tracing/eprobes: Fix reading of string fields" failed to apply to 5.15-stable tree gregkh
@ 2022-08-22 18:06 ` Steven Rostedt
2022-08-23 6:58 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2022-08-22 18:06 UTC (permalink / raw)
To: gregkh; +Cc: akpm, mhiramat, mingo, tz.stoyanov, zanussi, stable
This is the backport to 5.15.
-- Steve
------------------ original commit in Linus's tree ------------------
>From f04dec93466a0481763f3b56cdadf8076e28bfbf Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
Date: Sat, 20 Aug 2022 09:43:19 -0400
Subject: [PATCH] tracing/eprobes: Fix reading of string fields
Currently when an event probe (eprobe) hooks to a string field, it does
not display it as a string, but instead as a number. This makes the field
rather useless. Handle the different kinds of strings, dynamic, static,
relational/dynamic etc.
Now when a string field is used, the ":string" type can be used to display
it:
echo "e:sw sched/sched_switch comm=$next_comm:string" > dynamic_events
Link: https://lkml.kernel.org/r/20220820134400.959640191@goodmis.org
Cc: stable@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
Cc: Tom Zanussi <zanussi@kernel.org>
Fixes: 7491e2c44278 ("tracing: Add a probe that attaches to trace events")
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace_eprobe.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
Index: linux-test.git/kernel/trace/trace_eprobe.c
===================================================================
--- linux-test.git.orig/kernel/trace/trace_eprobe.c 2022-08-22 13:36:56.320863048 -0400
+++ linux-test.git/kernel/trace/trace_eprobe.c 2022-08-22 13:36:56.316863048 -0400
@@ -320,6 +320,24 @@ static unsigned long get_event_field(str
addr = rec + field->offset;
+ if (is_string_field(field)) {
+ switch (field->filter_type) {
+ case FILTER_DYN_STRING:
+ val = (unsigned long)(rec + (*(unsigned int *)addr & 0xffff));
+ break;
+ case FILTER_STATIC_STRING:
+ val = (unsigned long)addr;
+ break;
+ case FILTER_PTR_STRING:
+ val = (unsigned long)(*(char *)addr);
+ break;
+ default:
+ WARN_ON_ONCE(1);
+ return 0;
+ }
+ return val;
+ }
+
switch (field->size) {
case 1:
if (field->is_signed)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: FAILED: patch "[PATCH] tracing/eprobes: Fix reading of string fields" failed to apply to 5.15-stable tree
2022-08-22 18:06 ` Steven Rostedt
@ 2022-08-23 6:58 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2022-08-23 6:58 UTC (permalink / raw)
To: Steven Rostedt; +Cc: akpm, mhiramat, mingo, tz.stoyanov, zanussi, stable
On Mon, Aug 22, 2022 at 02:06:50PM -0400, Steven Rostedt wrote:
>
> This is the backport to 5.15.
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-23 6:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-22 7:37 FAILED: patch "[PATCH] tracing/eprobes: Fix reading of string fields" failed to apply to 5.15-stable tree gregkh
2022-08-22 18:06 ` Steven Rostedt
2022-08-23 6:58 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox