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: <YNi1dspuN/cdNAKr@krava>
Date:   Sun, 27 Jun 2021 19:29:26 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Riccardo Mancini <rickyman7@...il.com>
Cc:     Ian Rogers <irogers@...gle.com>,
        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>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Kan Liang <kan.liang@...ux.intel.com>,
        Leo Yan <leo.yan@...aro.org>, linux-perf-users@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] perf session: add missing evlist__delete when
 deleting a session

On Fri, Jun 25, 2021 at 05:45:59PM +0200, Riccardo Mancini wrote:
> Hi,
> 
> thank you both for your comments.
> 
> On Fri, 2021-06-25 at 13:54 +0200, Jiri Olsa wrote:
> > On Thu, Jun 24, 2021 at 10:39:34PM -0700, Ian Rogers wrote:
> > > On Thu, Jun 24, 2021 at 4:20 PM Riccardo Mancini <rickyman7@...il.com>
> > > wrote:
> > > > 
> > > > ASan reports a memory leak caused by evlist not being deleted on exit in
> > > > perf-report, perf-script and perf-data.
> > > > The problem is caused by evlist->session not being deleted, which is
> > > > allocated in perf_session__read_header, called in perf_session__new if
> > > > perf_data is in read mode.
> > > > In case of write mode, the session->evlist is filled by the caller.
> > > > This patch solves the problem by calling evlist__delete in
> > > > perf_session__delete if perf_data is in read mode.
> > 
> > ugh, I'm surprised we did not free that.. and can't find
> > in git log we ever did ;-) I briefly check commands using
> > sessions and looks like it's correct
> > 
> > Acked-by: Jiri Olsa <jolsa@...hat.com>
> > 
> > > 
> > > Acked-by: Ian Rogers <irogers@...gle.com>
> > > 
> > > It is messy that in read mode the session owns the evlist, but
> > > otherwise not. Imo, it'd be nice to make the ownership unconditional.
> > 
> > yep, would be nice
> 
> I think the root problem is that perf_session__new has different behaviours
> depending on perf_data and perf_tool and that it probably does too many things
> for a __new function.
> If we split it into multiple functions and then, say, we create two helpers
> perf_session__init_read and perf_session__init_write, with the corresponding
> perf_session__fini_read and perf_session__fini_write, then the conditional
> ownership won't be a big problem due to having these two cases clearly
> separated.
> What do you think?

yes, interesting idea, let's see how the code looks like ;-)

thanks,
jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ