aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>2023-06-12 20:58:57 +0900
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>2023-06-23 17:35:49 +0900
commit53431798f4bb60d214ae1ec4a79eefdd414f577b (patch)
treedd00af259a7a2817255ddf343c544cde2a08f9f4 /kernel
parenta2bd0c08a459b4cb8da57cc9c754de5e45d7a61e (diff)
downloadlinux-53431798f4bb60d214ae1ec4a79eefdd414f577b.tar.gz
tracing/probes: Fix tracepoint event with $arg* to fetch correct argument
To hide the first dummy 'data' argument on the tracepoint probe events, the BTF argument array was modified (skip the first argument for tracepoint), but the '$arg*' meta argument parser missed that. Fix to increment the argument index if it is tracepoint probe. And decrement the index when searching the type of the argument. Link: https://lore.kernel.org/all/168657113778.3038017.12245893750241701312.stgit@mhiramat.roam.corp.google.com/ Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_probe.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 473e1c43bc57a3..643aa3a51d5a73 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -456,7 +456,10 @@ static int parse_btf_arg(const char *varname, struct fetch_insn *code,
if (name && !strcmp(name, varname)) {
code->op = FETCH_OP_ARG;
- code->param = i;
+ if (ctx->flags & TPARG_FL_TPOINT)
+ code->param = i + 1;
+ else
+ code->param = i;
return 0;
}
}
@@ -470,8 +473,11 @@ static const struct fetch_type *parse_btf_arg_type(int arg_idx,
struct btf *btf = traceprobe_get_btf();
const char *typestr = NULL;
- if (btf && ctx->params)
+ if (btf && ctx->params) {
+ if (ctx->flags & TPARG_FL_TPOINT)
+ arg_idx--;
typestr = type_from_btf_id(btf, ctx->params[arg_idx].type);
+ }
return find_fetch_type(typestr, ctx->flags);
}