[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YFoRwYBeHAN0Vn5q@hirez.programming.kicks-ass.net>
Date: Tue, 23 Mar 2021 17:05:21 +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 04:25:07PM +0100, Peter Zijlstra wrote:
> 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.
Here's weakening static_call_update() to get around this new
fail^Wfeature:
https://lkml.kernel.org/r/YFoN7nCl8OfGtpeh@hirez.programming.kicks-ass.net
Powered by blists - more mailing lists