From: David Woodhouse <dwmw2@infradead.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"tim.c.chen@linux.intel.com" <tim.c.chen@linux.intel.com>,
"peterz@infradead.org" <peterz@infradead.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"ak@linux.intel.com" <ak@linux.intel.com>,
"riel@redhat.com" <riel@redhat.com>,
"keescook@google.com" <keescook@google.com>,
"gnomes@lxorguk.ukuu.org.uk" <gnomes@lxorguk.ukuu.org.uk>,
"pjt@google.com" <pjt@google.com>,
"dave.hansen@intel.com" <dave.hansen@intel.com>,
"luto@amacapital.net" <luto@amacapital.net>,
"jikos@kernel.org" <jikos@kernel.org>,
"gregkh@linux-foundation.org" <gregkh@linux-foundation.org>
Subject: Re: [PATCH v6 11/10] x86/retpoline: Avoid return buffer underflows on context switch
Date: Tue, 09 Jan 2018 00:42:25 +0000 [thread overview]
Message-ID: <1515458545.4423.76.camel@infradead.org> (raw)
In-Reply-To: <CA+55aFztN+nGBnb1Wjvygvgkg2MfN9m88egsostaNJ5LoSQx7A@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1717 bytes --]
On Mon, 2018-01-08 at 16:35 -0800, Linus Torvalds wrote:
> On Mon, Jan 8, 2018 at 3:58 PM, Woodhouse, David <dwmw@amazon.co.uk> wrote:
> >>
> >> Is there really nothing more clever we can do?
> >
> > You get this part in the IBRS/microcode solution too. The IBRS MSR
> > doesn't catch everything; you still need to stuff the RSB in very
> > similar places (and/or use the IBPB MSR in some).
>
> So I was really hoping that in places like context switching etc, we'd
> be able to instead effectively kill off any exploits by clearing
> registers.
>
> That should make it pretty damn hard to then find a matching "gadget"
> that actually does anything interesting/powerful.
>
> Together with Spectre already being pretty hard to take advantage of,
> and the eBPF people making those user-proivided gadgets inaccessible,
> it really should be a pretty powerful fix.
Hm... on a context switch you're reloading the registers that were in
the other saved context. If the attacker does something they know will
go into a deep call stack and then sleep, and they pollute the BTB for
every 'ret' instruction in that stack¹, then the registers at the time
a 'ret' goes AWOL are not necessarily something you can 'clear' at the
time of the context switch.
And yes, a lot of this v2 stuff down past the sys_call_table branch
really *is* pretty damn hard already, especially the 'ret' based ones.
¹ perhaps they do the BTB-pollution in their other CPU-hogging thread
that runs on the same CPU when the attack thread is sleeping? I'm not
really trying to actually write an attack here, just thinking out
loud and being uncertain that you've actually proved there *isn't*
one :)
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5213 bytes --]
next prev parent reply other threads:[~2018-01-09 0:42 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-07 22:11 [PATCH v6 00/10] Retpoline: Avoid speculative indirect calls in kernel David Woodhouse
2018-01-07 22:11 ` [PATCH v6 01/10] x86/retpoline: Add initial retpoline support David Woodhouse
2018-01-08 10:45 ` Peter Zijlstra
2018-01-08 10:53 ` David Woodhouse
2018-01-08 11:03 ` Peter Zijlstra
2018-01-08 12:45 ` David Woodhouse
2018-01-08 13:42 ` Josh Poimboeuf
2018-01-08 13:46 ` Thomas Gleixner
2018-01-08 13:53 ` Josh Poimboeuf
2018-01-08 14:26 ` David Woodhouse
2018-01-08 21:20 ` Josh Poimboeuf
2018-01-09 12:36 ` Peter Zijlstra
2018-01-09 13:35 ` Thomas Gleixner
2018-01-09 13:40 ` Woodhouse, David
2018-01-07 22:11 ` [PATCH v6 02/10] x86/retpoline/crypto: Convert crypto assembler indirect jumps David Woodhouse
2018-01-08 13:49 ` Josh Poimboeuf
2018-01-07 22:11 ` [PATCH v6 03/10] x86/retpoline/entry: Convert entry " David Woodhouse
2018-01-07 22:11 ` [PATCH v6 04/10] x86/retpoline/ftrace: Convert ftrace " David Woodhouse
2018-01-07 22:11 ` [PATCH v6 05/10] x86/retpoline/hyperv: Convert " David Woodhouse
2018-01-07 22:11 ` [PATCH v6 06/10] x86/retpoline/xen: Convert Xen hypercall " David Woodhouse
2018-01-07 22:11 ` [PATCH v6 07/10] x86/retpoline/checksum32: Convert assembler " David Woodhouse
2018-01-07 22:11 ` [PATCH v6 08/10] x86/retpoline/irq32: " David Woodhouse
2018-01-07 22:11 ` [PATCH v6 09/10] x86/retpoline: Add boot time option to disable retpoline David Woodhouse
2018-01-07 22:11 ` [PATCH v6 10/10] x86/retpoline: Exclude objtool with retpoline David Woodhouse
2018-01-08 10:25 ` Thomas Gleixner
2018-01-08 10:34 ` Woodhouse, David
2018-01-08 13:20 ` Josh Poimboeuf
2018-01-07 22:22 ` [PATCH v6 00/10] Retpoline: Avoid speculative indirect calls in kernel Linus Torvalds
2018-01-08 10:01 ` Thomas Gleixner
2018-01-08 17:54 ` Ingo Molnar
2018-01-08 21:10 ` Thomas Gleixner
2018-01-08 10:34 ` Paul Turner
2018-01-08 10:38 ` Jiri Kosina
2018-01-08 10:45 ` Paul Turner
2018-01-08 10:42 ` Paul Turner
2018-01-08 11:16 ` Andrew Cooper
2018-01-08 11:25 ` Paul Turner
2018-01-08 16:13 ` Alexei Starovoitov
2018-01-10 15:20 ` Woodhouse, David
2018-01-10 15:31 ` Dr. David Alan Gilbert
2018-01-08 10:45 ` David Woodhouse
2018-01-08 10:53 ` Paul Turner
2018-01-08 12:49 ` David Woodhouse
2018-01-08 23:44 ` [PATCH v6 11/10] x86/retpoline: Avoid return buffer underflows on context switch David Woodhouse
2018-01-08 23:56 ` Linus Torvalds
2018-01-08 23:58 ` Woodhouse, David
2018-01-09 0:35 ` Linus Torvalds
2018-01-09 0:42 ` David Woodhouse [this message]
2018-01-09 0:48 ` Linus Torvalds
2018-01-09 0:55 ` David Woodhouse
2018-01-09 0:44 ` Andi Kleen
2018-01-09 0:58 ` Linus Torvalds
2018-01-09 1:15 ` Andrew Cooper
2018-01-09 3:27 ` Andy Lutomirski
2018-01-09 13:04 ` David Woodhouse
2018-01-09 13:10 ` Peter Zijlstra
2018-01-09 17:53 ` Kees Cook
2018-01-09 18:09 ` Linus Torvalds
2018-02-16 8:58 ` Pavel Machek
2018-01-09 1:16 ` Andi Kleen
2018-01-09 1:21 ` [PATCH v6 11/10] x86/retpoline: Avoid return buffer underflows on context switch II Andi Kleen
2018-01-09 1:23 ` Woodhouse, David
2018-01-09 1:49 ` Andi Kleen
2018-01-09 1:53 ` Paul Turner
2018-01-09 1:18 ` [PATCH v6 11/10] x86/retpoline: Avoid return buffer underflows on context switch Woodhouse, David
2018-01-09 0:06 ` Andi Kleen
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=1515458545.4423.76.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=ak@linux.intel.com \
--cc=dave.hansen@intel.com \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=gregkh@linux-foundation.org \
--cc=jikos@kernel.org \
--cc=keescook@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=riel@redhat.com \
--cc=tglx@linutronix.de \
--cc=tim.c.chen@linux.intel.com \
--cc=torvalds@linux-foundation.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
Powered by JetHome