mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Andi Kleen <andi@firstfloor.org>, tglx@linutronix.de
Cc: x86@kernel.org, linux-kernel@vger.kernel.org, pjt@google.com,
	torvalds@linux-foundation.org, gregkh@linux-foundation.org,
	peterz@infradead.org, luto@amacapital.net,
	thomas.lendacky@amd.com, arjan.van.de.ven@intel.com
Subject: Re: Improve retpoline for Skylake
Date: Fri, 12 Jan 2018 19:12:53 +0000	[thread overview]
Message-ID: <1515784373.22302.492.camel@infradead.org> (raw)
In-Reply-To: <20180112184550.6573-1-andi@firstfloor.org>

[-- Attachment #1: Type: text/plain, Size: 1259 bytes --]

On Fri, 2018-01-12 at 10:45 -0800, Andi Kleen wrote:
> [This is an alternative to David's earlier patch to only
> handle context switch. It handles more cases.]
> 
> Skylake needs some additional protections over plain RETPOLINE
> for Spectre_v2.
> 
> The CPU can fall back to the potentially poisioned indirect branch
> predictor when the return buffer underflows.
> 
> This patch kit extends RETPOLINE to guard against many (but not
> all) of such cases by filling the return buffer.
> 
> - Context switch when switching from shallow to deeper call chain
> - Idle which clears the return buffer
> - Interrupts which cause deep call chains
> 
> This is done with a new SPECTRE_V2 defense mode and feature flag.
> 
> The mitigations are only enabled on Skylake, patched out
> on other CPUs.

Thanks for exploring what it would take to do this.

I admit I'm still not convinced. I think Skylake should probably just
default to IBRS (since the performance doesn't suck *quite* as much
there as it does on earlier CPUs) or give the user a command-line
option to use retpoline with the RSB-stuffing that is already
implemented.

Skylake still loses if it takes an SMI, right? Or encounters a call
stack of more than 16 in depth?


[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5213 bytes --]

  parent reply	other threads:[~2018-01-12 19:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12 18:45 Andi Kleen
2018-01-12 18:45 ` [PATCH 1/4] x86/retpoline: Add new mode RETPOLINE_UNDERFLOW Andi Kleen
2018-01-12 22:13   ` Dominik Brodowski
2018-01-12 22:57     ` Andi Kleen
2018-01-12 18:45 ` [PATCH 2/4] x86/retpoline: Avoid return buffer underflows on context switch Andi Kleen
2018-01-12 18:45 ` [PATCH 3/4] x86/retpoline: Fill return buffer after idle Andi Kleen
2018-01-12 18:45 ` [PATCH 4/4] x86/retpoline: Fill return buffer on interrupt return to kernel Andi Kleen
2018-01-12 19:12 ` David Woodhouse [this message]
2018-01-12 19:21   ` Improve retpoline for Skylake Andi Kleen
2018-01-12 22:03     ` Henrique de Moraes Holschuh
2018-01-15  8:26       ` Jon Masters
2018-01-15  9:06         ` David Woodhouse
2018-01-15 10:03         ` Thomas Gleixner
2018-01-15 10:20           ` David Woodhouse
2018-01-15 16:57         ` Andy Lutomirski
2018-01-15 17:38           ` Andrew Cooper
2018-01-15 17:56             ` Van De Ven, Arjan
2018-01-15 18:06             ` Andy Lutomirski
2018-01-15 18:07               ` David Woodhouse
2018-01-15 18:10                 ` Andy Lutomirski

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=1515784373.22302.492.camel@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=andi@firstfloor.org \
    --cc=arjan.van.de.ven@intel.com \
    --cc=gregkh@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --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

all inboxes | Powered by JetHome®