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: <20160203141039.GB2068@danjae.kornet>
Date:	Wed, 3 Feb 2016 23:10:39 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:	Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Jiri Olsa <jolsa@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	David Ahern <dsahern@...il.com>,
	Stephane Eranian <eranian@...gle.com>,
	Andi Kleen <andi@...stfloor.org>,
	Wang Nan <wangnan0@...wei.com>
Subject: Re: [PATCH 06/21] perf hists: Return error from
 hists__collapse_resort()

Hi Arnaldo,

On Tue, Feb 02, 2016 at 01:56:34PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Feb 02, 2016 at 01:52:05PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Tue, Feb 02, 2016 at 11:39:48PM +0900, Namhyung Kim escreveu:
> > > Currently hists__collapse_resort() and hists__collapse_insert_entry()
> > > don't return error code. Now callchain_merge() can check error case,
> > > abort and pass the error to the user.  Later patch can add more work
> > > which can be failed too.
> > > 
> > > Acked-by: Jiri Olsa <jolsa@...nel.org>
> > > Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> > > ---
> > >  tools/perf/util/hist.c | 27 +++++++++++++++++----------
> > >  tools/perf/util/hist.h |  4 ++--
> > >  2 files changed, 19 insertions(+), 12 deletions(-)
> > > 
> > > diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
> > > index 098310bc4489..b476b599e415 100644
> > > --- a/tools/perf/util/hist.c
> > > +++ b/tools/perf/util/hist.c
> > > @@ -1016,8 +1016,8 @@ void hist_entry__delete(struct hist_entry *he)
> > >   * collapse the histogram
> > >   */
> > >  
> > > -bool hists__collapse_insert_entry(struct hists *hists __maybe_unused,
> > > -				  struct rb_root *root, struct hist_entry *he)
> > > +int hists__collapse_insert_entry(struct hists *hists, struct rb_root *root,
> > > +				 struct hist_entry *he)
> > >  {
> > >  	struct rb_node **p = &root->rb_node;
> > >  	struct rb_node *parent = NULL;
> > > @@ -1037,12 +1037,13 @@ bool hists__collapse_insert_entry(struct hists *hists __maybe_unused,
> > >  
> > >  			if (symbol_conf.use_callchain) {
> > >  				callchain_cursor_reset(&callchain_cursor);
> > > -				callchain_merge(&callchain_cursor,
> > > -						iter->callchain,
> > > -						he->callchain);
> > > +				if (callchain_merge(&callchain_cursor,
> > > +						    iter->callchain,
> > > +						    he->callchain) < 0)
> > > +					return -1;
> > 
> > So now we're exiting on error here, whereas before we would
> > unconditionally call hist_entry__delete() right after this branch... Is
> > that right?
> 
> > >  			}
> > >  			hist_entry__delete(he);
> > > -			return false;
> > > +			return 0;
> > >  		}
> > 
> 
> > Looking at it...
> 
> Below it does:
> 
>  		rb_erase(&n->rb_node_in, root);
> -		if (hists__collapse_insert_entry(hists, &hists->entries_collapsed, n)) {
> +		ret = hists__collapse_insert_entry(hists, &hists->entries_collapsed, n);
> +		if (ret < 0)
> +			return -1;
> 
> So, we remove it from the rb tree it is in, and previously we expected
> that hists__collapse_insert_entry would hist_entry__delete(n), while
> now, if callchain_merge() fails, we leak it, no?

You're right, will fix..

Thanks,
Namhyung

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ