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:	Wed, 20 Apr 2016 18:01:43 +0000
From:	Wang Nan <wangnan0@...wei.com>
To:	<acme@...nel.org>, <jolsa@...hat.com>, <brendan.d.gregg@...il.com>
CC:	<linux-kernel@...r.kernel.org>, <pi3orama@....com>,
	Wang Nan <wangnan0@...wei.com>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	"Alexei Starovoitov" <ast@...nel.org>,
	Jiri Olsa <jolsa@...nel.org>, Li Zefan <lizefan@...wei.com>
Subject: [RFC PATCH 03/13] bpf tools: Add ubpf include and makefile options

Prepare to use libubpf. Add ubpf.h into libbpf.c. Add corresponding
makefile options.

Allow ignoring UBPF when building libbpf by setting NO_UBPF=1 for
libbpf building.

Allow perf controling ubpf using NO_UBPF=1.

Signed-off-by: Wang Nan <wangnan0@...wei.com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Alexei Starovoitov <ast@...nel.org>
Cc: Brendan Gregg <brendan.d.gregg@...il.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Li Zefan <lizefan@...wei.com>
---
 tools/lib/bpf/Makefile     | 16 ++++++++++++++--
 tools/lib/bpf/libbpf.c     |  3 +++
 tools/perf/Makefile.perf   |  2 ++
 tools/perf/config/Makefile |  7 +++++++
 4 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 8dfa512..6944d02 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -64,9 +64,17 @@ ifndef VERBOSE
   VERBOSE = 0
 endif
 
+ifndef NO_UBPF
+  FEATURE_UBPF := ubpf
+  CFLAGS_UBPF := -DHAVE_UBPF_SUPPORT
+else
+  FEATURE_UBPF :=
+  CFLAGS_UBPF :=
+endif
+
 FEATURE_USER = .libbpf
-FEATURE_TESTS = libelf libelf-getphdrnum libelf-mmap bpf ubpf
-FEATURE_DISPLAY = libelf bpf ubpf
+FEATURE_TESTS = libelf libelf-getphdrnum libelf-mmap bpf $(FEATURE_UBPF)
+FEATURE_DISPLAY = libelf bpf $(FEATURE_UBPF)
 
 INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/arch/$(ARCH)/include/uapi -I$(srctree)/include/uapi
 FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)
@@ -120,6 +128,10 @@ ifeq ($(feature-libelf-getphdrnum), 1)
   override CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
 endif
 
+ifeq ($(feature-ubpf), 1)
+  override CFLAGS += $(CFLAGS_UBPF)
+endif
+
 # Append required CFLAGS
 override CFLAGS += $(EXTRA_WARNINGS)
 override CFLAGS += -Werror -Wall
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 7e543c3..55b739e 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -21,6 +21,9 @@
 #include <libelf.h>
 #include <gelf.h>
 
+#ifdef HAVE_UBPF_SUPPORT
+# include <ubpf.h>
+#endif
 #include "libbpf.h"
 #include "bpf.h"
 
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index bde8cba..5334e29 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -81,6 +81,8 @@ include ../scripts/utilities.mak
 #
 # Define NO_LIBBPF if you do not want BPF support
 #
+# Define NO_UBPF if you do not want user space BPF support
+#
 # Define FEATURES_DUMP to provide features detection dump file
 # and bypass the feature detection
 
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 1e46277..89d0470 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -315,6 +315,13 @@ ifndef NO_LIBELF
     ifeq ($(feature-bpf), 1)
       CFLAGS += -DHAVE_LIBBPF_SUPPORT
       $(call detected,CONFIG_LIBBPF)
+      ifndef NO_UBPF
+        ifeq ($(feature-ubpf), 1)
+          CFLAGS += -DHAVE_UBPF_SUPPORT
+          EXTLIBS += -lubpf
+          $(call detected,CONFIG_UBPF)
+        endif
+      endif
     endif
 
     ifndef NO_DWARF
-- 
1.8.3.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ