[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180213075824.ucnn3aef76jbfu4m@gmail.com>
Date: Tue, 13 Feb 2018 08:58:24 +0100
From: Ingo Molnar <mingo@...nel.org>
To: David Woodhouse <dwmw2@...radead.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
Thomas Mingarelli <thomas.mingarelli@....com>, hpa@...or.com,
tglx@...utronix.de, torvalds@...ux-foundation.org,
linux-kernel@...r.kernel.org, linux-tip-commits@...r.kernel.org,
Dave Hansen <dave@...1.net>, Borislav Petkov <bp@...en8.de>,
Arjan van de Ven <arjan@...radead.org>
Subject: Re: [tip:x86/pti] x86/speculation: Use IBRS if available before
calling into firmware
* David Woodhouse <dwmw2@...radead.org> wrote:
> On Mon, 2018-02-12 at 12:50 +0100, Peter Zijlstra wrote:
> > On Mon, Feb 12, 2018 at 11:22:11AM +0100, Ingo Molnar wrote:
> > > > +static inline void firmware_restrict_branch_speculation_start(void)
> > > > +{
> > > > + alternative_msr_write(MSR_IA32_SPEC_CTRL, SPEC_CTRL_IBRS,
> > > > + X86_FEATURE_USE_IBRS_FW);
> > > > +}
> > > > +
> > > > +static inline void firmware_restrict_branch_speculation_end(void)
> > > > +{
> > > > + alternative_msr_write(MSR_IA32_SPEC_CTRL, 0,
> > > > + X86_FEATURE_USE_IBRS_FW);
> > >
> > > BTW., there's a detail that only occurred to me today, this enabling/disabling
> > > sequence is not NMI safe, and it might be called from NMI context:
> >
> > Wait, we're doing firmware from NMI? That sounds like a _REALLY_ bad
> > idea.
>
> And spin_lock_irqsave() too. Which is probably why I missed the fact
> that this was being called in NMI context.
>
> Yay for HP and their persistent attempts to "value subtract" in their
> firmware offerings.
>
> I'm tempted to drop that part of the patch and declare that if you're
> using this driver, the potential for stray branch prediction when you
> call into the firmware from the NMI handler is the *least* of your
> problems.
>
> I *will* go back over the other parts of the patch and audit them for
> preempt safety though; there could potentially be a similar issue
> there. I think I put them close enough to the actual firmware calls
> that if we aren't already preempt-safe then we were screwed anyway, but
> *maybe* there's merit in making the macros explicitly bump the preempt
> count anyway.
Ok, meanwhile I'm removing this patch from the x86/pti branch, and since the
branch has to be rebased anyway, I'll merge these into a single patch:
85d8426e0720: x86/speculation: Correct Speculation Control microcode blacklist again
1751342095f0: x86/speculation: Update Speculation Control microcode blacklist
Thanks,
Ingo
Powered by blists - more mailing lists