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: <e3eb5919-4573-4576-e6aa-bd8ff56409ed@fb.com>
Date:   Wed, 13 Jan 2021 09:12:03 -0800
From:   Yonghong Song <yhs@...com>
To:     Tiezhu Yang <yangtiezhu@...ngson.cn>,
        Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>,
        Nathan Chancellor <natechancellor@...il.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>
CC:     <linux-sparse@...r.kernel.org>, <netdev@...r.kernel.org>,
        <bpf@...r.kernel.org>, <clang-built-linux@...glegroups.com>,
        <linux-mips@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        Xuefeng Li <lixuefeng@...ngson.cn>
Subject: Re: [PATCH bpf 1/2] samples/bpf: Set flag __SANE_USERSPACE_TYPES__
 for MIPS to fix build warnings



On 1/13/21 2:57 AM, Tiezhu Yang wrote:
> MIPS needs __SANE_USERSPACE_TYPES__ before <linux/types.h> to select
> 'int-ll64.h' in arch/mips/include/uapi/asm/types.h and avoid compile
> warnings when printing __u64 with %llu, %llx or %lld.

could you mention which command produces the following warning?

> 
>      printf("0x%02x : %llu\n", key, value);
>                       ~~~^          ~~~~~
>                       %lu
>     printf("%s/%llx;", sym->name, addr);
>                ~~~^               ~~~~
>                %lx
>    printf(";%s %lld\n", key->waker, count);
>                ~~~^                 ~~~~~
>                %ld
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
> ---
>   samples/bpf/Makefile        | 4 ++++
>   tools/include/linux/types.h | 3 +++
>   2 files changed, 7 insertions(+)
> 
> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> index 26fc96c..27de306 100644
> --- a/samples/bpf/Makefile
> +++ b/samples/bpf/Makefile
> @@ -183,6 +183,10 @@ BPF_EXTRA_CFLAGS := $(ARM_ARCH_SELECTOR)
>   TPROGS_CFLAGS += $(ARM_ARCH_SELECTOR)
>   endif
>   
> +ifeq ($(ARCH), mips)
> +TPROGS_CFLAGS += -D__SANE_USERSPACE_TYPES__
> +endif
> +

This change looks okay based on description in
arch/mips/include/uapi/asm/types.h

'''
/*
  * We don't use int-l64.h for the kernel anymore but still use it for
  * userspace to avoid code changes.
  *
  * However, some user programs (e.g. perf) may not want this. They can
  * flag __SANE_USERSPACE_TYPES__ to get int-ll64.h here.
  */
'''

>   TPROGS_CFLAGS += -Wall -O2
>   TPROGS_CFLAGS += -Wmissing-prototypes
>   TPROGS_CFLAGS += -Wstrict-prototypes
> diff --git a/tools/include/linux/types.h b/tools/include/linux/types.h
> index 154eb4e..e9c5a21 100644
> --- a/tools/include/linux/types.h
> +++ b/tools/include/linux/types.h
> @@ -6,7 +6,10 @@
>   #include <stddef.h>
>   #include <stdint.h>
>   
> +#ifndef __SANE_USERSPACE_TYPES__
>   #define __SANE_USERSPACE_TYPES__	/* For PPC64, to get LL64 types */
> +#endif

What problem this patch fixed? If this header is used, you can just
change comment from "PPC64" to "PPC64/MIPS", right?

> +
>   #include <asm/types.h>
>   #include <asm/posix_types.h>
>   
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ