Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCH] tracing: probes: error if BTF is required but unavailable
@ 2026-10-14  8:37 Martin Kaiser
  2026-10-14 13:14 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Kaiser @ 2026-10-14  8:37 UTC (permalink / raw)
  To: Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers
  Cc: Martin Kaiser, linux-kernel, linux-trace-kernel

traceprobe_expand_meta_args expands probe arguments based on BTF info.

Return an error if we have arguments that need expanding but BTF is not
supported.

The params variable is now unused, it can be removed.

Fixes: d157d7694460 ("tracing/probes: Support BTF field access from $retval")
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 kernel/trace/trace_probe.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index cfb710095f65..516c439932a0 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -2287,7 +2287,6 @@ const char **traceprobe_expand_meta_args(int argc, const char *argv[],
 					 int *new_argc, char *buf, int bufsize,
 					 struct traceprobe_parse_context *ctx)
 {
-	const struct btf_param *params = NULL;
 	int i, j, n, used, ret, args_idx = -1;
 	const char **new_argv __free(kfree) = NULL;
 
@@ -2305,7 +2304,7 @@ const char **traceprobe_expand_meta_args(int argc, const char *argv[],
 		if (args_idx != -1) {
 			/* $arg* requires BTF info */
 			trace_probe_log_err(0, NOSUP_BTFARG);
-			return (const char **)params;
+			return ERR_PTR(-EOPNOTSUPP);
 		}
 		*new_argc = argc;
 		return NULL;
-- 
2.43.7


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

* Re: [PATCH] tracing: probes: error if BTF is required but unavailable
  2026-10-14  8:37 [PATCH] tracing: probes: error if BTF is required but unavailable Martin Kaiser
@ 2026-10-14 13:14 ` Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2026-10-14 13:14 UTC (permalink / raw)
  To: Martin Kaiser
  Cc: Masami Hiramatsu, Mathieu Desnoyers, linux-kernel,
	linux-trace-kernel

On Wed, 14 Oct 2026 10:37:40 +0200
Martin Kaiser <martin@kaiser.cx> wrote:

> traceprobe_expand_meta_args expands probe arguments based on BTF info.
> 
> Return an error if we have arguments that need expanding but BTF is not
> supported.
> 
> The params variable is now unused, it can be removed.
> 
> Fixes: d157d7694460 ("tracing/probes: Support BTF field access from $retval")

I agree with the change but I don't think it needs a fixes tag. It
currently errors out with -EINVAL if BTF is not supported. Your change
updates it to -ENOTSUPP. But this is a cleanup and not a fix.

~# cat error_log
trace_fprobe: error: BTF is not available or not supported
  Command: f vfs_read $arg*
                      ^
But other than that.

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

-- Steve


> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
>  kernel/trace/trace_probe.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
> index cfb710095f65..516c439932a0 100644
> --- a/kernel/trace/trace_probe.c
> +++ b/kernel/trace/trace_probe.c
> @@ -2287,7 +2287,6 @@ const char **traceprobe_expand_meta_args(int argc, const char *argv[],
>  					 int *new_argc, char *buf, int bufsize,
>  					 struct traceprobe_parse_context *ctx)
>  {
> -	const struct btf_param *params = NULL;
>  	int i, j, n, used, ret, args_idx = -1;
>  	const char **new_argv __free(kfree) = NULL;
>  
> @@ -2305,7 +2304,7 @@ const char **traceprobe_expand_meta_args(int argc, const char *argv[],
>  		if (args_idx != -1) {
>  			/* $arg* requires BTF info */
>  			trace_probe_log_err(0, NOSUP_BTFARG);
> -			return (const char **)params;
> +			return ERR_PTR(-EOPNOTSUPP);
>  		}
>  		*new_argc = argc;
>  		return NULL;


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

end of thread, other threads:[~2026-10-14 13:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-14  8:37 [PATCH] tracing: probes: error if BTF is required but unavailable Martin Kaiser
2026-10-14 13:14 ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox