Re: [PATCH v4 1/8] x86/bugs: Use VM_CLEAR_CPU_BUFFERS in VMX as well
From: Sean Christopherson
Date: Tue Nov 11 2025 - 17:03:42 EST
On Fri, Nov 07, 2025, Borislav Petkov wrote:
> On Mon, Nov 03, 2025 at 10:18:40AM -0800, Pawan Gupta wrote:
> > diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
> > index 08ed5a2e46a5..2be9be782013 100644
> > --- a/arch/x86/include/asm/nospec-branch.h
> > +++ b/arch/x86/include/asm/nospec-branch.h
> > @@ -321,9 +321,11 @@
> > #endif
> > .endm
> >
> > +/* Primarily used in exit-to-userspace path */
>
> What does "primarily" mean here?
>
> $ git grep -w CLEAR_CPU_BUFFERS
>
> says *only* the kernel->user vector.
How about:
/* If necessary, emit VERW on exit-to-userspace to clear CPU buffers. */
#define CLEAR_CPU_BUFFERS \
ALTERNATIVE "", __CLEAR_CPU_BUFFERS, X86_FEATURE_CLEAR_CPU_BUF
>
> > #define CLEAR_CPU_BUFFERS \
> > __CLEAR_CPU_BUFFERS X86_FEATURE_CLEAR_CPU_BUF
> >
> > +/* For use in KVM */
>
> That's why the "VM_" prefix is there.
Ya, and this goes away (moved into SVM) by the end of the series.