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: <tip-fd2275984d6e29c6737646ff39dd3de87a03f300@git.kernel.org>
Date:   Mon, 5 Sep 2016 06:21:14 -0700
From:   tip-bot for Arnaldo Carvalho de Melo <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     mingo@...nel.org, adrian.hunter@...el.com, hpa@...or.com,
        tglx@...utronix.de, linux-kernel@...r.kernel.org,
        mhiramat@...nel.org, namhyung@...nel.org, acme@...hat.com,
        wangnan0@...wei.com, jolsa@...nel.org, dsahern@...il.com
Subject: [tip:perf/core] perf probe: Do not use map_load filters for
 function

Commit-ID:  fd2275984d6e29c6737646ff39dd3de87a03f300
Gitweb:     http://git.kernel.org/tip/fd2275984d6e29c6737646ff39dd3de87a03f300
Author:     Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Wed, 31 Aug 2016 10:04:27 -0300
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Thu, 1 Sep 2016 09:43:57 -0300

perf probe: Do not use map_load filters for function

It is simpler to just do the loop, no need for globals and the last user
of such facility disappears.

Testing:

  # perf probe -F [a-z]*recvmsg
  aead_recvmsg
  compat_SyS_recvmsg
  compat_sys_recvmsg
  hash_recvmsg
  inet_recvmsg
  kernel_recvmsg
  netlink_recvmsg
  packet_recvmsg
  ping_recvmsg
  raw_recvmsg
  rawv6_recvmsg
  rng_recvmsg
  security_socket_recvmsg
  selinux_socket_recvmsg
  skcipher_recvmsg
  sock_common_recvmsg
  sock_no_recvmsg
  sock_recvmsg
  sys_recvmsg
  tcp_recvmsg
  udp_recvmsg
  udpv6_recvmsg
  unix_dgram_recvmsg
  unix_seqpacket_recvmsg
  unix_stream_recvmsg
  #

Without filters:

  # perf probe -F | tail -5
  zswap_pool_create
  zswap_pool_current
  zswap_update_total_size
  zswap_writeback_entry
  zswap_zpool_param_set
  #
  # perf probe -F | wc -l
  33311
  #

Acked-by: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: David Ahern <dsahern@...il.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Wang Nan <wangnan0@...wei.com>
Link: http://lkml.kernel.org/r/20160831130427.GA13095@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/util/probe-event.c | 29 ++++++++++-------------------
 1 file changed, 10 insertions(+), 19 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 2873396..0bed2ee 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -3289,24 +3289,10 @@ out:
 	return ret;
 }
 
-/* TODO: don't use a global variable for filter ... */
-static struct strfilter *available_func_filter;
-
-/*
- * If a symbol corresponds to a function with global binding and
- * matches filter return 0. For all others return 1.
- */
-static int filter_available_functions(struct map *map __maybe_unused,
-				      struct symbol *sym)
-{
-	if (strfilter__compare(available_func_filter, sym->name))
-		return 0;
-	return 1;
-}
-
 int show_available_funcs(const char *target, struct strfilter *_filter,
 					bool user)
 {
+        struct rb_node *nd;
 	struct map *map;
 	int ret;
 
@@ -3324,9 +3310,7 @@ int show_available_funcs(const char *target, struct strfilter *_filter,
 		return -EINVAL;
 	}
 
-	/* Load symbols with given filter */
-	available_func_filter = _filter;
-	ret = map__load(map, filter_available_functions);
+	ret = map__load(map, NULL);
 	if (ret) {
 		if (ret == -2) {
 			char *str = strfilter__string(_filter);
@@ -3343,7 +3327,14 @@ int show_available_funcs(const char *target, struct strfilter *_filter,
 
 	/* Show all (filtered) symbols */
 	setup_pager();
-	dso__fprintf_symbols_by_name(map->dso, map->type, stdout);
+
+        for (nd = rb_first(&map->dso->symbol_names[map->type]); nd; nd = rb_next(nd)) {
+		struct symbol_name_rb_node *pos = rb_entry(nd, struct symbol_name_rb_node, rb_node);
+
+		if (strfilter__compare(_filter, pos->sym.name))
+			printf("%s\n", pos->sym.name);
+        }
+
 end:
 	if (user) {
 		map__put(map);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ