Re: [patch RFC 5/5] x86/speculation: Add basic speculation control code

From: David Woodhouse
Date: Wed Jan 10 2018 - 10:56:47 EST


On Wed, 2018-01-10 at 16:47 +0100, Andrea Arcangeli wrote:
> On Wed, Jan 10, 2018 at 03:24:17PM +0000, David Woodhouse wrote:
> > Since it achieves nothing but to make userspace run slower, there's no
> > need toÂwrite it again on returning to userspace. It will perform that
> > function just fine without doing so.
>
> Ok, very glad we are on the same page now.
>
> Note that as far as I can tell there was no way to answer the above
> question by reading the spec.

The spec does, I concede, leave something to be desired. This sentence
in particular â and it really is a single sentence â caused me to throw
my toys out of the pram and demand verbal explanations (which is
perhaps the only reason I managed to work it out):

"If IBRS is set, near returns and near indirect jumps/calls will not allow their
speculative target address to be controlled by code that executed in a less
privileged prediction mode before the IBRS mode was last written with a
value of 1 or on another logical processor so long as all RSB entries from the
previous less privileged prediction mode are overwritten"

But it *does* have the words "before the IBRS mode was last written
with a value of 1" in there somewhere... ;)

Attachment: smime.p7s
Description: S/MIME cryptographic signature