[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<LV3PR12MB9265EA487C377CA33F2731F594842@LV3PR12MB9265.namprd12.prod.outlook.com>
Date: Fri, 25 Apr 2025 13:28:14 +0000
From: "Kaplan, David" <David.Kaplan@....com>
To: Borislav Petkov <bp@...en8.de>
CC: Thomas Gleixner <tglx@...utronix.de>, Peter Zijlstra
<peterz@...radead.org>, Josh Poimboeuf <jpoimboe@...nel.org>, Pawan Gupta
<pawan.kumar.gupta@...ux.intel.com>, Ingo Molnar <mingo@...hat.com>, Dave
Hansen <dave.hansen@...ux.intel.com>, "x86@...nel.org" <x86@...nel.org>, "H .
Peter Anvin" <hpa@...or.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v5 03/16] x86/bugs: Restructure MMIO mitigation
[AMD Official Use Only - AMD Internal Distribution Only]
> -----Original Message-----
> From: Borislav Petkov <bp@...en8.de>
> Sent: Friday, April 25, 2025 4:10 AM
> To: Kaplan, David <David.Kaplan@....com>
> Cc: Thomas Gleixner <tglx@...utronix.de>; Peter Zijlstra <peterz@...radead.org>;
> Josh Poimboeuf <jpoimboe@...nel.org>; Pawan Gupta
> <pawan.kumar.gupta@...ux.intel.com>; Ingo Molnar <mingo@...hat.com>; Dave
> Hansen <dave.hansen@...ux.intel.com>; x86@...nel.org; H . Peter Anvin
> <hpa@...or.com>; linux-kernel@...r.kernel.org
> Subject: Re: [PATCH v5 03/16] x86/bugs: Restructure MMIO mitigation
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Thu, Apr 24, 2025 at 08:31:25PM +0000, Kaplan, David wrote:
> > verw_mitigation_selected implies that X86_FEATURE_CLEAR_CPU_BUF will
> > be enabled, which does a VERW on kernel/vmm exits.
>
> Does it imply that though? As explained, it simply says that *a* VERW mitigation
> has been selected.
>
> And only in the MMIO case which mandates that both spots - kernel entry and
> VMENTER - should be mitigated, it basically says that this
> CLEAR_CPU_BUFFERS macro should be active. And that macro does VERW on
> kernel entry and right before VMLAUNCH.
It was the intent to imply that. If you look at patch 1, 2, and 4 then if verw_mitigation_selected is ever set to true, it means that some mitigation is going to force X86_FEATURE_CLEAR_CPU_BUF.
Maybe the solution here is to clarify the comment above verw_mitigation_selected that it is set if any of those 4 bugs are going to enable X86_FEATURE_CLEAR_CPU_BUF. So it implies that specific VERW-based mitigation.
Or perhaps I could even rename the variable to be 'clear_cpu_buf_selected'?
>
> And when the machine is not affected by MDS+TAA, then it enables this
> cpu_buf_vm_clear thing which does VERW in C code, a bit earlier before
> VMLAUNCH.
>
> > So I'm not sure the comment is really wrong, but it can be rephrased.
>
> Yes please.
>
> > But it kind of does. !verw_mitigation_selected means that the
> > X86_FEATURE bit there isn't set. So the VMM-based mitigation (the
> > static branch) is only used if the broader X86_FEATURE_CLEAR_CPU_BUF
> > is not being used.
>
> Right, except that implication is not fully clear, I think.
>
> > I'm ok with this patch, as long as 'full VERW mitigation' is
> > considered a clear enough term. I think the updated comment in the
> > apply function does explain what that means, so if that's good enough
> > I'm ok.
>
> Right.
>
> So, I did beef up the comments some and renamed the key. Diff ontop of yours
> below. How does that look?
>
I think clarifying what verw_mitigation_selected means is better. When that becomes clear, I think that the existing comments make sense.
Thanks
--David Kaplan
Powered by blists - more mailing lists