[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1515078768.12987.134.camel@amazon.co.uk>
Date: Thu, 4 Jan 2018 15:12:48 +0000
From: "Woodhouse, David" <dwmw@...zon.co.uk>
To: Juergen Gross <jgross@...e.com>, <ak@...ux.intel.com>
CC: Paul Turner <pjt@...gle.com>, LKML <linux-kernel@...r.kernel.org>,
"Linus Torvalds" <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...ux-foundation.org>,
Tim Chen <tim.c.chen@...ux.intel.com>,
"Dave Hansen" <dave.hansen@...el.com>, <tglx@...utronix.de>,
Kees Cook <keescook@...gle.com>,
Rik van Riel <riel@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Andy Lutomirski <luto@...capital.net>,
Jiri Kosina <jikos@...nel.org>, <gnomes@...rguk.ukuu.org.uk>
Subject: Re: [PATCH v3 10/13] x86/retpoline/pvops: Convert assembler
indirect jumps
On Thu, 2018-01-04 at 16:02 +0100, Juergen Gross wrote:
> On 04/01/18 15:37, David Woodhouse wrote:
> > Convert pvops invocations to use non-speculative call sequences, when
> > CONFIG_RETPOLINE is enabled.
> >
> > There is scope for future optimisation here — once the pvops methods are
> > actually set, we could just turn the damn things into *direct* jumps.
> > But this is perfectly sufficient for now, without that added complexity.
>
> I don't see the need to modify the pvops calls.
>
> All indirect calls are replaced by either direct calls or other code
> long before any user code is active.
Ah, that's useful feedback. I confess the whole pvops thing was making
my brain hurt, and I'm pleased I can finally post it a bit more widely
and get people to look at it :)
However... there is a school of thought which says that "before any
user code is active" is not the important criterion.
The argument is that on if the kernel is running in a VM, and another
hostile VM is running on a hyperthread sibling, then that other VM can
still control the branch prediction. That's why !MODULE __init
functions are no longer marked with __attribute__((noretpoline)) as
they were in my first patch set.
I've never really bought that argument, mind you — counter-arguments
include the observation that the hypervisor bloody well ought to be
setting STIPB in that case, and that the victim kernel won't have any
interesting data to *read* until it starts executing user code anyway.
But it's been made.
Note that there are still a handful of *other* unprotected indirect
branches in the startup sequence, which would need to be protected if
we're going to accept the argument above.
Download attachment "smime.p7s" of type "application/x-pkcs7-signature" (5210 bytes)
Powered by blists - more mailing lists