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, 05 Nov 2021 15:57:29 -0300
From:   Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To:     Andrii Nakryiko <andrii.nakryiko@...il.com>,
        Quentin Monnet <quentin@...valent.com>
CC:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        Song Liu <songliubraving@...com>, Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf-next] perf build: Install libbpf headers locally when building



On November 5, 2021 3:38:50 PM GMT-03:00, Andrii Nakryiko <andrii.nakryiko@...il.com> wrote:
>On Thu, Nov 4, 2021 at 7:02 PM Quentin Monnet <quentin@...valent.com> wrote:
>>
>> API headers from libbpf should not be accessed directly from the
>> library's source directory. Instead, they should be exported with "make
>> install_headers". Let's adjust perf's Makefile to install those headers
>> locally when building libbpf.
>>
>> Signed-off-by: Quentin Monnet <quentin@...valent.com>
>> ---
>> Note: Sending to bpf-next because it's directly related to libbpf, and
>> to similar patches merged through bpf-next, but maybe Arnaldo prefers to
>> take it?
>
>Arnaldo would know better how to thoroughly test it, so I'd prefer to
>route this through perf tree. Any objections, Arnaldo?


Sure, I'll review and test it.

- Arnaldo
>
>> ---
>>  tools/perf/Makefile.perf | 24 +++++++++++++-----------
>>  1 file changed, 13 insertions(+), 11 deletions(-)
>>
>> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
>> index b856afa6eb52..3a81b6c712a9 100644
>> --- a/tools/perf/Makefile.perf
>> +++ b/tools/perf/Makefile.perf
>> @@ -241,7 +241,7 @@ else # force_fixdep
>>
>>  LIB_DIR         = $(srctree)/tools/lib/api/
>>  TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
>> -BPF_DIR         = $(srctree)/tools/lib/bpf/
>> +LIBBPF_DIR      = $(srctree)/tools/lib/bpf/
>>  SUBCMD_DIR      = $(srctree)/tools/lib/subcmd/
>>  LIBPERF_DIR     = $(srctree)/tools/lib/perf/
>>  DOC_DIR         = $(srctree)/tools/perf/Documentation/
>> @@ -293,7 +293,6 @@ strip-libs = $(filter-out -l%,$(1))
>>  ifneq ($(OUTPUT),)
>>    TE_PATH=$(OUTPUT)
>>    PLUGINS_PATH=$(OUTPUT)
>> -  BPF_PATH=$(OUTPUT)
>>    SUBCMD_PATH=$(OUTPUT)
>>    LIBPERF_PATH=$(OUTPUT)
>>  ifneq ($(subdir),)
>> @@ -305,7 +304,6 @@ else
>>    TE_PATH=$(TRACE_EVENT_DIR)
>>    PLUGINS_PATH=$(TRACE_EVENT_DIR)plugins/
>>    API_PATH=$(LIB_DIR)
>> -  BPF_PATH=$(BPF_DIR)
>>    SUBCMD_PATH=$(SUBCMD_DIR)
>>    LIBPERF_PATH=$(LIBPERF_DIR)
>>  endif
>> @@ -324,7 +322,10 @@ LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS = $(if $(findstring -static,$(LDFLAGS)),,$(DY
>>  LIBAPI = $(API_PATH)libapi.a
>>  export LIBAPI
>>
>> -LIBBPF = $(BPF_PATH)libbpf.a
>> +LIBBPF_OUTPUT = $(OUTPUT)libbpf
>> +LIBBPF_DESTDIR = $(LIBBPF_OUTPUT)
>> +LIBBPF_INCLUDE = $(LIBBPF_DESTDIR)/include
>> +LIBBPF = $(LIBBPF_OUTPUT)/libbpf.a
>>
>>  LIBSUBCMD = $(SUBCMD_PATH)libsubcmd.a
>>
>> @@ -829,12 +830,14 @@ $(LIBAPI)-clean:
>>         $(call QUIET_CLEAN, libapi)
>>         $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
>>
>> -$(LIBBPF): FORCE
>> -       $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(FEATURE_DUMP_EXPORT)
>> +$(LIBBPF): FORCE | $(LIBBPF_OUTPUT)
>> +       $(Q)$(MAKE) -C $(LIBBPF_DIR) FEATURES_DUMP=$(FEATURE_DUMP_EXPORT) \
>> +               O= OUTPUT=$(LIBBPF_OUTPUT)/ DESTDIR=$(LIBBPF_DESTDIR) prefix= \
>> +               $@ install_headers
>>
>>  $(LIBBPF)-clean:
>>         $(call QUIET_CLEAN, libbpf)
>> -       $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) clean >/dev/null
>> +       $(Q)$(RM) -r -- $(LIBBPF_OUTPUT)
>>
>>  $(LIBPERF): FORCE
>>         $(Q)$(MAKE) -C $(LIBPERF_DIR) EXTRA_CFLAGS="$(LIBPERF_CFLAGS)" O=$(OUTPUT) $(OUTPUT)libperf.a
>> @@ -1036,14 +1039,13 @@ SKELETONS += $(SKEL_OUT)/bperf_cgroup.skel.h
>>
>>  ifdef BUILD_BPF_SKEL
>>  BPFTOOL := $(SKEL_TMP_OUT)/bootstrap/bpftool
>> -LIBBPF_SRC := $(abspath ../lib/bpf)
>> -BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(BPF_PATH) -I$(LIBBPF_SRC)/..
>> +BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE)
>>
>> -$(SKEL_TMP_OUT):
>> +$(SKEL_TMP_OUT) $(LIBBPF_OUTPUT):
>>         $(Q)$(MKDIR) -p $@
>>
>>  $(BPFTOOL): | $(SKEL_TMP_OUT)
>> -       CFLAGS= $(MAKE) -C ../bpf/bpftool \
>> +       $(Q)CFLAGS= $(MAKE) -C ../bpf/bpftool \
>>                 OUTPUT=$(SKEL_TMP_OUT)/ bootstrap
>>
>>  VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux)                           \
>> --
>> 2.32.0
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ