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]
Message-ID: <YPCX1OvZomL4NMnq@kernel.org>
Date:   Thu, 15 Jul 2021 17:17:24 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Riccardo Mancini <rickyman7@...il.com>
Cc:     Mamatha Inamdar <mamatha4@...ux.vnet.ibm.com>,
        Ian Rogers <irogers@...gle.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org,
        linux-perf-users@...r.kernel.org
Subject: Re: [PATCH 10/20] perf inject: close inject.output

Em Thu, Jul 15, 2021 at 06:07:15PM +0200, Riccardo Mancini escreveu:
> ASan reports a memory leak when running the perf test
> "83: Zstd perf.data compression/decompression", which happens inside
> perf-inject.
> The bug is caused by inject.output never being closed.
> 
> This patch adds the missing perf_data__close.

Fixes: 6ef81c55a2b6584c ("perf session: Return error code for perf_session__new() function on failure")

Thanks, applied.

- Arnaldo

 
> Signed-off-by: Riccardo Mancini <rickyman7@...il.com>
> ---
>  tools/perf/builtin-inject.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
> index ffd2b25039e36e1d..c88c61e7f8ccb6a7 100644
> --- a/tools/perf/builtin-inject.c
> +++ b/tools/perf/builtin-inject.c
> @@ -993,8 +993,10 @@ int cmd_inject(int argc, const char **argv)
>  
>  	data.path = inject.input_name;
>  	inject.session = perf_session__new(&data, inject.output.is_pipe, &inject.tool);
> -	if (IS_ERR(inject.session))
> -		return PTR_ERR(inject.session);
> +	if (IS_ERR(inject.session)) {
> +		ret = PTR_ERR(inject.session);
> +		goto out_close_output;
> +	}
>  
>  	if (zstd_init(&(inject.session->zstd_data), 0) < 0)
>  		pr_warning("Decompression initialization failed.\n");
> @@ -1036,6 +1038,8 @@ int cmd_inject(int argc, const char **argv)
>  out_delete:
>  	zstd_fini(&(inject.session->zstd_data));
>  	perf_session__delete(inject.session);
> +out_close_output:
> +	perf_data__close(&inject.output);
>  	free(inject.itrace_synth_opts.vm_tm_corr_args);
>  	return ret;
>  }
> -- 
> 2.31.1
> 

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ