lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 26 May 2024 19:17:08 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Carlos López <clopez@...e.de>
Cc: linux-trace-kernel@...r.kernel.org, Steven Rostedt
 <rostedt@...dmis.org>, Masami Hiramatsu <mhiramat@...nel.org>, Mathieu
 Desnoyers <mathieu.desnoyers@...icios.com>, Alan Maguire
 <alan.maguire@...cle.com>, linux-kernel@...r.kernel.org (open list:TRACING)
Subject: Re: [PATCH] tracing/probes: fix error check in parse_btf_field()

On Sat, 25 May 2024 20:21:32 +0200
Carlos López <clopez@...e.de> wrote:

> btf_find_struct_member() might return NULL or an error via the
> ERR_PTR() macro. However, its caller in parse_btf_field() only checks
> for the NULL condition. Fix this by using IS_ERR() and returning the
> error up the stack.
> 

Thanks for finding it!
I think this requires new error message for error_log file.
Can you add the log as

trace_probe_log_err(ctx->offset, BTF_ERROR);

And define BTF_ERROR in ERRORS@...nel/trace/trace_probe.h ?

Thank you,

> Fixes: c440adfbe3025 ("tracing/probes: Support BTF based data structure field access")
> Signed-off-by: Carlos López <clopez@...e.de>
> ---
>  kernel/trace/trace_probe.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
> index 5e263c141574..5417e9712157 100644
> --- a/kernel/trace/trace_probe.c
> +++ b/kernel/trace/trace_probe.c
> @@ -554,6 +554,8 @@ static int parse_btf_field(char *fieldname, const struct btf_type *type,
>  			anon_offs = 0;
>  			field = btf_find_struct_member(ctx->btf, type, fieldname,
>  						       &anon_offs);
> +			if (IS_ERR(field))
> +				return PTR_ERR(field);
>  			if (!field) {
>  				trace_probe_log_err(ctx->offset, NO_BTF_FIELD);
>  				return -ENOENT;
> -- 
> 2.35.3
> 


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ