Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965189AbeALSqC (ORCPT + 1 other); Fri, 12 Jan 2018 13:46:02 -0500 Received: from mga09.intel.com ([134.134.136.24]:23886 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964967AbeALSqB (ORCPT ); Fri, 12 Jan 2018 13:46:01 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,350,1511856000"; d="scan'208";a="10788265" From: Andi Kleen To: tglx@linutronix.de Cc: x86@kernel.org, dwmw@amazon.co.uk, 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: Improve retpoline for Skylake Date: Fri, 12 Jan 2018 10:45:46 -0800 Message-Id: <20180112184550.6573-1-andi@firstfloor.org> X-Mailer: git-send-email 2.14.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: [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. Git tree at git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc.git spec/skl-rsb-3 Against current tip/x86/pti v1: Initial post, but containing some patches posted earlier, but reworked.