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]
Message-ID: <CAEf4Bza4y5DjJfxQYDJEALQh+3SaukPtNJVLaLdMZK-SgpDpyw@mail.gmail.com>
Date:   Wed, 6 Oct 2021 11:20:46 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Quentin Monnet <quentin@...valent.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH bpf-next v3 04/10] tools: runqslower: install libbpf
 headers when building

On Sun, Oct 3, 2021 at 12:22 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 make sure that runqslower installs the
> headers properly when building.
>
> We use a libbpf_hdrs target to mark the logical dependency on libbpf's
> headers export for a number of object files, even though the headers
> should have been exported at this time (since bpftool needs them, and is
> required to generate the skeleton or the vmlinux.h).
>
> When descending from a parent Makefile, the specific output directories
> for building the library and exporting the headers are configurable with
> BPFOBJ_OUTPUT and BPF_DESTDIR, respectively. This is in addition to
> OUTPUT, on top of which those variables are constructed by default.
>
> Also adjust the Makefile for the BPF selftests. We pass a number of
> variables to the "make" invocation, because we want to point runqslower
> to the (target) libbpf shared with other tools, instead of building its
> own version. In addition, runqslower relies on (target) bpftool, and we
> also want to pass the proper variables to its Makefile so that bpftool
> itself reuses the same libbpf.
>
> Signed-off-by: Quentin Monnet <quentin@...valent.com>
> ---
>  tools/bpf/runqslower/Makefile        | 22 +++++++++++++---------
>  tools/testing/selftests/bpf/Makefile | 15 +++++++++------
>  2 files changed, 22 insertions(+), 15 deletions(-)
>
> diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile
> index 3818ec511fd2..049aef7e9a4c 100644
> --- a/tools/bpf/runqslower/Makefile
> +++ b/tools/bpf/runqslower/Makefile
> @@ -9,9 +9,9 @@ BPFTOOL ?= $(DEFAULT_BPFTOOL)
>  LIBBPF_SRC := $(abspath ../../lib/bpf)
>  BPFOBJ_OUTPUT := $(OUTPUT)libbpf/
>  BPFOBJ := $(BPFOBJ_OUTPUT)libbpf.a
> -BPF_INCLUDE := $(BPFOBJ_OUTPUT)
> -INCLUDES := -I$(OUTPUT) -I$(BPF_INCLUDE) -I$(abspath ../../lib)        \
> -       -I$(abspath ../../include/uapi)
> +BPF_DESTDIR := $(BPFOBJ_OUTPUT)
> +BPF_INCLUDE := $(BPF_DESTDIR)/include
> +INCLUDES := -I$(OUTPUT) -I$(BPF_INCLUDE) -I$(abspath ../../include/uapi)
>  CFLAGS := -g -Wall
>
>  # Try to detect best kernel BTF source
> @@ -33,7 +33,7 @@ endif
>
>  .DELETE_ON_ERROR:
>
> -.PHONY: all clean runqslower
> +.PHONY: all clean runqslower libbpf_hdrs
>  all: runqslower
>
>  runqslower: $(OUTPUT)/runqslower
> @@ -46,13 +46,15 @@ clean:
>         $(Q)$(RM) $(OUTPUT)runqslower
>         $(Q)$(RM) -r .output
>
> +libbpf_hdrs: $(BPFOBJ)
> +
>  $(OUTPUT)/runqslower: $(OUTPUT)/runqslower.o $(BPFOBJ)
>         $(QUIET_LINK)$(CC) $(CFLAGS) $^ -lelf -lz -o $@
>
>  $(OUTPUT)/runqslower.o: runqslower.h $(OUTPUT)/runqslower.skel.h             \
> -                       $(OUTPUT)/runqslower.bpf.o
> +                       $(OUTPUT)/runqslower.bpf.o libbpf_hdrs

this phony dependency will cause runqslower.o to be always rebuilt,
try running make multiple times with no changes inside
tools/bpf/runqslower. Can this be done just as an order-only
dependency?

>
> -$(OUTPUT)/runqslower.bpf.o: $(OUTPUT)/vmlinux.h runqslower.h
> +$(OUTPUT)/runqslower.bpf.o: $(OUTPUT)/vmlinux.h runqslower.h libbpf_hdrs
>
>  $(OUTPUT)/%.skel.h: $(OUTPUT)/%.bpf.o | $(BPFTOOL)
>         $(QUIET_GEN)$(BPFTOOL) gen skeleton $< > $@

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ