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: <d4921abf8dcff02245ccf7ad8edfd8048e926936.camel@gmail.com>
Date:   Tue, 22 Jun 2021 09:44:39 +0200
From:   Riccardo Mancini <rickyman7@...il.com>
To:     Ian Rogers <irogers@...gle.com>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>, linux-perf-users@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] perf script: delete evlist when deleting session

Hi,

thanks for your comments.

On Mon, 2021-06-21 at 22:14 -0700, Ian Rogers wrote:
> On Mon, Jun 21, 2021 at 4:44 PM Riccardo Mancini <rickyman7@...il.com> wrote:
> > 
> > ASan reports a memory leak related to session->evlist never being deleted.
> > The evlist member is not deleted in perf_session__delete, so it should be
> > deleted separately.
> > This patch adds the missing deletion in perf-script.
> > 
> > Signed-off-by: Riccardo Mancini <rickyman7@...il.com>
> > ---
> >  tools/perf/builtin-script.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> > index 1280cbfad4db..635a1d9cfc88 100644
> > --- a/tools/perf/builtin-script.c
> > +++ b/tools/perf/builtin-script.c
> > @@ -3991,7 +3991,7 @@ int cmd_script(int argc, const char **argv)
> >                 zfree(&script.ptime_range);
> >         }
> > 
> > -       evlist__free_stats(session->evlist);
> 
> Should this be removed?

Probably not. I originally thought this was already taken care of by
evlist__delete, but it's not. 
Oddly, this issue is not causing a memory leak in my simple test.

> 
> > +       evlist__delete(session->evlist);
> 
> If the perf session "owns" the evlist, would it be cleaner to add this
> to perf_session__delete?

I thought about that too, but that's not always true.
E.g., in perf-record, __cmd_record calls perf_session__delete,then cmd_record
calls evlist__delete on rec->evlist, which points to the same location to which
session->evlist pointed. 

Thanks,
Riccardo

> 
> Thanks,
> Ian
> 
> >         perf_session__delete(session);
> > 
> >         if (script_started)
> > --
> > 2.31.1
> > 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ