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  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:   Mon, 2 Dec 2019 09:59:30 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Daniel Borkmann <daniel@...earbox.net>
Cc:     Toke Høiland-Jørgensen <toke@...hat.com>,
        Alexei Starovoitov <alexei.starovoitov@...il.com>,
        Jiri Olsa <jolsa@...nel.org>,
        lkml <linux-kernel@...r.kernel.org>, netdev@...r.kernel.org,
        bpf@...r.kernel.org, Ingo Molnar <mingo@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Michael Petlan <mpetlan@...hat.com>,
        Jesper Dangaard Brouer <brouer@...hat.com>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        Andrii Nakryiko <andriin@...com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>, kubakici@...pl
Subject: Re: [PATCH bpf v3] bpftool: Allow to link libbpf dynamically

On Sat, Nov 30, 2019 at 12:56:49AM +0100, Daniel Borkmann wrote:
> On 11/29/19 3:00 PM, Toke Høiland-Jørgensen wrote:
> > Daniel Borkmann <daniel@...earbox.net> writes:
> > > On 11/28/19 5:07 PM, Toke Høiland-Jørgensen wrote:
> > > > From: Jiri Olsa <jolsa@...nel.org>
> [...]
> > > >    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
> > > > +ifdef LIBBPF_DYNAMIC
> > > > +  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.,
> > 
> > make LIBBPF_DYNAMIC=1
> > 
> > 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?
> > WDYT?
> 
> 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
> case to just rename s/BPF_DIR/BPF_SRC_DIR/, s/LIBBPF_OUTPUT/LIBBPF_BUILD_OUTPUT/,
> and s/LIBBPF_PATH/LIBBPF_BUILD_PATH/ to make their purpose more clear.

ok, will have separate patch for this

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

ok

> 
> ii) Extend tools/testing/selftests/bpf/test_bpftool_build.sh 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.

ok, will send new version soon

thanks,
jirka

> 
> Thanks,
> Daniel
> 

Powered by blists - more mailing lists