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] [day] [month] [year] [list]
Message-ID: <CAEf4BzZY5ReVYDRJq2kRGjH9Q9_H-LWWyo2WfWSbgGzr=QZ_Uw@mail.gmail.com>
Date:   Fri, 18 Sep 2020 11:50:00 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Jiri Olsa <jolsa@...hat.com>
Cc:     Seth Forshee <seth.forshee@...onical.com>,
        Andrii Nakryiko <andriin@...com>, Jiri Olsa <jolsa@...nel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: resolve_btfids breaks kernel cross-compilation

On Fri, Sep 18, 2020 at 3:07 AM Jiri Olsa <jolsa@...hat.com> wrote:
>
> On Thu, Sep 17, 2020 at 07:54:50AM -0500, Seth Forshee wrote:
> > On Thu, Sep 17, 2020 at 11:14:06AM +0200, Jiri Olsa wrote:
> > > On Thu, Sep 17, 2020 at 10:38:12AM +0200, Jiri Olsa wrote:
> > > > On Thu, Sep 17, 2020 at 10:04:55AM +0200, Jiri Olsa wrote:
> > > > > On Wed, Sep 16, 2020 at 02:47:33PM -0500, Seth Forshee wrote:
> > > > > > The requirement to build resolve_btfids whenever CONFIG_DEBUG_INFO_BTF
> > > > > > is enabled breaks some cross builds. For example, when building a 64-bit
> > > > > > powerpc kernel on amd64 I get:
> > > > > >
> > > > > >  Auto-detecting system features:
> > > > > >  ...                        libelf: [ [32mon[m  ]
> > > > > >  ...                          zlib: [ [32mon[m  ]
> > > > > >  ...                           bpf: [ [31mOFF[m ]
> > > > > >
> > > > > >  BPF API too old
> > > > > >  make[6]: *** [Makefile:295: bpfdep] Error 1
> > > > > >
> > > > > > The contents of tools/bpf/resolve_btfids/feature/test-bpf.make.output:
> > > > > >
> > > > > >  In file included from /home/sforshee/src/u-k/unstable/tools/arch/powerpc/include/uapi/asm/bitsperlong.h:11,
> > > > > >                   from /usr/include/asm-generic/int-ll64.h:12,
> > > > > >                   from /usr/include/asm-generic/types.h:7,
> > > > > >                   from /usr/include/x86_64-linux-gnu/asm/types.h:1,
> > > > > >                   from /home/sforshee/src/u-k/unstable/tools/include/linux/types.h:10,
> > > > > >                   from /home/sforshee/src/u-k/unstable/tools/include/uapi/linux/bpf.h:11,
> > > > > >                   from test-bpf.c:3:
> > > > > >  /home/sforshee/src/u-k/unstable/tools/include/asm-generic/bitsperlong.h:14:2: error: #error Inconsistent word size. Check asm/bitsperlong.h
> > > > > >     14 | #error Inconsistent word size. Check asm/bitsperlong.h
> > > > > >        |  ^~~~~
> > > > > >
> > > > > > This is because tools/arch/powerpc/include/uapi/asm/bitsperlong.h sets
> > > > > > __BITS_PER_LONG based on the predefinied compiler macro __powerpc64__,
> > > > > > which is not defined by the host compiler. What can we do to get cross
> > > > > > builds working again?
> > > > >
> > > > > could you please share the command line and setup?
> > > >
> > > > I just reproduced.. checking on fix
> > >
> > > I still need to check on few things, but patch below should help
> >
> > It does help with the word size problem, thanks.
> >
> > > we might have a problem for cross builds with different endianity
> > > than the host because libbpf does not support reading BTF data
> > > with different endianity, and we get:
> > >
> > >   BTFIDS  vmlinux
> > > libbpf: non-native ELF endianness is not supported
> >
> > Yes, I see this now when cross building for s390.
>
> Andrii,
> I read you might be already working on this?
>   https://lore.kernel.org/bpf/CAEf4Bza9tZ-Jj0dj9Ne0fmxa95t=9XxxJR+Ce=6hDmw_d8uVFA@mail.gmail.com/
>

Yes, it's one of the limitations I'm solving, stay tuned.


> thanks,
> jirka
>
> >
> > Thanks,
> > Seth
> >
> > >
> > > jirka
> > >
> > >
> > > ---
> > > diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
> > > index a88cd4426398..d3c818b8d8d3 100644
> > > --- a/tools/bpf/resolve_btfids/Makefile
> > > +++ b/tools/bpf/resolve_btfids/Makefile
> > > @@ -1,5 +1,6 @@
> > >  # SPDX-License-Identifier: GPL-2.0-only
> > >  include ../../scripts/Makefile.include
> > > +include ../../scripts/Makefile.arch
> > >
> > >  ifeq ($(srctree),)
> > >  srctree := $(patsubst %/,%,$(dir $(CURDIR)))
> > > @@ -29,6 +30,7 @@ endif
> > >  AR       = $(HOSTAR)
> > >  CC       = $(HOSTCC)
> > >  LD       = $(HOSTLD)
> > > +ARCH     = $(HOSTARCH)
> > >
> > >  OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/
> > >
> > >
> >
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ