Re: [PATCH v2 00/11] Fix up SRSO stuff

From: Borislav Petkov
Date: Mon Aug 14 2023 - 15:58:33 EST


On Mon, Aug 14, 2023 at 12:51:53PM -0700, Josh Poimboeuf wrote:
> > * Regarding alignment - the instructions which need to be untrained,
> > * must all start at a cacheline boundary for Zen1/2 generations. That
> > * is, both the ret in zen_untrain_ret() and srso_safe_ret() in the
> > * srso_untrain_ret() must both be placed at the beginning of
> > * a cacheline.
> > */
>
> It's a good comment, but RET in srso_safe_ret() is still misaligned.
> Don't we need something like so?

Well, I guess that comment is still not good enough. Not the RET must be
cacheline-aligned but the function return sequences must be.

IOW, we need this:

<--- cacheline begin
SYM_INNER_LABEL(retbleed_return_thunk, SYM_L_GLOBAL)
ret
int3


and

<--- cacheline begin
SYM_INNER_LABEL(srso_safe_ret, SYM_L_GLOBAL)
lea 8(%_ASM_SP), %_ASM_SP
ret
int3

I'll improve on it before I apply it.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette