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: <0f6785599a2f4903bd65c5e498b9a197@AcuMS.aculab.com>
Date:   Mon, 26 Oct 2020 22:20:27 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Arnd Bergmann' <arnd@...nel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>
CC:     Arnd Bergmann <arnd@...db.de>, Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        Andrii Nakryiko <andrii@...nel.org>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...omium.org>,
        David Miller <davem@...emloft.net>,
        Thomas Gleixner <tglx@...utronix.de>,
        Jakub Sitnicki <jakub@...udflare.com>,
        Björn Töpel <bjorn.topel@...el.com>,
        Toke Høiland-Jørgensen <toke@...hat.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@...el.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] bpf: suppress -Wcast-function-type warning

From: Arnd Bergmann
> Sent: 26 October 2020 21:03
> 
> From: Arnd Bergmann <arnd@...db.de>
> 
> Building with -Wextra shows lots of warnings in the bpf
> code such as
> 
> kernel/bpf/verifier.c: In function ‘jit_subprogs’:
> include/linux/filter.h:345:4: warning: cast between incompatible function types from ‘unsigned int
> (*)(const void *, const struct bpf_insn *)’ to ‘u64 (*)(u64,  u64,  u64,  u64,  u64)’ {aka ‘long long
> unsigned int (*)(long long unsigned int,  long long unsigned int,  long long unsigned int,  long long
> unsigned int,  long long unsigned int)’} [-Wcast-function-type]
>   345 |   ((u64 (*)(u64, u64, u64, u64, u64))(x))
>       |    ^
> kernel/bpf/verifier.c:10706:16: note: in expansion of macro ‘BPF_CAST_CALL’
> 10706 |    insn->imm = BPF_CAST_CALL(func[subprog]->bpf_func) -
>       |                ^~~~~~~~~~~~~
> 
> This appears to be intentional, so change the cast in a way that
> suppresses the warning.

It is also utterly horrid.
If the value is ever cast back then there is a lot of scope
for it going badly wrong somewhere.
It certainly isn't valid to use the target type to call the original function.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ