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:	Thu, 5 Dec 2013 10:23:00 +0100
From:	Jiri Olsa <jolsa@...hat.com>
To:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc:	linux-kernel@...r.kernel.org,
	Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...e.hu>,
	Namhyung Kim <namhyung@...nel.org>,
	Paul Mackerras <paulus@...ba.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Steven Rostedt <rostedt@...dmis.org>,
	David Ahern <dsahern@...il.com>
Subject: [PATCHv4 28/28] perf tools: Add udis86 disassembler feature check

On Thu, Dec 05, 2013 at 09:05:13AM +0100, Jiri Olsa wrote:
> On Wed, Dec 04, 2013 at 03:50:24PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Tue, Dec 03, 2013 at 02:09:42PM +0100, Jiri Olsa escreveu:
> > > Adding udis86 disassembler feature check which support
> > > is needed for kvm:kvm_emulate_insn tracepoint.
> > >  
> > > +$(call feature_check,udis86)
> > > +ifeq ($(feature-udis86), 1)
> > > +  LIBTRACEEVENT_CFLAGS += -DHAVE_UDIS86
> > > +  EXTLIBS += -ludis86
> > > +else
> > > +  msg := $(warning No udis86 support.);
> > > +endif
> > 
> > That is really an incomplete message, what package should I install?
> > Perhaps we should add this there then:
> > 
> > http://bit.ly/1hyrN52
> 
> nice :-)
> 
> > 
> > Wow, that was easy, but yeah, could be made easier 8-) ;-P
> 
> so something like:
> No udis86 found. Please install udis86-devel.
> 
> or:
> No udis86 found, disabling kvm tracepoints instruction disassembly. Please install udis86-devel.

took the first one, v4 attached, perf/core_plugins is updated

thanks,
jirka


---
Adding udis86 disassembler feature check which support
is needed for kvm:kvm_emulate_insn tracepoint.

The diff of 'perf script' output generated by old and new code:
(data was generated by 'perf record -e kvm:kvm_emulate_insn -a')

  --- script.kvm.old
  +++ script.kvm.new
  - qemu-system-x86 15519 [003]  5332.470049: kvm:kvm_emulate_insn: 0:ffffffff8103c596:89 b7 00 80 5f ff (prot64)
  + qemu-system-x86 15519 [003]  5332.470049: kvm:kvm_emulate_insn: 0:ffffffff8103c596: mov %esi, -0xa08000(%rdi)

Signed-off-by: Jiri Olsa <jolsa@...hat.com>
Cc: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: David Ahern <dsahern@...il.com>
---
 tools/perf/Makefile.perf                       |  4 ++--
 tools/perf/config/Makefile                     | 11 ++++++++++-
 tools/perf/config/feature-checks/Makefile      |  8 ++++++--
 tools/perf/config/feature-checks/test-all.c    |  5 +++++
 tools/perf/config/feature-checks/test-udis86.c | 11 +++++++++++
 5 files changed, 34 insertions(+), 5 deletions(-)
 create mode 100644 tools/perf/config/feature-checks/test-udis86.c

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index ca3b87d..5c4c8bd 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -712,7 +712,7 @@ $(LIB_FILE): $(LIB_OBJS)
 TE_SOURCES = $(wildcard $(TRACE_EVENT_DIR)*.[ch])
 
 LIBTRACEEVENT_FLAGS  = $(QUIET_SUBDIR1) O=$(OUTPUT)
-LIBTRACEEVENT_FLAGS += CFLAGS="-g -Wall $(EXTRA_CFLAGS)"
+LIBTRACEEVENT_FLAGS += CFLAGS="-g -Wall $(EXTRA_CFLAGS) $(LIBTRACEEVENT_CFLAGS)"
 LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)
 
 $(LIBTRACEEVENT): $(TE_SOURCES) $(OUTPUT)PERF-CFLAGS
@@ -793,7 +793,7 @@ cscope:
 
 ### Detect prefix changes
 TRACK_CFLAGS = $(subst ','\'',$(CFLAGS)):\
-             $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):$(plugindir_SQ)
+             $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):$(plugindir_SQ):$(LIBTRACEEVENT_CFLAGS)
 
 $(OUTPUT)PERF-CFLAGS: .FORCE-PERF-CFLAGS
 	@FLAGS='$(TRACK_CFLAGS)'; \
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index bae1072..ddae5c4 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -142,7 +142,8 @@ CORE_FEATURE_TESTS =			\
 	libunwind			\
 	on-exit				\
 	stackprotector-all		\
-	timerfd
+	timerfd				\
+	udis86
 
 #
 # So here we detect whether test-all was rebuilt, to be able
@@ -413,6 +414,14 @@ else
   msg := $(warning No timerfd support. Disables 'perf kvm stat live');
 endif
 
+$(call feature_check,udis86)
+ifeq ($(feature-udis86), 1)
+  LIBTRACEEVENT_CFLAGS += -DHAVE_UDIS86
+  EXTLIBS += -ludis86
+else
+  msg := $(warning No udis86 found. Please install udis86-devel.)
+endif
+
 disable-python = $(eval $(disable-python_code))
 define disable-python_code
   CFLAGS += -DNO_LIBPYTHON
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile
index b8bb749..3ed2667 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -26,7 +26,8 @@ FILES=					\
 	test-libunwind-debug-frame	\
 	test-on-exit			\
 	test-stackprotector-all		\
-	test-timerfd
+	test-timerfd			\
+	test-udis86
 
 CC := $(CC) -MD
 
@@ -37,7 +38,7 @@ BUILD = $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT)$@ $@.c
 ###############################
 
 test-all:
-	$(BUILD) -Werror -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma $(LIBUNWIND_LIBS) -lelf -laudit -I/usr/include/slang -lslang $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl
+	$(BUILD) -Werror -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma $(LIBUNWIND_LIBS) -lelf -laudit -I/usr/include/slang -lslang $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -ludis86
 
 test-hello:
 	$(BUILD)
@@ -140,6 +141,9 @@ test-backtrace:
 test-timerfd:
 	$(BUILD)
 
+test-udis86:
+	$(BUILD) -DHAVE_UDIS86 -ludis86
+
 -include *.d
 
 ###############################
diff --git a/tools/perf/config/feature-checks/test-all.c b/tools/perf/config/feature-checks/test-all.c
index 9b8a544..df087a5 100644
--- a/tools/perf/config/feature-checks/test-all.c
+++ b/tools/perf/config/feature-checks/test-all.c
@@ -89,6 +89,10 @@
 # include "test-stackprotector-all.c"
 #undef main
 
+#define main main_test_udis86
+# include "test-udis86.c"
+#undef main
+
 int main(int argc, char *argv[])
 {
 	main_test_libpython();
@@ -111,6 +115,7 @@ int main(int argc, char *argv[])
 	main_test_libnuma();
 	main_test_timerfd();
 	main_test_stackprotector_all();
+	main_test_udis86();
 
 	return 0;
 }
diff --git a/tools/perf/config/feature-checks/test-udis86.c b/tools/perf/config/feature-checks/test-udis86.c
new file mode 100644
index 0000000..dbc2c26
--- /dev/null
+++ b/tools/perf/config/feature-checks/test-udis86.c
@@ -0,0 +1,11 @@
+
+/*
+ * test for udis86 functions used by plugin_kvm.c
+ */
+
+#include <udis86.h>
+
+int main(void)
+{
+	return puts("hi");
+}
-- 
1.8.3.1

--
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