Re: [PATCH v4 1/8] x86/bugs: Use VM_CLEAR_CPU_BUFFERS in VMX as well

From: Borislav Petkov

Date: Fri Nov 07 2025 - 14:05:50 EST


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.

> #define CLEAR_CPU_BUFFERS \
> __CLEAR_CPU_BUFFERS X86_FEATURE_CLEAR_CPU_BUF
>
> +/* For use in KVM */

That's why the "VM_" prefix is there.

The comments in arch/x86/include/asm/cpufeatures.h actually already explain
that, you could make them more explicit but let's not sprinkle comments
willy-nilly.

--
Regards/Gruss,
Boris.

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