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  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:   Sat, 30 Nov 2019 00:56:49 +0100
From:   Daniel Borkmann <>
To:     Toke Høiland-Jørgensen <>,
        Alexei Starovoitov <>
Cc:     Jiri Olsa <>, lkml <>,,,
        Ingo Molnar <>,
        Namhyung Kim <>,
        Alexander Shishkin <>,
        Peter Zijlstra <>,
        Michael Petlan <>,
        Jesper Dangaard Brouer <>,
        Martin KaFai Lau <>,
        Song Liu <>, Yonghong Song <>,
        Andrii Nakryiko <>,
        Arnaldo Carvalho de Melo <>,
Subject: Re: [PATCH bpf v3] bpftool: Allow to link libbpf dynamically

On 11/29/19 3:00 PM, Toke Høiland-Jørgensen wrote:
> Daniel Borkmann <> writes:
>> On 11/28/19 5:07 PM, Toke Høiland-Jørgensen wrote:
>>> From: Jiri Olsa <>
>>>    ifeq ($(srctree),)
>>>    srctree := $(patsubst %/,%,$(dir $(CURDIR)))
>>> @@ -63,6 +72,19 @@ RM ?= rm -f
>>>    FEATURE_USER = .bpftool
>>>    FEATURE_TESTS = libbfd disassembler-four-args reallocarray zlib
>>>    FEATURE_DISPLAY = libbfd disassembler-four-args zlib
>>> +  FEATURE_TESTS   += libbpf
>>> +  FEATURE_DISPLAY += libbpf
>>> +
>>> +  # for linking with debug library run:
>>> +  # make LIBBPF_DYNAMIC=1 LIBBPF_DIR=/opt/libbpf
>> The Makefile already has BPF_DIR which points right now to
>> '$(srctree)/tools/lib/bpf/' and LIBBPF_PATH for the final one and
>> where $(LIBBPF_PATH)libbpf.a is expected to reside. Can't we improve
>> the Makefile to reuse and work with these instead of adding yet
>> another LIBBPF_DIR var which makes future changes in this area more
>> confusing? The libbpf build spills out libbpf.{a,so*} by default
>> anyway.
> I see what you mean; however, LIBBPF_DIR is meant to be specifically an
> override for the dynamic library, not just the path to libbpf.
> Would it be less confusing to overload the LIBBPF_DYNAMIC variable
> instead? I.e.,
> would dynamically link against the libbpf installed in the system, but
> make LIBBPF_DYNAMIC=/opt/libbpf
> would override that and link against whatever is in /opt/libbpf instead?

Hm, given perf tool has similar LIB*_DIR vars in place for its libs, it probably
makes sense to stick with this convention as well then. Perhaps better in this
and s/LIBBPF_PATH/LIBBPF_BUILD_PATH/ to make their purpose more clear.

One thing that would be good to do as well for this patch is to:

  i) Document both LIBBPF_DYNAMIC and LIBBPF_DIR in the Makefile comment you
     added at the top along with a simple usage example.

ii) Extend tools/testing/selftests/bpf/ with a dynamic
     linking test case, e.g. building libbpf into a temp dir and pointing
     LIBBPF_DIR to it for bpftool LIBBPF_DYNAMIC=1 build.


Powered by blists - more mailing lists