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: <YPCcIIT4CvbmPen+@kernel.org>
Date:   Thu, 15 Jul 2021 17:35:44 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Riccardo Mancini <rickyman7@...il.com>
Cc:     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 17/20] perf trace: free syscall tp fields in evsel->priv

Em Thu, Jul 15, 2021 at 06:07:22PM +0200, Riccardo Mancini escreveu:
> ASan reports several memory leaks running the perf test
> "88: Check open filename arg using perf trace + vfs_getname".
> The third of these leaks is related to evsel->priv fields of sycalls never
> being deallocated.
> 
> This patch adds the function evlist__free_syscall_tp_fields which
> iterates over all evsels in evlist, matching syscalls, and calling the
> missing frees.
> This new function is called at the end of trace__run, right before
> calling evlist__delete.

Thanks, applied.

- Arnaldo

 
> Signed-off-by: Riccardo Mancini <rickyman7@...il.com>
> ---
>  tools/perf/builtin-trace.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index d67f02d237eb0c7e..d9c65d55a9ae7526 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -3103,6 +3103,21 @@ static struct evsel *evsel__new_pgfault(u64 config)
>  	return evsel;
>  }
>  
> +static void evlist__free_syscall_tp_fields(struct evlist *evlist)
> +{
> +	struct evsel *evsel;
> +
> +	evlist__for_each_entry(evlist, evsel) {
> +		struct evsel_trace *et = evsel->priv;
> +
> +		if (!et || !evsel->tp_format || strcmp(evsel->tp_format->system, "syscalls"))
> +			continue;
> +
> +		free(et->fmt);
> +		free(et);
> +	}
> +}
> +
>  static void trace__handle_event(struct trace *trace, union perf_event *event, struct perf_sample *sample)
>  {
>  	const u32 type = event->header.type;
> @@ -4138,7 +4153,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
>  
>  out_delete_evlist:
>  	trace__symbols__exit(trace);
> -
> +	evlist__free_syscall_tp_fields(evlist);
>  	evlist__delete(evlist);
>  	cgroup__put(trace->cgroup);
>  	trace->evlist = NULL;
> -- 
> 2.31.1
> 

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ