linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] tracing/probes: Fixes for v6.5-rc2
@ 2023-07-25  1:37 Masami Hiramatsu (Google)
  2023-07-25  1:37 ` [PATCH 1/2] tracing/probes: Fix to add NULL check for BTF APIs Masami Hiramatsu (Google)
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Masami Hiramatsu (Google) @ 2023-07-25  1:37 UTC (permalink / raw)
  To: linux-trace-kernel, Steven Rostedt; +Cc: linux-kernel, mhiramat

These two patches are probe-events fixes for v6.5-rc2.
One is to fix btf_type_by_id() return value check and the other is fixing
selftest.

Thank you,

---

Masami Hiramatsu (Google) (2):
      tracing/probes: Fix to add NULL check for BTF APIs
      selftests/ftrace: Fix to check fprobe event eneblement


 kernel/trace/trace_probe.c                         |    8 ++++----
 .../ftrace/test.d/dynevent/add_remove_btfarg.tc    |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

--
Masami Hiramatsu (Google) <mhiramat@kernel.org>

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

* [PATCH 1/2] tracing/probes: Fix to add NULL check for BTF APIs
  2023-07-25  1:37 [PATCH 0/2] tracing/probes: Fixes for v6.5-rc2 Masami Hiramatsu (Google)
@ 2023-07-25  1:37 ` Masami Hiramatsu (Google)
  2023-07-25  1:37 ` [PATCH 2/2] selftests/ftrace: Fix to check fprobe event eneblement Masami Hiramatsu (Google)
  2023-07-25  2:40 ` [PATCH 0/2] tracing/probes: Fixes for v6.5-rc2 Steven Rostedt
  2 siblings, 0 replies; 5+ messages in thread
From: Masami Hiramatsu (Google) @ 2023-07-25  1:37 UTC (permalink / raw)
  To: linux-trace-kernel, Steven Rostedt; +Cc: linux-kernel, mhiramat

From: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Since find_btf_func_param() abd btf_type_by_id() can return NULL,
the caller must check the return value correctly.

Fixes: b576e09701c7 ("tracing/probes: Support function parameters if BTF is available")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
 kernel/trace/trace_probe.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index b2b726bea1f9..c68a72707852 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -386,12 +386,12 @@ static const struct btf_type *find_btf_func_proto(const char *funcname)
 
 	/* Get BTF_KIND_FUNC type */
 	t = btf_type_by_id(btf, id);
-	if (!btf_type_is_func(t))
+	if (!t || !btf_type_is_func(t))
 		return ERR_PTR(-ENOENT);
 
 	/* The type of BTF_KIND_FUNC is BTF_KIND_FUNC_PROTO */
 	t = btf_type_by_id(btf, t->type);
-	if (!btf_type_is_func_proto(t))
+	if (!t || !btf_type_is_func_proto(t))
 		return ERR_PTR(-ENOENT);
 
 	return t;
@@ -443,7 +443,7 @@ static int parse_btf_arg(const char *varname, struct fetch_insn *code,
 	if (!ctx->params) {
 		params = find_btf_func_param(ctx->funcname, &ctx->nr_params,
 					     ctx->flags & TPARG_FL_TPOINT);
-		if (IS_ERR(params)) {
+		if (IS_ERR_OR_NULL(params)) {
 			trace_probe_log_err(ctx->offset, NO_BTF_ENTRY);
 			return PTR_ERR(params);
 		}
@@ -1273,7 +1273,7 @@ const char **traceprobe_expand_meta_args(int argc, const char *argv[],
 
 	params = find_btf_func_param(ctx->funcname, &nr_params,
 				     ctx->flags & TPARG_FL_TPOINT);
-	if (IS_ERR(params)) {
+	if (IS_ERR_OR_NULL(params)) {
 		if (args_idx != -1) {
 			/* $arg* requires BTF info */
 			trace_probe_log_err(0, NOSUP_BTFARG);


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

* [PATCH 2/2] selftests/ftrace: Fix to check fprobe event eneblement
  2023-07-25  1:37 [PATCH 0/2] tracing/probes: Fixes for v6.5-rc2 Masami Hiramatsu (Google)
  2023-07-25  1:37 ` [PATCH 1/2] tracing/probes: Fix to add NULL check for BTF APIs Masami Hiramatsu (Google)
@ 2023-07-25  1:37 ` Masami Hiramatsu (Google)
  2023-07-25  2:40 ` [PATCH 0/2] tracing/probes: Fixes for v6.5-rc2 Steven Rostedt
  2 siblings, 0 replies; 5+ messages in thread
From: Masami Hiramatsu (Google) @ 2023-07-25  1:37 UTC (permalink / raw)
  To: linux-trace-kernel, Steven Rostedt; +Cc: linux-kernel, mhiramat

From: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Fix to check the availability of fprobe and kprobes for
add_remove_btfarg.tc.
Only if both kprobe and fprobe are not supported, it should return
"unsupported".

Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
 .../ftrace/test.d/dynevent/add_remove_btfarg.tc    |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_btfarg.tc b/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_btfarg.tc
index b89de1771655..f34b14ef9781 100644
--- a/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_btfarg.tc
+++ b/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_btfarg.tc
@@ -13,7 +13,7 @@ if grep -qF "f[:[<group>/][<event>]] <func-name>[%return] [<args>]" README ; the
   FPROBES=yes
 fi
 
-if [ -z "$KPROBES" -a "$FPROBES" ] ; then
+if [ -z "$KPROBES" -a -z "$FPROBES" ] ; then
   exit_unsupported
 fi
 


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

* Re: [PATCH 0/2] tracing/probes: Fixes for v6.5-rc2
  2023-07-25  1:37 [PATCH 0/2] tracing/probes: Fixes for v6.5-rc2 Masami Hiramatsu (Google)
  2023-07-25  1:37 ` [PATCH 1/2] tracing/probes: Fix to add NULL check for BTF APIs Masami Hiramatsu (Google)
  2023-07-25  1:37 ` [PATCH 2/2] selftests/ftrace: Fix to check fprobe event eneblement Masami Hiramatsu (Google)
@ 2023-07-25  2:40 ` Steven Rostedt
  2023-07-26  1:44   ` Masami Hiramatsu
  2 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2023-07-25  2:40 UTC (permalink / raw)
  To: Masami Hiramatsu (Google); +Cc: linux-trace-kernel, linux-kernel

On Tue, 25 Jul 2023 10:37:10 +0900
"Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:

> These two patches are probe-events fixes for v6.5-rc2.
> One is to fix btf_type_by_id() return value check and the other is fixing
> selftest.
> 
> Thank you,
> 
> ---
> 
> Masami Hiramatsu (Google) (2):
>       tracing/probes: Fix to add NULL check for BTF APIs
>       selftests/ftrace: Fix to check fprobe event eneblement

For both patches:

Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

-- Steve

> 
> 
>  kernel/trace/trace_probe.c                         |    8 ++++----
>  .../ftrace/test.d/dynevent/add_remove_btfarg.tc    |    2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> --
> Masami Hiramatsu (Google) <mhiramat@kernel.org>


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

* Re: [PATCH 0/2] tracing/probes: Fixes for v6.5-rc2
  2023-07-25  2:40 ` [PATCH 0/2] tracing/probes: Fixes for v6.5-rc2 Steven Rostedt
@ 2023-07-26  1:44   ` Masami Hiramatsu
  0 siblings, 0 replies; 5+ messages in thread
From: Masami Hiramatsu @ 2023-07-26  1:44 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-trace-kernel, linux-kernel

On Mon, 24 Jul 2023 22:40:17 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Tue, 25 Jul 2023 10:37:10 +0900
> "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:
> 
> > These two patches are probe-events fixes for v6.5-rc2.
> > One is to fix btf_type_by_id() return value check and the other is fixing
> > selftest.
> > 
> > Thank you,
> > 
> > ---
> > 
> > Masami Hiramatsu (Google) (2):
> >       tracing/probes: Fix to add NULL check for BTF APIs
> >       selftests/ftrace: Fix to check fprobe event eneblement
> 
> For both patches:
> 
> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Thanks!

> 
> -- Steve
> 
> > 
> > 
> >  kernel/trace/trace_probe.c                         |    8 ++++----
> >  .../ftrace/test.d/dynevent/add_remove_btfarg.tc    |    2 +-
> >  2 files changed, 5 insertions(+), 5 deletions(-)
> > 
> > --
> > Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

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

end of thread, other threads:[~2023-07-26  1:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-25  1:37 [PATCH 0/2] tracing/probes: Fixes for v6.5-rc2 Masami Hiramatsu (Google)
2023-07-25  1:37 ` [PATCH 1/2] tracing/probes: Fix to add NULL check for BTF APIs Masami Hiramatsu (Google)
2023-07-25  1:37 ` [PATCH 2/2] selftests/ftrace: Fix to check fprobe event eneblement Masami Hiramatsu (Google)
2023-07-25  2:40 ` [PATCH 0/2] tracing/probes: Fixes for v6.5-rc2 Steven Rostedt
2023-07-26  1:44   ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).