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: <e1dd40cd-647c-10b4-53f9-a313e509474e@isovalent.com>
Date:   Tue, 12 Jul 2022 11:11:53 +0100
From:   Quentin Monnet <quentin@...valent.com>
To:     Pu Lehui <pulehui@...wei.com>, bpf@...r.kernel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>,
        Jean-Philippe Brucker <jean-philippe@...aro.org>
Subject: Re: [PATCH bpf-next 1/3] samples: bpf: Fix cross-compiling error by
 using bootstrap bpftool

On 12/07/2022 04:08, Pu Lehui wrote:
> Currently, when cross compiling bpf samples, the host side cannot
> use arch-specific bpftool to generate vmlinux.h or skeleton. Since
> samples/bpf use bpftool for vmlinux.h, skeleton, and static linking
> only, we can use lightweight bootstrap version of bpftool to handle
> these, and it's always host-native.
> 
> Signed-off-by: Pu Lehui <pulehui@...wei.com>
> Suggested-by: Andrii Nakryiko <andrii@...nel.org>
> ---
>  samples/bpf/Makefile | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> index 5002a5b9a7da..57012b8259d2 100644
> --- a/samples/bpf/Makefile
> +++ b/samples/bpf/Makefile
> @@ -282,12 +282,18 @@ $(LIBBPF): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OU
>  
>  BPFTOOLDIR := $(TOOLS_PATH)/bpf/bpftool
>  BPFTOOL_OUTPUT := $(abspath $(BPF_SAMPLES_PATH))/bpftool
> -BPFTOOL := $(BPFTOOL_OUTPUT)/bpftool
> +BPFTOOL := $(BPFTOOL_OUTPUT)/bootstrap/bpftool
> +ifeq ($(CROSS_COMPILE),)
>  $(BPFTOOL): $(LIBBPF) $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) | $(BPFTOOL_OUTPUT)
> -	    $(MAKE) -C $(BPFTOOLDIR) srctree=$(BPF_SAMPLES_PATH)/../../ \
> -		OUTPUT=$(BPFTOOL_OUTPUT)/ \
> -		LIBBPF_OUTPUT=$(LIBBPF_OUTPUT)/ \
> -		LIBBPF_DESTDIR=$(LIBBPF_DESTDIR)/
> +	$(MAKE) -C $(BPFTOOLDIR) srctree=$(BPF_SAMPLES_PATH)/../../		\
> +		OUTPUT=$(BPFTOOL_OUTPUT)/ 					\
> +		LIBBPF_BOOTSTRAP_OUTPUT=$(LIBBPF_OUTPUT)/ 			\
> +		LIBBPF_BOOTSTRAP_DESTDIR=$(LIBBPF_DESTDIR)/ bootstrap
> +else
> +$(BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) | $(BPFTOOL_OUTPUT)

Thanks for this! Just trying to fully understand the details here. When
cross-compiling, you leave aside the dependency on target-arch-libbpf,
so that "make -C <bpftool-dir> bootstrap" rebuilds its own host-arch
libbpf, is this correct?

> +	$(MAKE) -C $(BPFTOOLDIR) srctree=$(BPF_SAMPLES_PATH)/../../ 		\
> +		OUTPUT=$(BPFTOOL_OUTPUT)/ bootstrap
> +endif
>  
>  $(LIBBPF_OUTPUT) $(BPFTOOL_OUTPUT):
>  	$(call msg,MKDIR,$@)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ