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]
Date:	Fri, 15 May 2015 17:07:03 -0300
From:	Arnaldo Carvalho de Melo <acme@...nel.org>
To:	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Cc:	Wang Nan <wangnan0@...wei.com>, a.p.zijlstra@...llo.nl,
	paulus@...ba.org, mingo@...hat.com, namhyung@...nel.org,
	lizefan@...wei.com, pi3orama@....com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH tip/perf/core] perf probe: Load map before glob matching

Em Sat, May 16, 2015 at 12:15:45AM +0900, Masami Hiramatsu escreveu:
> On 2015/05/15 21:14, Wang Nan wrote:
> > Commit 4c859351226c920b227fec040a3b447f0d482af3 ("perf probe: Support
> > glob wildcards for function name") introduces a problem:
> > 
> >   # /root/perf probe kmem_cache_free
> >  Failed to find symbol kmem_cache_free in kernel
> >    Error: Failed to add events.
> > 
> > The reason is the replacement of map__for_each_symbol_by_name() (by
> > map__for_each_symbol()). Although their names are similay,
> > map__for_each_symbol doesn't call map__load() and dso__sort_by_name()
> > before searching. The missing of map__load() causes this problem
> > because it search symbol before load dso map.
> 
> Oops, yes. But I think we'd better fix map__for_each_symbol() to call
> map__load() if the map is not loaded, doesn't it?

Well, that is something for a follow up patch, I'm applying his patch as
it fixes a problem and is trivially correct.

- Arnaldo
 
> Thank you,
> 
> > 
> > This patch ensures map__load() is called before using
> > map__for_each_symbol().
> > 
> > After this patch:
> > 
> >  # /root/perf probe kmem_cache_free
> >   Added new event:
> >     probe:kmem_cache_free (on kmem_cache_free%return)
> > 
> > You can now use it in all perf tools, such as:
> > 
> >         perf record -e probe:kmem_cache_free -aR sleep 1
> > 
> > Signed-off-by: Wang Nan <wangnan0@...wei.com>
> > ---
> >  tools/perf/util/probe-event.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> > index 2399dc4..1faa1e6 100644
> > --- a/tools/perf/util/probe-event.c
> > +++ b/tools/perf/util/probe-event.c
> > @@ -2499,6 +2499,9 @@ static int find_probe_functions(struct map *map, char *name)
> >  	struct symbol *sym;
> >  	struct rb_node *tmp;
> >  
> > +	if (map__load(map, NULL) < 0)
> > +		return 0;
> > +
> >  	map__for_each_symbol(map, sym, tmp) {
> >  		if (strglobmatch(sym->name, name))
> >  			found++;
> > 
> 
> 
> -- 
> Masami HIRAMATSU
> Linux Technology Research Center, System Productivity Research Dept.
> Center for Technology Innovation - Systems Engineering
> Hitachi, Ltd., Research & Development Group
> E-mail: masami.hiramatsu.pt@...achi.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ