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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YPCVeuKXzI7xndPC@kernel.org>
Date:   Thu, 15 Jul 2021 17:07:22 -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 06/20] perf dso: fix memory leak in dso__new_map

Em Thu, Jul 15, 2021 at 06:07:11PM +0200, Riccardo Mancini escreveu:
> ASan reports a memory leak when running the perf test
> "65: maps__merge_in". The causes of the leaks are two, this patch
> addresses only the first one, which is related to dso__new_map.
> The bug is that dso__new_map creates a new dso but never decreases
> the refcount it gets from creating it.
> 
> This patch adds the missing dso__put.

Fixes: d3a7c489c7fd2463 ("perf tools: Reference count struct dso")

Thanks, applied.

- Arnaldo

 
> Signed-off-by: Riccardo Mancini <rickyman7@...il.com>
> ---
>  tools/perf/util/dso.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
> index d786cf6b0cfa65f2..ee15db2be2f43403 100644
> --- a/tools/perf/util/dso.c
> +++ b/tools/perf/util/dso.c
> @@ -1154,8 +1154,10 @@ struct map *dso__new_map(const char *name)
>  	struct map *map = NULL;
>  	struct dso *dso = dso__new(name);
>  
> -	if (dso)
> +	if (dso) {
>  		map = map__new2(0, dso);
> +		dso__put(dso);
> +	}
>  
>  	return map;
>  }
> -- 
> 2.31.1
> 

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ