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: <831a3003-d617-5eeb-b93b-595e1cad8eea@fb.com>
Date:   Sun, 24 Jan 2021 23:10:18 -0800
From:   Yonghong Song <yhs@...com>
To:     Tiezhu Yang <yangtiezhu@...ngson.cn>,
        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>
CC:     <netdev@...r.kernel.org>, <bpf@...r.kernel.org>,
        <linux-mips@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        Xuefeng Li <lixuefeng@...ngson.cn>
Subject: Re: [PATCH bpf-next v2] samples/bpf: Set flag
 __SANE_USERSPACE_TYPES__ for MIPS to fix build warnings



On 1/24/21 9:05 PM, Tiezhu Yang wrote:
> There exists many build warnings when make M=samples/bpf on the Loongson
> platform, this issue is MIPS related, x86 compiles just fine.
> 
> Here are some warnings:
> 
>    CC  samples/bpf/ibumad_user.o
> samples/bpf/ibumad_user.c: In function ‘dump_counts’:
> samples/bpf/ibumad_user.c:46:24: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘__u64’ {aka ‘long unsigned int’} [-Wformat=]
>      printf("0x%02x : %llu\n", key, value);
>                       ~~~^          ~~~~~
>                       %lu
>    CC  samples/bpf/offwaketime_user.o
> samples/bpf/offwaketime_user.c: In function ‘print_ksym’:
> samples/bpf/offwaketime_user.c:34:17: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘__u64’ {aka ‘long unsigned int’} [-Wformat=]
>     printf("%s/%llx;", sym->name, addr);
>                ~~~^               ~~~~
>                %lx
> samples/bpf/offwaketime_user.c: In function ‘print_stack’:
> samples/bpf/offwaketime_user.c:68:17: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘__u64’ {aka ‘long unsigned int’} [-Wformat=]
>    printf(";%s %lld\n", key->waker, count);
>                ~~~^                 ~~~~~
>                %ld
> 
> MIPS needs __SANE_USERSPACE_TYPES__ before <linux/types.h> to select
> 'int-ll64.h' in arch/mips/include/uapi/asm/types.h, then it can avoid
> build warnings when printing __u64 with %llu, %llx or %lld.
> 
> The header tools/include/linux/types.h defines __SANE_USERSPACE_TYPES__,
> it seems that we can include <linux/types.h> in the source files which
> have build warnings, but it has no effect due to actually it includes
> usr/include/linux/types.h instead of tools/include/linux/types.h, the
> problem is that "usr/include" is preferred first than "tools/include"
> in samples/bpf/Makefile, that sounds like a ugly hack to -Itools/include
> before -Iusr/include.
> 
> So define __SANE_USERSPACE_TYPES__ for MIPS in samples/bpf/Makefile
> is proper, if add "TPROGS_CFLAGS += -D__SANE_USERSPACE_TYPES__" in
> samples/bpf/Makefile, it appears the following error:
> 
> Auto-detecting system features:
> ...                        libelf: [ on  ]
> ...                          zlib: [ on  ]
> ...                           bpf: [ OFF ]
> 
> BPF API too old
> make[3]: *** [Makefile:293: bpfdep] Error 1
> make[2]: *** [Makefile:156: all] Error 2
> 
> With #ifndef __SANE_USERSPACE_TYPES__  in tools/include/linux/types.h,
> the above error has gone and this ifndef change does not hurt other
> compilations.
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>

Acked-by: Yonghong Song <yhs@...com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ