[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<LV3PR12MB9265E936344F123A5464D89794FD2@LV3PR12MB9265.namprd12.prod.outlook.com>
Date: Tue, 11 Feb 2025 20:53:53 +0000
From: "Kaplan, David" <David.Kaplan@....com>
To: Josh Poimboeuf <jpoimboe@...nel.org>
CC: Thomas Gleixner <tglx@...utronix.de>, Borislav Petkov <bp@...en8.de>,
Peter Zijlstra <peterz@...radead.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 v3 21/35] x86/bugs: Determine relevant vulnerabilities
based on attack vector controls.
[AMD Official Use Only - AMD Internal Distribution Only]
> -----Original Message-----
> From: Josh Poimboeuf <jpoimboe@...nel.org>
> Sent: Tuesday, February 11, 2025 2:35 PM
> To: Kaplan, David <David.Kaplan@....com>
> Cc: Thomas Gleixner <tglx@...utronix.de>; Borislav Petkov <bp@...en8.de>; Peter
> Zijlstra <peterz@...radead.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 v3 21/35] x86/bugs: Determine relevant vulnerabilities based
> on attack vector controls.
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Tue, Feb 11, 2025 at 07:04:44PM +0000, Kaplan, David wrote:
> > To explain my thinking a bit more, mitigate_cross_thread is intended
> > to enable cross-thread mitigations for any vulnerabilities the
> > hardware may have. That does not necessarily require disabling SMT.
> > The required cross-thread mitigation is defined by each vulnerability.
> >
> > For many vulnerabilities (like MDS), mitigation requires disabling
> > SMT. mds_apply_mitigation() queries the status of the cross-thread
> > attack vector and will disable SMT if needed.
> >
> > For GDS, mitigating cross-thread attacks does not require disabling
> > SMT, just enabling the mitigation in the MSR.
> >
> > To be fair, it doesn't make much sense to disable all the attack
> > vectors except mitigate_cross_thread, but for correctness it seemed
> > like enabling the mitigation in this case was the right thing.
> >
> > I don't really want to tie mitigate_cross_thread to SMT disable
> > because of cases like this where there is a cross-thread attack
> > mitigation that is different from disabling SMT. You could also
> > imagine bugs that might be even more limited, where perhaps they're
> > only relevant for say user->kernel but also have a cross-thread
> > component.
>
> But that "cross-thread" thing doesn't even make sense as a vector.
>
> Think about it this way. For cross-thread attacks:
>
> - CPU thread A is the attacker. It's running in either user or guest.
>
> - CPU thread B is the victim. It's running in either kernel, user, or
> host.
>
> So ALL cross-thread attacks have to include one of the following:
>
> - user->kernel
> - user->user
> - guest->host
> - guest->guest
>
> So by definition, a cross-thread attack must also involve at least one of those four
> main vectors.
>
> So cross-thread can't be a standalone vector. Rather, it's a dependent vector or
> "sub-vector".
>
> If a user wants to be protected from user->user, of course that includes wanting to
> be protected from *cross-thread* user->user.
>
> And if they *don't* care about user->user, why would they care about
> *cross-thread* user->user?
>
> What users *really* care about (and why there exists such a distinction in the first
> place) is the functional/performance impact of disabling SMT.
>
> So a flag to allow the vectors to disable SMT makes more sense, e.g.,
>
> mitigate_disable_smt=on
>
> And maybe also an additional flag which says "I've enabled core scheduling or
> some other isolation scheme, don't worry about any of the SMT-specific mitigations
> like STIBP":
>
> mitigate_smt_safe=on
>
> But the standalone "cross-thread" vector doesn't fit at all.
>
It's a valid argument, I definitely agree that cross-thread is a subset of the other vectors.
If I understand your proposal correctly, 'mitigate_disable_smt' means that the kernel may disable SMT if a vulnerability being mitigated requires it (yes?). I wonder if that should be 'mitigate_smt' with a 3-way selection of:
'on' (disable SMT if needed based on vulnerabilities)
'auto' (do not disable SMT but apply other existing SMT-based mitigations on relevant vulnerabilities)
'off' (do not apply any SMT related mitigations like STIBP)
And this would not be used when selecting whether to mitigate a bug, only in which mitigations are applied.
Thoughts?
--David Kaplan
Powered by blists - more mailing lists