From: Tim Chen <tim.c.chen@linux.intel.com>
To: Josh Poimboeuf <jpoimboe@redhat.com>, Jiri Kosina <jikos@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Borislav Petkov <bp@suse.de>, David Woodhouse <dwmw@amazon.co.uk>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org, x86@kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] x86/bugs: protect against userspace-userspace spectreRSB
Date: Mon, 30 Jul 2018 10:59:50 -0700 [thread overview]
Message-ID: <d3ace1f0-15c0-e14e-c35b-24e880d7abc2@linux.intel.com> (raw)
In-Reply-To: <20180725171124.kklnori7tf56ngeu@treble>
On 07/25/2018 10:11 AM, Josh Poimboeuf wrote:
> On Wed, Jul 25, 2018 at 03:50:44PM +0200, Jiri Kosina wrote:
>> On Wed, 25 Jul 2018, Josh Poimboeuf wrote:
>>
>>>> The article "Spectre Returns! Speculation Attacks using the Return Stack
>>>> Buffer" [1] describes two new (sub-)variants of spectrev2-like attack,
>>>> making use solely of the RSB contents even on CPUs that don't fallback to
>>>> BTB on RSB underflow (Skylake+).
>>>>
>>>> Mitigate userspace-userspace attacks by always unconditionally filling RSB on
>>>> context switch when generic spectrev2 mitigation has been enabled.
>>>>
>>>> [1] https://arxiv.org/pdf/1807.07940.pdf
>>>>
>>>> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
>>>
>>> While I generally agree with this patch, isn't it odd that we would do
>>> RSB filling on every context switch, but almost never do IBPB?
>>
>> Yeah, I have actually been wondering exactly the same, but that's what we
>> have been doing so far on SKL+, so I didn't really want to mix this aspect
>> in.
>>
>> I actually believe that in the name of consistency we should've been doing
>> the RSB fills under the same conditions we're issuing IBPB even on SKL+; I
>> can resend a patch that re-adjusts that, if that's the consensus.
>
> True, in theory it might make more sense to only fill RSB when doing an
> IBPB. But given the current state of almost never doing IBPB, that
> would be pointless. RSB is cheap enough that we should just do it
> unconditionally on context switch.
>
> BTW, I've heard that IBPB actually flushes RSB, though I haven't seen
> that officially documented anywhere. Not that it matters given the
> current IBPB code.
I think that's correct. IBPB does flushes the RSB. But doing
RSB stuffing will be cheaper.
Tim
>
> BTW^2, there was some discussion a few months back about offloading the
> "when to IBPB" decision to security modules, though I don't think I've
> ever seen official patches for that.
>
> All that said, this patch is fine until if/when the IBPB strategy gets
> figured out. RSB filling is cheap.
>
> Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
>
next prev parent reply other threads:[~2018-07-30 18:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-24 19:53 [PATCH] x86/bugs: protect against userspace-userspace spectreRSB Jiri Kosina
2018-07-25 13:45 ` Josh Poimboeuf
2018-07-25 13:50 ` Jiri Kosina
2018-07-25 17:11 ` Josh Poimboeuf
2018-07-30 17:59 ` Tim Chen [this message]
2018-07-25 17:28 ` Linus Torvalds
2018-07-25 23:11 ` Jiri Kosina
2018-07-25 23:27 ` Josh Poimboeuf
2018-07-26 11:14 ` [PATCH v2] " Jiri Kosina
2018-07-30 17:56 ` Tim Chen
2018-07-30 19:13 ` Konrad Rzeszutek Wilk
2018-07-30 22:48 ` [tip:x86/pti] x86/speculation: Protect " tip-bot for Jiri Kosina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d3ace1f0-15c0-e14e-c35b-24e880d7abc2@linux.intel.com \
--to=tim.c.chen@linux.intel.com \
--cc=bp@suse.de \
--cc=dwmw@amazon.co.uk \
--cc=jikos@kernel.org \
--cc=jpoimboe@redhat.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).