Re: [RESEND][PATCH 1/6] x86/bugs: Add asm helpers for executing VERW

From: Peter Zijlstra
Date: Wed Oct 25 2023 - 04:02:52 EST


On Wed, Oct 25, 2023 at 08:52:50AM +0100, Andrew Cooper wrote:

> > +.pushsection .entry.text, "ax"
> > +
> > +.align 64
> > +SYM_CODE_START_NOALIGN(mds_verw_sel)
> > + UNWIND_HINT_UNDEFINED
> > + ANNOTATE_NOENDBR
> > +1:
> > + .word __KERNEL_DS
> > + .skip 64 - (. - 1b), 0xcc
>
> The 1 label aliases mds_verw_sel and this must remain like this for the
> construct to work.
>
> So instead of .skip, why not simply .align 64, 0xcc and get rid of the
> 1: label?

Because I forgot you can add a filler byte to .align :/ Yes, that's much
saner.

> Do we have a suitably named constant cacheline size, rather than
> opencoding 64?

L1_CACHE_BYTES probably.

>
> > +SYM_CODE_END(mds_verw_sel);
>
> Given that KVM needs it, this probably needs an EXPORT_SYMBOL_GPL() on it.

localyesconfig ftw ;-)

/me runs