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: <CAM9d7cgW9YaS7+2Y0zPszbkSZpu2XgJjW3GP+yig4C-++vJ4-g@mail.gmail.com>
Date:   Tue, 12 Dec 2023 17:17:49 -0800
From:   Namhyung Kim <namhyung@...nel.org>
To:     Yicong Yang <yangyicong@...wei.com>
Cc:     peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
        mark.rutland@....com, alexander.shishkin@...ux.intel.com,
        jolsa@...nel.org, irogers@...gle.com, adrian.hunter@...el.com,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        jonathan.cameron@...wei.com, hejunhao3@...wei.com,
        yangyicong@...ilicon.com, linuxarm@...wei.com
Subject: Re: [PATCH 1/2] perf header: Fix one memory leakage in perf_event__fprintf_event_update()

Hello,

On Thu, Dec 7, 2023 at 12:20 AM Yicong Yang <yangyicong@...wei.com> wrote:
>
> From: Yicong Yang <yangyicong@...ilicon.com>
>
> When dump the raw trace by `perf report -D` ASan reports a memory
> leakage in perf_event__fprintf_event_update(). It shows that we
> allocated a temporary cpumap for dumping the CPUs but doesn't
> release it and it's not used elsewhere. Fix this by free the
> cpumap after the dumping.
>
> Fixes: c853f9394b7b ("perf tools: Add perf_event__fprintf_event_update function")
> Cc: Jiri Olsa <jolsa@...nel.org>
> Signed-off-by: Yicong Yang <yangyicong@...ilicon.com>

Acked-by: Namhyung Kim <namhyung@...nel.org>

Thanks,
Namhyung


> ---
>  tools/perf/util/header.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index e86b9439ffee..7190f39ccd13 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -4369,9 +4369,10 @@ size_t perf_event__fprintf_event_update(union perf_event *event, FILE *fp)
>                 ret += fprintf(fp, "... ");
>
>                 map = cpu_map__new_data(&ev->cpus.cpus);
> -               if (map)
> +               if (map) {
>                         ret += cpu_map__fprintf(map, fp);
> -               else
> +                       perf_cpu_map__put(map);
> +               } else
>                         ret += fprintf(fp, "failed to get cpus\n");
>                 break;
>         default:
> --
> 2.24.0
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ