Re: [PATCH v3 5/6] x86/ftrace: Use text_poke()

From: Josh Poimboeuf
Date: Tue Jan 28 2020 - 21:17:46 EST


On Wed, Jan 29, 2020 at 01:46:55AM +0100, Jiri Kosina wrote:
> On Tue, 28 Jan 2020, Josh Poimboeuf wrote:
>
> > > Anyway, I think that we might make your life easier with using the
> > > proposed -Wsuggest-attribute=noreturn.
> >
> > Maybe. Though if I understand correctly, this doesn't help for any of
> > the new warnings because they're for static functions, and this only
> > warns about global functions.
>
> Could you please provide a pointer where those have been
> reported/analyzed?
>
> For the cases I've seen so far, it has always been gcc deciding under
> certain circumstances not to propagate __attribute__((__noreturn__)) from
> callee to caller even in the cases when caller unconditionally called
> callee.
>
> AFAIU, the behavior is (and always will) be dependent on the state of gcc
> optimizations, and therefore I don't see any other way than adding
> __noreturn anotation transitively everywhere in order to silence objtool.
>
> So those cases have to be fixed anyway.
>
> What are the other cases please? Either I have completely missed those, or
> they haven't been mentioned in this thread.

For example, see:

https://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git/commit/?h=objtool-fixes&id=6265238af90b395a1e5e5032a41f012a552d8a9e

Many of those callees are static noreturns, for which we've *never*
needed annotations. Disabling -fipa-pure-const has apparently changed
that.

-Wsuggest-attribute=noreturn doesn't seem to suggest annotations for
static functions, probably because most reasonable setups use -O2 which
allows GCC to detect them.

--
Josh