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: <CAH0uvohL4cFXukxhY6G4WfAWXqPOi3HbEHv=_KWixBQmgon2KQ@mail.gmail.com>
Date: Tue, 1 Apr 2025 18:07:15 -0700
From: Howard Chu <howardchu95@...il.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>, Ian Rogers <irogers@...gle.com>, 
	Kan Liang <kan.liang@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>, 
	Adrian Hunter <adrian.hunter@...el.com>, Peter Zijlstra <peterz@...radead.org>, 
	Ingo Molnar <mingo@...nel.org>, LKML <linux-kernel@...r.kernel.org>, 
	linux-perf-users@...r.kernel.org
Subject: Re: [PATCH] perf trace: Fix some leaks of struct thread

Hello Namhyung,

On Mon, Mar 31, 2025 at 11:46 AM Namhyung Kim <namhyung@...nel.org> wrote:
>
> I've found some leaks from 'perf trace -a'.  It seems there are more
> leaks but this is what I can find for now.
>
> Cc: Howard Chu <howardchu95@...il.com>
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> ---
>  tools/perf/builtin-trace.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index 3d0c0076884d34cb..10cd99888a9a11b5 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -2835,7 +2835,7 @@ static int trace__fprintf_sys_enter(struct trace *trace, struct evsel *evsel,
>         e_machine = thread__e_machine(thread, trace->host);
>         sc = trace__syscall_info(trace, evsel, e_machine, id);
>         if (sc == NULL)
> -               return -1;
> +               goto out_put;
>         ttrace = thread__trace(thread, trace);
>         /*
>          * We need to get ttrace just to make sure it is there when syscall__scnprintf_args()
> @@ -4123,8 +4123,10 @@ static int trace__set_filter_loop_pids(struct trace *trace)
>                         pids[nr++] = thread__tid(parent);

I suggest adding a:
thread_put(parent);
here, just before the break.

>                         break;
>                 }
> +               thread__put(thread);
>                 thread = parent;
>         }
> +       thread__put(thread);
>
>         err = evlist__append_tp_filter_pids(trace->evlist, nr, pids);
>         if (!err && trace->filter_pids.map)
> --
> 2.49.0.472.ge94155a9ec-goog
>

Thanks,
Howard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ