[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220219002338.khiqptqukabfdvy2@treble>
Date: Fri, 18 Feb 2022 16:23:38 -0800
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: x86@...nel.org, joao@...rdrivepizza.com, hjl.tools@...il.com,
andrew.cooper3@...rix.com, linux-kernel@...r.kernel.org,
ndesaulniers@...gle.com, keescook@...omium.org,
samitolvanen@...gle.com, mark.rutland@....com,
alyssa.milburn@...el.com
Subject: Re: [PATCH 07/29] x86/entry: Sprinkle ENDBR dust
On Fri, Feb 18, 2022 at 05:49:09PM +0100, Peter Zijlstra wrote:
> Kernel entry points should be having ENDBR on for IBT configs.
>
> The SYSCALL entry points are found through taking their respective
> address in order to program them in the MSRs, while the exception
> entry points are found through UNWIND_HINT_IRET_REGS.
>
> *Except* that latter hint is also used on exit code to denote when
> we're down to an IRET frame. As such add an additional 'entry'
> argument to the macro and have it default to '1' such that objtool
> will assume it's an entry and WARN about it.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
So we now have two unwind types which are identical, except one requires
ENDBR after it.
It's not ideal. The code has to make sure to get the annotations right
for objtool to do its job. Setting the macro's default to 'entry=1'
does help with that, but still... it's clunky.
Also, calling them "entry" and "exit" is confusing. Not all the exits
are exits. Their common attribute is really that they're not "entry".
How important is it for objtool to validate these anyway? Seems like
such bugs would be few and far between, and would be discovered in a
jiffy after bricking the system.
Another possibly better and less intrusive way of doing this would be
for objtool to realize that any UNWIND_HINT_IRET_REGS at the beginning
of a SYM_CODE_START (global non-function code symbol) needs ENDBR.
--
Josh
Powered by blists - more mailing lists