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] [day] [month] [year] [list]
Message-Id: <20230811111548.227d9fb19f2540a3c6bb5273@kernel.org>
Date:   Fri, 11 Aug 2023 11:15:48 +0900
From:   Masami Hiramatsu (Google) <mhiramat@...nel.org>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Adrian Hunter <adrian.hunter@...el.com>,
        Ian Rogers <irogers@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] perf probe: Free string returned by
 synthesize_perf_probe_point() on failure in synthesize_perf_probe_command()

On Fri, 4 Aug 2023 13:26:54 -0300
Arnaldo Carvalho de Melo <acme@...nel.org> wrote:

> Building perf with EXTRA_CFLAGS="-fsanitize=address" a leak was detected
> elsewhere and lead to an audit, where we found that
> synthesize_perf_probe_command() may leak synthesize_perf_probe_point()
> return on failure, fix it.

This looks good to me.

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

Thanks,

> 
> Cc: Adrian Hunter <adrian.hunter@...el.com>
> Cc: Ian Rogers <irogers@...gle.com>
> Cc: Jiri Olsa <jolsa@...nel.org>
> Cc: Masami Hiramatsu <mhiramat@...nel.org>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Link: https://lore.kernel.org/lkml/
> Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
> ---
>  tools/perf/util/probe-event.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> index c7bfeab610a3679a..2835d87cb97771f9 100644
> --- a/tools/perf/util/probe-event.c
> +++ b/tools/perf/util/probe-event.c
> @@ -2063,14 +2063,18 @@ char *synthesize_perf_probe_command(struct perf_probe_event *pev)
>  			goto out;
>  
>  	tmp = synthesize_perf_probe_point(&pev->point);
> -	if (!tmp || strbuf_addstr(&buf, tmp) < 0)
> +	if (!tmp || strbuf_addstr(&buf, tmp) < 0) {
> +		free(tmp);
>  		goto out;
> +	}
>  	free(tmp);
>  
>  	for (i = 0; i < pev->nargs; i++) {
>  		tmp = synthesize_perf_probe_arg(pev->args + i);
> -		if (!tmp || strbuf_addf(&buf, " %s", tmp) < 0)
> +		if (!tmp || strbuf_addf(&buf, " %s", tmp) < 0) {
> +			free(tmp);
>  			goto out;
> +		}
>  		free(tmp);
>  	}
>  
> -- 
> 2.37.1
> 


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ