From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Arnd Bergmann <arnd@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Arnd Bergmann <arnd@arndb.de>,
Adrian Hunter <adrian.hunter@intel.com>,
Tobias Klauser <tklauser@distanz.ch>,
Wei Yang <richard.weiyang@linux.alibaba.com>,
Chengming Zhou <zhouchengming@bytedance.com>,
"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
linux-kernel@vger.kernel.org, Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH] ftrace: shut up -Wcast-function-type warning for ftrace_ops_no_ops
Date: Tue, 23 Mar 2021 17:05:21 +0100 [thread overview]
Message-ID: <YFoRwYBeHAN0Vn5q@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <YFoIU0xC3lXBwc9Y@hirez.programming.kicks-ass.net>
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
prev parent reply other threads:[~2021-03-23 16:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-22 21:49 Arnd Bergmann
2021-03-22 22:00 ` Steven Rostedt
2021-03-23 7:39 ` Peter Zijlstra
2021-03-23 12:57 ` Steven Rostedt
2021-03-23 15:25 ` Peter Zijlstra
2021-03-23 16:05 ` Peter Zijlstra [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YFoRwYBeHAN0Vn5q@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=adrian.hunter@intel.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=naveen.n.rao@linux.vnet.ibm.com \
--cc=paulmck@kernel.org \
--cc=richard.weiyang@linux.alibaba.com \
--cc=rostedt@goodmis.org \
--cc=tklauser@distanz.ch \
--cc=zhouchengming@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®