[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DDVNNDVOE49L.1F77ZUNBVTR1I@google.com>
Date: Thu, 30 Oct 2025 12:28:06 +0000
From: Brendan Jackman <jackmanb@...gle.com>
To: Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>, Borislav Petkov <bp@...en8.de>,
Peter Zijlstra <peterz@...radead.org>, Josh Poimboeuf <jpoimboe@...nel.org>,
Ingo Molnar <mingo@...hat.com>, Dave Hansen <dave.hansen@...ux.intel.com>, <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>, Sean Christopherson <seanjc@...gle.com>, Paolo Bonzini <pbonzini@...hat.com>
Cc: <linux-kernel@...r.kernel.org>, <kvm@...r.kernel.org>,
Tao Zhang <tao1.zhang@...el.com>, Jim Mattson <jmattson@...gle.com>,
Brendan Jackman <jackmanb@...gle.com>
Subject: Re: [PATCH 1/3] x86/bugs: Use VM_CLEAR_CPU_BUFFERS in VMX as well
On Wed Oct 29, 2025 at 9:26 PM UTC, Pawan Gupta wrote:
> TSA mitigation:
>
> d8010d4ba43e ("x86/bugs: Add a Transient Scheduler Attacks mitigation")
>
> introduced VM_CLEAR_CPU_BUFFERS for guests on AMD CPUs. Currently on Intel
> CLEAR_CPU_BUFFERS is being used for guests which has a much broader scope
> (kernel->user also).
>
> Make mitigations on Intel consistent with TSA. This would help handling the
> guest-only mitigations better in future.
>
> Signed-off-by: Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>
> ---
> arch/x86/kernel/cpu/bugs.c | 9 +++++++--
> arch/x86/kvm/vmx/vmenter.S | 3 ++-
> 2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index d7fa03bf51b4517c12cc68e7c441f7589a4983d1..6d00a9ea7b4f28da291114a7a096b26cc129b57e 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -194,7 +194,7 @@ DEFINE_STATIC_KEY_FALSE(switch_mm_cond_l1d_flush);
>
> /*
> * Controls CPU Fill buffer clear before VMenter. This is a subset of
> - * X86_FEATURE_CLEAR_CPU_BUF, and should only be enabled when KVM-only
> + * X86_FEATURE_CLEAR_CPU_BUF_VM, and should only be enabled when KVM-only
> * mitigation is required.
> */
So if I understand correctly with this patch the aim is:
X86_FEATURE_CLEAR_CPU_BUF means verw before exit to usermode
X86_FEATURE_CLEAR_CPU_BUF_VM means unconditional verw before VM Enter
cpu_buf_vm_clear[_mmio_only] means verw before VM Enter for
MMIO-capable guests.
Since this is being cleaned up can we also:
- Update the definition of X86_FEATURE_CLEAR_CPU_BUF in cpufeatures.h to
say what context it applies to (now it's specifically exit to user)
- Clear up how verw_clear_cpu_buf_mitigation_selected relates to these
two flags. Thinking aloud here... it looks like this is set:
- If MDS mitigations are on, meaning both flags are set
- If TAA mitigations are on, meaning both flags are set
- If MMIO mitigations are on, and the CPU has MDS or TAA. In this case
both flags are set, but this causality is messier.
- If RFDS mitigations are on and supported, meaning both flags are set
So if I'm reading this correctly whenever
verw_clear_cpu_buf_mitigation_selected we should expect both flags
enabled. So I think all that's needed is to add a reference to
X86_FEATURE_CLEAR_CPU_BUF_VM to the comment?
I think we also need to update the assertion of vmx->disable_fb_clear?
Anyway thanks this seems like a very clear improvement to me.
Powered by blists - more mailing lists