Re: [PATCH v3 10/10] x86/ibt: Optimize fineibt-bhi arity 1 case
From: Kees Cook
Date: Wed Feb 19 2025 - 13:21:56 EST
On Wed, Feb 19, 2025 at 05:21:17PM +0100, Peter Zijlstra wrote:
> Saves a CALL to an out-of-line thunk for the common case of 1
> argument.
>
> Suggested-by: Scott Constable <scott.d.constable@xxxxxxxxx>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> ---
> arch/x86/include/asm/ibt.h | 4 ++
> arch/x86/kernel/alternative.c | 61 +++++++++++++++++++++++++++++++++++-------
> 2 files changed, 56 insertions(+), 9 deletions(-)
>
> --- a/arch/x86/include/asm/ibt.h
> +++ b/arch/x86/include/asm/ibt.h
> @@ -70,6 +70,10 @@ static inline bool __is_endbr(u32 val)
> if (val == gen_endbr_poison())
> return true;
>
> + /* See cfi_fineibt_bhi_preamble() */
> + if (IS_ENABLED(CONFIG_FINEIBT_BHI) && val == 0x001f0ff5)
> + return true;
Does this magic value need some better documentation?
Reviewed-by: Kees Cook <kees@xxxxxxxxxx>
--
Kees Cook