Re: [PATCH 2/4] x86/srso: Rename fam17 SRSO infrastructure to srso_fam17_*()

From: Peter Zijlstra
Date: Wed Sep 13 2023 - 09:16:10 EST


On Mon, Aug 21, 2023 at 12:27:21PM +0100, Andrew Cooper wrote:
> The naming is inconsistent. Rename it to fam17 to state the microarchitecture
> it is applicable to, and to mirror the srso_fam19_*() change.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
> CC: x86@xxxxxxxxxx
> CC: linux-kernel@xxxxxxxxxxxxxxx
> CC: Borislav Petkov <bp@xxxxxxxxx>
> CC: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> CC: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> CC: Babu Moger <babu.moger@xxxxxxx>
> CC: David.Kaplan@xxxxxxx
> CC: Nikolay Borisov <nik.borisov@xxxxxxxx>
> CC: gregkh@xxxxxxxxxxxxxxxxxxx
> CC: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> ---
> arch/x86/include/asm/nospec-branch.h | 4 ++--
> arch/x86/kernel/cpu/bugs.c | 2 +-
> arch/x86/kernel/vmlinux.lds.S | 2 +-
> arch/x86/lib/retpoline.S | 32 ++++++++++++++--------------
> 4 files changed, 20 insertions(+), 20 deletions(-)
>

Re your objtool woes:

> -SYM_START(srso_untrain_ret, SYM_L_GLOBAL, SYM_A_NONE)
> + .skip 64 - (srso_fam17_safe_ret - srso_fam17_untrain_ret), 0xcc
> +SYM_START(srso_fam17_untrain_ret, SYM_L_GLOBAL, SYM_A_NONE)
> ANNOTATE_NOENDBR
> .byte 0x48, 0xb8
>
> /*
> * This forces the function return instruction to speculate into a trap
> - * (UD2 in srso_return_thunk() below). This RET will then mispredict
> + * (UD2 in srso_fam17_return_thunk() below). This RET will then mispredict
> * and execution will continue at the return site read from the top of
> * the stack.
> */
> -SYM_INNER_LABEL(srso_safe_ret, SYM_L_GLOBAL)
> +SYM_INNER_LABEL(srso_fam17_safe_ret, SYM_L_GLOBAL)

Note that there is a mention of 'srso_safe_ret' in
tools/objtool/arch/x86/decode.c:arch_is_embedded_insn() which you
'forgot' to update.

> lea 8(%_ASM_SP), %_ASM_SP
> ret
> int3
> int3
> /* end of movabs */
> lfence
> - call srso_safe_ret
> + call srso_fam17_safe_ret
> ud2
> -SYM_CODE_END(srso_safe_ret)
> -SYM_FUNC_END(srso_untrain_ret)
> -__EXPORT_THUNK(srso_untrain_ret)
> +SYM_CODE_END(srso_fam17_safe_ret)
> +SYM_FUNC_END(srso_fam17_untrain_ret)
> +__EXPORT_THUNK(srso_fam17_untrain_ret)