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: <20170614155648.4cfd7a73@xeon-e3>
Date:   Wed, 14 Jun 2017 15:56:48 -0700
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     Daniel Borkmann <daniel@...earbox.net>
Cc:     alexei.starovoitov@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH iproute2 master] bpf: provide fallback defs for __NR_bpf
 when not avail

On Thu, 15 Jun 2017 00:47:15 +0200
Daniel Borkmann <daniel@...earbox.net> wrote:

> panji reported that he wasn't able to build iproute2's bpf library
> due to lack of __NR_bpf in his system headers. Providing a fallback
> definition when __NR_bpf is not available in the system lets the
> loader compile just fine, so lets add them for majority of archs.
> 
> Reported-by: panji <jpan@...e.nl>
> Signed-off-by: Daniel Borkmann <daniel@...earbox.net>
> ---
>  lib/bpf.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/lib/bpf.c b/lib/bpf.c
> index ae4d97d..e1e29cc 100644
> --- a/lib/bpf.c
> +++ b/lib/bpf.c
> @@ -128,6 +128,26 @@ static inline __u64 bpf_ptr_to_u64(const void *ptr)
>  	return (__u64)(unsigned long)ptr;
>  }
>  
> +#ifndef __NR_bpf
> +# if defined(__i386__)
> +#  define __NR_bpf 357
> +# elif defined(__x86_64__)
> +#  define __NR_bpf 321
> +# elif defined(__aarch64__)
> +#  define __NR_bpf 280
> +# elif defined(__sparc__)
> +#  define __NR_bpf 349
> +# elif defined(__arm__)
> +#  define __NR_bpf 386
> +# elif defined(__powerpc__)
> +#  define __NR_bpf 361
> +# elif defined(__s390__)
> +#  define __NR_bpf 351
> +# else
> +#  error __NR_bpf not defined. Update kernel headers.
> +# endif
> +#endif
> +
>  static int bpf(int cmd, union bpf_attr *attr, unsigned int size)
>  {
>  #ifdef __NR_bpf

Sorry this looks like a mess. enumerating architectures in two different
projects is likely to break in future.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ