Re: [PATCH RFC 4/4] x86/srso: Use CALL-based return thunks to reduce overhead

From: Peter Zijlstra
Date: Wed Sep 13 2023 - 09:17:58 EST


On Mon, Aug 21, 2023 at 12:27:23PM +0100, Andrew Cooper wrote:

>
> vmlinux.o: warning: objtool: srso_fam17_return_thunk(): can't find starting instruction
>

> @@ -288,26 +283,22 @@ SYM_START(srso_fam17_untrain_ret, SYM_L_GLOBAL, SYM_A_NONE)
> * and execution will continue at the return site read from the top of
> * the stack.
> */
> -SYM_INNER_LABEL(srso_fam17_safe_ret, SYM_L_GLOBAL)
> +SYM_INNER_LABEL(srso_fam17_return_thunk, SYM_L_GLOBAL)

This srso_safe_ret -> srso_fam17_safe_ret you forgot in the last patch,
is then here renamed yet again to srso_fam17_return_thunk.

And there is your objtool splat.

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