[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240928133114.GE19439@noisy.programming.kicks-ass.net>
Date: Sat, 28 Sep 2024 15:31:14 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, alyssa.milburn@...el.com,
scott.d.constable@...el.com, joao@...rdrivepizza.com,
andrew.cooper3@...rix.com, jose.marchesi@...cle.com,
hjl.tools@...il.com, ndesaulniers@...gle.com,
samitolvanen@...gle.com, nathan@...nel.org, ojeda@...nel.org,
kees@...nel.org, alexei.starovoitov@...il.com
Subject: Re: [PATCH 01/14] x86/cfi: Wreck things...
On Fri, Sep 27, 2024 at 04:15:27PM -0700, Josh Poimboeuf wrote:
> On Fri, Sep 27, 2024 at 09:48:57PM +0200, Peter Zijlstra wrote:
> > vmlinux.o: warning: objtool: .export_symbol+0x3c9f0: data relocation to !ENDBR: entry_untrain_ret+0x0
> >
> > Which states that while these functions are exported and (directly)
> > callable, they cannot be called indirectly. There are two solutions:
>
> IIRC, exported symbols are by far the most common "need" for ENDBR. But
> presumably the vast majority of them aren't being indirect called.
>
> > - exclude the .export_symbol section from validation; effectively
> > saying that having linkable but not indirectly callable exports are
> > fine by default, or
>
> This is confusingly inconsistent IMO.
Yes. OTOH less indirectly callable functions is more better, no?
> > - make all of those use SYM_TYPED_FUNC_START to restore the
> > traditional (and expected, but less secure?) behaviour.
>
> Why not just make SYM_FUNC_START imply "typed"? That's consistent with
> what the compiler does anyway right?
It is indeed what the compiler does (unless __nocfi attribute is
employed), but it requires that there is a C declaration of the function
-- which is true for all exported functions but not necessary for all
SYM_FUNC_START() symbols per-se.
Also, it would make all ASM functions indirectly callable by default --
which I'm not sure is a good idea, I would much rather we keep this
explicit.
> Even better, require exported+indirect-called symbols to use
> EXPORT_SYMBOL_TYPED, otherwise they get sealed. I suppose we'd need to
> add some module-to-vmlinux ENDBR validation to make sure modules don't
> get broken by this.
So I like this idea. but yeah, this is going to be a bit tricky to
validate.
Anyway, I think I'll do an initial patch moving all the EXPORT'ed
symbols over to SYM_TYPED_FUNC_START() for now, and we can look at
adding extra EXPORT magic on top of all that later on.
Powered by blists - more mailing lists