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: <CAADnVQKNmAp-HeVE3-r_GV0in=PuVU9UE6LZ=-+09zzRWyyGEA@mail.gmail.com>
Date:   Wed, 12 Jun 2019 07:49:17 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Martynas Pumputis <m@...bda.lt>
Cc:     Network Development <netdev@...r.kernel.org>,
        bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>
Subject: Re: [PATCH bpf] bpf: Simplify definition of BPF_FIB_LOOKUP related flags

On Wed, Jun 12, 2019 at 6:25 AM Martynas Pumputis <m@...bda.lt> wrote:
>
> Previously, the BPF_FIB_LOOKUP_{DIRECT,OUTPUT} flags were defined
> with the help of BIT macro. This had the following issues:
>
> - In order to user any of the flags, a user was required to depend
>   on <linux/bits.h>.
> - No other flag in bpf.h uses the macro, so it seems that an unwritten
>   convention is to use (1 << (nr)) to define BPF-related flags.
>
> Signed-off-by: Martynas Pumputis <m@...bda.lt>
> ---
>  include/uapi/linux/bpf.h       | 4 ++--
>  tools/include/uapi/linux/bpf.h | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)

Makes sense to me.
Please split it into two patches.
One for kernel uapi and one for user space.
Since user bits are synced to github/libbpf independently.

> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 63e0cf66f01a..a8f17bc86732 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -3376,8 +3376,8 @@ struct bpf_raw_tracepoint_args {
>  /* DIRECT:  Skip the FIB rules and go to FIB table associated with device
>   * OUTPUT:  Do lookup from egress perspective; default is ingress
>   */
> -#define BPF_FIB_LOOKUP_DIRECT  BIT(0)
> -#define BPF_FIB_LOOKUP_OUTPUT  BIT(1)
> +#define BPF_FIB_LOOKUP_DIRECT  (1U << 0)
> +#define BPF_FIB_LOOKUP_OUTPUT  (1U << 1)
>
>  enum {
>         BPF_FIB_LKUP_RET_SUCCESS,      /* lookup successful */
> diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
> index 63e0cf66f01a..a8f17bc86732 100644
> --- a/tools/include/uapi/linux/bpf.h
> +++ b/tools/include/uapi/linux/bpf.h
> @@ -3376,8 +3376,8 @@ struct bpf_raw_tracepoint_args {
>  /* DIRECT:  Skip the FIB rules and go to FIB table associated with device
>   * OUTPUT:  Do lookup from egress perspective; default is ingress
>   */
> -#define BPF_FIB_LOOKUP_DIRECT  BIT(0)
> -#define BPF_FIB_LOOKUP_OUTPUT  BIT(1)
> +#define BPF_FIB_LOOKUP_DIRECT  (1U << 0)
> +#define BPF_FIB_LOOKUP_OUTPUT  (1U << 1)
>
>  enum {
>         BPF_FIB_LKUP_RET_SUCCESS,      /* lookup successful */
> --
> 2.21.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ