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: <YFoIU0xC3lXBwc9Y@hirez.programming.kicks-ass.net>
Date:   Tue, 23 Mar 2021 16:25:07 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     Arnd Bergmann <arnd@...nel.org>, Ingo Molnar <mingo@...hat.com>,
        Arnd Bergmann <arnd@...db.de>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Tobias Klauser <tklauser@...tanz.ch>,
        Wei Yang <richard.weiyang@...ux.alibaba.com>,
        Chengming Zhou <zhouchengming@...edance.com>,
        "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>,
        "Paul E. McKenney" <paulmck@...nel.org>,
        linux-kernel@...r.kernel.org, Kees Cook <keescook@...omium.org>
Subject: Re: [PATCH] ftrace: shut up -Wcast-function-type warning for
 ftrace_ops_no_ops

On Tue, Mar 23, 2021 at 08:57:42AM -0400, Steven Rostedt wrote:

> Well, from what I understand is that typecasting functions to other types
> of functions is one of the mistakes that cause security bugs to happen. And
> there's been a few of them in the kernel. Which is why the compilers have
> now been flagging them.

Doing the cast in the first pace is an indication something weird is
happening anyway. C will already warn you if you assign non-matching
pointer types.

So if there's bugs, audit all (function) pointer casts. Don't wreck
casts.

This warning will only make people add more (void *) intermediate casts
and then we have uglier code and an equal amount of hidden bugs. IE. we
really didn't win anything at all.

> This particular instance of the typecasting is unique and there's a bit of
> magic involved. Adding this little work around here is fine. Probably needs
> a better comment though.

Nah, it's not unique, static_call() has a whole bunch of them, including
the exact same you have. Yes, we're doing something C thinks is UB, but
we do that all day every day.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ