Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751563AbeADI1N (ORCPT + 1 other); Thu, 4 Jan 2018 03:27:13 -0500 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:6303 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750770AbeADI1L (ORCPT ); Thu, 4 Jan 2018 03:27:11 -0500 X-Amazon-filename: smime.p7s X-IronPort-AV: E=Sophos;i="5.45,506,1508803200"; d="p7s'?scan'208";a="325406905" Message-ID: <1515054014.12987.75.camel@amazon.co.uk> Subject: Re: Avoid speculative indirect calls in kernel To: Paolo Bonzini , Alan Cox CC: Linus Torvalds , Andi Kleen , , Greg Kroah-Hartman , Tim Chen , "Linux Kernel Mailing List" , Dave Hansen In-Reply-To: References: <20180103230934.15788-1-andi@firstfloor.org> <20180104015920.1ad7b9d3@alans-desktop> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAG1BMVEUHBwcUFBQpKSlGRkZhYWF9fX2Xl5eysrLMzMxFF+rXAAACaElEQVQ4y21UQXbbIBQE9wJALmAg6ToWON22FrhZthHgbvssUPathC7QWMful2JHSmtWwGg+zPxBCE0DU4QoJQgRgsg4w2gJjBNE8PjFBZgnQMBs+uZ1NQNQjZO3BV4AGDFC0f+l4DBG0VUAM4yv7SO8IgRdHXQ+A78HKL5OAeCfNQV5cHX8DsBUyIJKtYbt98BKaGNCKjfgFVkqYVLbkHKsRsbSCSa0T6npIqLrpRBgQKHUpQmgs9eEKaiUcooE8WWfCGVnBiUcn1uF2XhbfmN9apKnmMP2K4kizKkQWxuaVNOpU2cACIyxO1Po8ETHcXEDMVnozcejkAYA9iaD4pU0ZvNQ8VurNnTuFAYVtuIPUZW25PjDIjQAlGyffIiRQxoWAZBmJ0LTdW2Nyc0iP3DqRhxizvGJkBWZmyFVyZkddWzmBoIBVMpCCJ1CFzl98xav4VJKSSD45KbUT75ixikTphDSRh8+Uz7JLgUTAgAFwzqzjxc/nDY7WUApqY0OMdTwCKZSXplSKkgIRCHElCp8ZnhnKqXuwcNbk1L0VXE+I9alUXoHlLHl3mv7/dWQlJwtjREC7mu9L/U2jQyMUuO2EDS4q9Kl2ddm232bxIE5pjJuVwiljNn/Cfv25/T0cu5cZbwHGVq7h/zp0B4n3S99V/utD+Uo8BiGx9xCsOAV5z7/tjo4Z4z1Lvb90KZ7eFOoOeXOukqF2seo234YYuaQPpRP+cVZU5adT1Edun5Iz3z8fTz3+eSDh0Ip1c7zx1MaijGzTd/3MbRuBHz8cvcVgCMBRpOHvgu59WDhoat+nIZm+LWm9C/aaaGq5DCP9QAAAABJRU5ErkJggg== Organization: Amazon Content-Type: multipart/signed; micalg=sha-256; protocol="application/x-pkcs7-signature"; boundary="=-BAlhvLnkbbNaiI69+IYU" Date: Thu, 4 Jan 2018 08:20:14 +0000 X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 MIME-Version: 1.0 From: "Woodhouse, David" X-Evolution-Source: 1481217574.17989.4@uc8d3ff76b9bc5848a9cc Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: --=-BAlhvLnkbbNaiI69+IYU Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2018-01-04 at 03:11 +0100, Paolo Bonzini wrote: > On 04/01/2018 02:59, Alan Cox wrote: > >> But then, exactly because the retpoline approach adds quite some cruft > >> and leaves something to be desired, why even bother? > > > > Performance >=20 > Dunno.=C2=A0 If I care about mitigating this threat, I wouldn't stop at > retpolines even if the full solution has pretty bad performance (it's > roughly in the same ballpark as PTI).=C2=A0 But if I don't care, I wouldn= 't > want retpolines either, since they do introduce a small slowdown (10-20 > cycles per indirect branch, meaning that after a thousand such papercuts > they become slower than the full solution). >=20 > A couple manually written asm retpolines may be good as mitigation to > block the simplest PoCs (Linus may disagree), but patching the compiler, > getting alternatives right, etc. will take a while.=C2=A0 The only redeem= ing > grace of retpolines is that they don't require a microcode update, but > the microcode will be out there long before these patches are included > and trickle down to distros...=C2=A0 I just don't see the point in starti= ng > from retpolines or drawing the line there. No, really. The full mitigation with the microcode update and IBRS support is *slow*. Horribly slow. By using retpoline, we avoid the need to set IBRS on *every* entry into the kernel. It gives you *most* of that performance back. It's horrid, but it seems to be the best option we have. And in my original patch set, it goes away almost completely if it isn't being used. (Apart from the fact that your eyes may still bleed; I can't do anything about that. Sorry). --=-BAlhvLnkbbNaiI69+IYU Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Disposition: attachment; filename="smime.p7s" Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCCEE4w ggUuMIIEFqADAgECAhEApEtL31g6H7ROXdOiQnA9RjANBgkqhkiG9w0BAQsFADCBlzELMAkGA1UE BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxPTA7BgNVBAMTNENPTU9ETyBSU0EgQ2xpZW50IEF1dGhl bnRpY2F0aW9uIGFuZCBTZWN1cmUgRW1haWwgQ0EwHhcNMTcxMjIxMDAwMDAwWhcNMTgxMjIxMjM1 OTU5WjAiMSAwHgYJKoZIhvcNAQkBFhFkd213QGFtYXpvbi5jby51azCCASIwDQYJKoZIhvcNAQEB BQADggEPADCCAQoCggEBAKdGKgXuwKMg2r+i/4BZZC0ddRxNq3xIKTakie/VCSzoO7P17A36ZzUc VMEYPfqDt/65xoc6Tdih+qkY2pNDppZ1DZ8mVrAX6O2O60ZhmXB60wMoDvXPZInvkMOW4drqnje/ 7/NOypn/XQAY+ln4KT+3tHG3TfryyJFMedqC/r29KJlCeeCxIzdtq2j5mN42tvPVv4+p+Kr77uui GOASNdFJbNdgx7UGF+il6kRGSle17LJZKMgRiLJXYjECwnGwdfLdN5SINWD5IC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