[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <073c4e1e2c677f88fd51e64e9b461ce4399b1883.camel@amd.com>
Date: Tue, 12 Nov 2024 15:16:44 +0000
From: "Shah, Amit" <Amit.Shah@....com>
To: "jpoimboe@...nel.org" <jpoimboe@...nel.org>, "amit@...nel.org"
<amit@...nel.org>, "andrew.cooper3@...rix.com" <andrew.cooper3@...rix.com>
CC: "corbet@....net" <corbet@....net>, "pawan.kumar.gupta@...ux.intel.com"
<pawan.kumar.gupta@...ux.intel.com>, "kai.huang@...el.com"
<kai.huang@...el.com>, "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"daniel.sneddon@...ux.intel.com" <daniel.sneddon@...ux.intel.com>, "Lendacky,
Thomas" <Thomas.Lendacky@....com>, "boris.ostrovsky@...cle.com"
<boris.ostrovsky@...cle.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "seanjc@...gle.com" <seanjc@...gle.com>,
"mingo@...hat.com" <mingo@...hat.com>, "pbonzini@...hat.com"
<pbonzini@...hat.com>, "tglx@...utronix.de" <tglx@...utronix.de>, "Moger,
Babu" <Babu.Moger@....com>, "Das1, Sandipan" <Sandipan.Das@....com>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>, "dwmw@...zon.co.uk"
<dwmw@...zon.co.uk>, "hpa@...or.com" <hpa@...or.com>, "peterz@...radead.org"
<peterz@...radead.org>, "bp@...en8.de" <bp@...en8.de>, "Kaplan, David"
<David.Kaplan@....com>, "x86@...nel.org" <x86@...nel.org>
Subject: Re: [RFC PATCH v2 1/3] x86: cpu/bugs: update SpectreRSB comments for
AMD
On Mon, 2024-11-11 at 17:46 -0800, Josh Poimboeuf wrote:
> On Tue, Nov 12, 2024 at 12:29:28AM +0000, Andrew Cooper wrote:
> > This is my take. On AMD CPUs, there are two unrelated issues to
> > take
> > into account:
> >
> > 1) SRSO
> >
> > Affects anything which doesn't enumerate SRSO_NO, which is all
> > parts to
> > date including Zen5.
> >
> > SRSO ends up overflowing the RAS with arbitrary BTB targets, such
> > that a
> > subsequent genuine RET follows a prediction which never came from a
> > real
> > CALL instruction.
> >
> > Mitigations for SRSO are either safe-ret, or IBPB-on-entry. Parts
> > without IBPB_RET using IBPB-on-entry need to manually flush the
> > RAS.
> >
> > Importantly, SMEP does not protection you against SRSO across the
> > user->kernel boundary, because the bad RAS entries are arbitrary.
> > New
> > in Zen5 is the SRSO_U/S_NO bit which says this case can't occur any
> > more. So on Zen5, you can in principle get away without a RAS
> > flush on
> > entry.
>
> Updated to mention SRSO:
>
> /*
> * In general there are two types of RSB attacks:
> *
> * 1) RSB underflow ("Intel Retbleed")
> *
> * Some Intel parts have "bottomless RSB". When the RSB
> is empty,
> * speculated return targets may come from the branch
> predictor,
> * which could have a user-poisoned BTB or BHB entry.
> *
> * When IBRS or eIBRS is enabled, the "user -> kernel"
> attack is
> * mitigated by the IBRS branch prediction isolation
> properties, so
> * the RSB buffer filling wouldn't be necessary to
> protect against
> * this type of attack.
> *
> * The "user -> user" attack is mitigated by RSB filling
> on context
> * switch.
> *
> * The "guest -> host" attack is mitigated by IBRS or
> eIBRS.
> *
> * 2) Poisoned RSB entry
> *
> * If the 'next' in-kernel return stack is shorter than
> 'prev',
> * 'next' could be tricked into speculating with a user-
> poisoned RSB
> * entry. Poisoned RSB entries can also be created by
> Branch Type
> * Confusion ("AMD retbleed") or SRSO.
> *
> * The "user -> kernel" attack is mitigated by SMEP and
> eIBRS. AMD
> * without SRSO_NO also needs the SRSO mitigation.
> *
> * The "user -> user" attack, also known as SpectreBHB,
> requires RSB
> * clearing.
> *
> * The "guest -> host" attack is mitigated by either
> eIBRS (not
> * IBRS!) or RSB clearing on vmexit. Note that eIBRS
> * implementations with X86_BUG_EIBRS_PBRSB still need
> "lite" RSB
> * clearing which retires a single CALL before the first
> RET.
> */
Thanks, Josh and Andrew. This reads well to me. In the context of
ERAPS, I'll end up adding a couple more sentences there as well.
Amit
Powered by blists - more mailing lists