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: <YaOnDKwNuk/quLBJ@krava>
Date:   Sun, 28 Nov 2021 16:58:04 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Sohaib Mohamed <sohaib.amhmd@...il.com>
Cc:     irogers@...gle.com, Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Andi Kleen <ak@...ux.intel.com>,
        Kan Liang <kan.liang@...ux.intel.com>,
        Michael Petlan <mpetlan@...hat.com>,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf machine: Free machine__findnew_dso

On Fri, Nov 19, 2021 at 06:26:04AM +0200, Sohaib Mohamed wrote:
> ASan reports memory leaks while running:
> 
> $ rm perf.data*
> $ perf report
> 
> This patch adds the missing dso__put.
> 
> Fixes: 8c7f1bb37b29 ("perf machine: Move kernel mmap name into struct
> machine")
> 
> Signed-off-by: Sohaib Mohamed <sohaib.amhmd@...il.com>
> ---
>  tools/perf/util/machine.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index fb8496df8432..826be7a12da1 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -1742,6 +1742,8 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
>  			 */
>  			dso__load(kernel, machine__kernel_map(machine));
>  		}
> +
> +		dso__put(kernel);

nice catch, after machine__findnew_dso we need to do that

but there's also dso search before we call machine__findnew_dso,
that can find dso, so I wonder we need to add change below as well

thanks,
jirka


---
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 826be7a12da1..cd9bdf723aba 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1700,7 +1700,7 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
 				continue;
 
 
-			kernel = dso;
+			kernel = dso__get(dso);
 			break;
 		}
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ