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]
Date:   Wed, 23 May 2018 14:44:40 +0200
From:   Daniel Borkmann <daniel@...earbox.net>
To:     Sirio Balmelli <sirio@...d.ch>
Cc:     netdev@...r.kernel.org
Subject: Re: [PATCH 1/1] selftests/bpf: Makefile fix "missing" headers on
 build with -idirafter

On 05/21/2018 09:00 AM, Sirio Balmelli wrote:
> Selftests fail to build on several distros/architectures because of
> 	missing headers files.
> 
> On a Ubuntu/x86_64 some missing headers are:
> 	asm/byteorder.h, asm/socket.h, asm/sockios.h
> 
> On a Debian/arm32 build already fails at sys/cdefs.h
> 
> In both cases, these already exist in /usr/include/<arch-specific-dir>,
> but Clang does not include these when using '-target bpf' flag,
> since it is no longer compiling against the host architecture.
> 
> The solution is to:
> 
> - run Clang without '-target bpf' and extract the include chain for the
> current system
> 
> - add these to the bpf build with '-idirafter'
> 
> The choice of -idirafter is to catch this error without injecting
> unexpected include behavior: if an arch-specific tree is built
> for bpf in the future, this will be correctly found by Clang.
> 
> Signed-off-by: Sirio Balmelli <sirio@...d.ch>

Ok, I've tried this on arm64:

# clang -v -E - </dev/null 2>&1 | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }'
-idirafter /usr/local/include
-idirafter /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include
-idirafter /usr/include/aarch64-linux-gnu
-idirafter /usr/include

# clang -target bpf -v -E - </dev/null 2>&1 | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }'
-idirafter /usr/local/include
-idirafter /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include
-idirafter /usr/include

# clang -target aarch64 -v -E - </dev/null 2>&1 | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }'
-idirafter /usr/local/include
-idirafter /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include
-idirafter /usr/include

# clang -target aarch64-unknown-linux-gnu -v -E - </dev/null 2>&1 | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }'
-idirafter /usr/local/include
-idirafter /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include
-idirafter /usr/include/aarch64-linux-gnu
-idirafter /usr/include

# llc --version
LLVM (http://llvm.org/):
  LLVM version 3.8.0

  Optimized build.
  Built Jul  9 2016 (11:22:59).
  Default target: aarch64-unknown-linux-gnu
  Host CPU: (unknown)
[...]

So the default target adds additionally /usr/include/aarch64-linux-gnu which is
what you're after. Seems okay if it does the trick. Worst case we can always
revert and find a different solution. I've applied it to bpf-next instead of
bpf in order to give this some time for test exposure, thanks Sirio!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ