[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210323085742.18477aad@gandalf.local.home>
Date: Tue, 23 Mar 2021 08:57:42 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Peter Zijlstra <peterz@...radead.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, 23 Mar 2021 08:39:08 +0100
Peter Zijlstra <peterz@...radead.org> wrote:
> > index 4d8e35575549..d8fc87a17421 100644
> > --- a/kernel/trace/ftrace.c
> > +++ b/kernel/trace/ftrace.c
> > @@ -125,7 +125,7 @@ static void ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,
> > #else
> > /* See comment below, where ftrace_ops_list_func is defined */
> > static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip);
> > -#define ftrace_ops_list_func ((ftrace_func_t)ftrace_ops_no_ops)
> > +#define ftrace_ops_list_func ((ftrace_func_t)(void *)ftrace_ops_no_ops)
>
> So now we're making perfectly fine code worse, because GCC is stupid?
>
> Please just kill the warning, like we do with so many other warnings.
> It's broken!
[ Adding Kees ]
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.
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.
-- Steve
Powered by blists - more mailing lists