Received: by 10.223.185.116 with SMTP id b49csp1037439wrg; Fri, 16 Feb 2018 11:14:51 -0800 (PST) X-Google-Smtp-Source: AH8x226s+oMSOYRFbsq4rIwMYn1O49ywXz8m/vhiQQiKa/gaovHZUpkiSBdpjvBlbELxl5ME2HMX X-Received: by 10.101.93.71 with SMTP id e7mr742768pgt.248.1518808491769; Fri, 16 Feb 2018 11:14:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518808491; cv=none; d=google.com; s=arc-20160816; b=M9atodFBUbPRZ1HnFDWrpaJZqWqeljbQRzdiPXdKox1w3a/FBCAPGQokHkrTwSea80 NRa3ZrJOmls2EuKQzx82Yh4O0zg7qh+bA69ZobvfCe9NoqAjunY1nuonbn7/4u4HI86Z xbQtOWQPbcpOPx/LtELyaAYL7vXclQ+COWO1Tw7A3dpEEuDO/0LSJL1gUkRCWSkA4FT1 VLerMlG0EtcVBnF3d5WPGzpK3Hk7jnRuXrRr1iI/VpGCOqUBpNE/Zy35B3lQKzFIiiDW 3RDx1elSblJmdy0gapNhs3lCuFjBcHtp02AT9m0CCVcrl7jfPot1oAvqDq7InJWjhwj/ zsIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=QjDV0zdorrazYrJUWh+W9vmXGfdo8ZK2t/Ip+F/hrcg=; b=B1q+3LkrBHp/YxXeA57Hvxtiw+NDnEIXeSI9JA4ORlS+dHbY4+E54GP5fwPZPd/hLA Oq6ajWCRxKh9hj58is6vAvWrDBcrHVqLUYrMgSQhp6TvtEdwon1P6iYnd0hWvmPKP0Zo IErVSvWOqZglzjwcwVLN8/gf2cvTCWjGUNv/uoGd8RFx1ehkwQGNl5hdbg+ArUwOVxdc 1x2H+5pH7OjdS2qIEkeHr8g9F02d+x1g7Y2MCpIjJ7s0DVHe31qJuoHEzc35qOvEqRG0 EjEQ57n0chTDRBPUc6tec5J7kTGQVmCIKJAArqlYazous8x159GzqRnfUREs7RWlkd2a ULnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=PPe6y1PF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 71-v6si222390plc.713.2018.02.16.11.14.36; Fri, 16 Feb 2018 11:14:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=PPe6y1PF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754764AbeBPPUR (ORCPT + 99 others); Fri, 16 Feb 2018 10:20:17 -0500 Received: from mail-pg0-f41.google.com ([74.125.83.41]:34142 "EHLO mail-pg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752192AbeBPPUQ (ORCPT ); Fri, 16 Feb 2018 10:20:16 -0500 Received: by mail-pg0-f41.google.com with SMTP id m19so2654040pgn.1 for ; Fri, 16 Feb 2018 07:20:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=QjDV0zdorrazYrJUWh+W9vmXGfdo8ZK2t/Ip+F/hrcg=; b=PPe6y1PFmvxB6vf3fseq8bBhFNkG6c3V+CLiGK2nWIJHjkg92Z0SP4d3oCGNGZi7vw TZqAm/rdKEl2y3aqwE0mk0f+H6VvDlgOl8Nkam2pdLYUzJ2lEPrYHt58tok4DrMouSVH 0LaSmW49DNmkfwUpYfVezZtcJU6IfYSkof7IskhbPr/P53n0DZbwIHY+nzDDG6UeM1oD tZ//iBLaAK0NYkb4mJAORJqYrADo/dc1D5hfWkPoE0/8clC6T3iwHZ2Xa4B0w7emqQh0 QXDZsQJBfvRr1AM2s6rgJwVa9EHd9EC/OrPZJ3nvUkl3Ut2w5A/0AQ28E6BbyQlbsRp2 nmng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=QjDV0zdorrazYrJUWh+W9vmXGfdo8ZK2t/Ip+F/hrcg=; b=t+afMLF2TbGpeQQX/ULKrTOhNpLTwpwunTvr0fdNdgWk9eXOWd9yAKcSSHLfsRTgex VMhfB/G4iSq7TbW8yaCEb5pqLtGqQv41M6fAhiHWCE+3X4E9O4PNzEiWz4HP2BpEuF74 3TWsh9Wv0Xiev7whNdIT/pHb7n66GJ7CpCtzGWS3tGhYbWuwuKJ2ucZONoLbFqBU40k5 p5UIwkZUua+lIOtPSnM2tc67eD+7iMGZDA6KLPaiaDv4qU0wEOGaj+UyJgtUKUTWaL+i Ae29oHt2S9X590Ewc51YAprjPfF57Ce/rFj47EiS5rwHAqjFKZt2WaaFe5Vqy/m5ziIi TX+w== X-Gm-Message-State: APf1xPCnxIKyqhSU+AgBpHsgrcVjC5YyYQjLVdVKSB9By5tyWUMy8NA2 AVFaiwpYl7syi4YDkOYRnfl3bA== X-Received: by 10.98.113.67 with SMTP id m64mr6394067pfc.223.1518794415228; Fri, 16 Feb 2018 07:20:15 -0800 (PST) Received: from ?IPv6:2601:646:c200:7429:c560:c8ff:3103:fad9? ([2601:646:c200:7429:c560:c8ff:3103:fad9]) by smtp.gmail.com with ESMTPSA id c23sm44508263pfc.172.2018.02.16.07.20.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Feb 2018 07:20:14 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: [PATCH RFC v2 4/6] x86: Disable PTI on compatibility mode From: Andy Lutomirski X-Mailer: iPhone Mail (15D60) In-Reply-To: Date: Fri, 16 Feb 2018 07:20:13 -0800 Cc: Andy Lutomirski , Nadav Amit , Pavel Emelyanov , Cyrill Gorcunov , Ingo Molnar , Thomas Gleixner , Peter Zijlstra , Dave Hansen , Willy Tarreau , X86 ML , LKML Content-Transfer-Encoding: quoted-printable Message-Id: References: <20180215163602.61162-1-namit@vmware.com> <20180215163602.61162-5-namit@vmware.com> <9EB804CA-0EC9-4CBB-965A-F3C8520201E7@gmail.com> To: Linus Torvalds Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> On Feb 15, 2018, at 4:08 PM, Linus Torvalds wrote: >>=20 >> On Thu, Feb 15, 2018 at 3:29 PM, Andy Lutomirski wrote:= >>=20 >> It's possible we could get away with adding the prctl but making the >> default be that only the bitness that matches the program being run is >> allowed. After all, it's possible that CRIU is literally the only >> program that switches bitness using the GDT. (DOSEMU2 definitely does >> cross-bitness stuff, but it uses the LDT as far as I know.) And I've >> never been entirely sure that CRIU fully counts toward the Linux >> "don't break ABI" guarantee. >=20 > Ugh. >=20 > There are just _so_ many reasons to dislike that. >=20 > It's not that I don't think we could try to encourage it, but this > whole "security depends on it being in sync" seems really like a > fundamentally bad design. If we're going to do Nadav's thing, I think we have no choice. We could say= that Nadav's idea of turning off PTI for 32-bit is just too messy, though. >=20 >> Linus, how would you feel about, by default, preventing 64-bit >> programs from long-jumping to __USER32_CS and vice versa? >=20 > How? It's a standard GDT entry. Are you going to start switching the > GDT around every context switch? That's the idea. We already switch out three GDT entries for TLS. Switchin= g two more isn't going to kill us. >=20 > I *thought* that user space can just do a far jump on its own. But > it's so long since I had to care that I may have forgotten all the > requirements for going between "compatibility mode" and real long > mode. >=20 > I just feel this all is a nightmare. I can see how you would want to > think that compatibility mode doesn't need PTI, but at the same time > it feels like a really risky move to do this. >=20 > I can see one thread being in compatibiilty mode, and another being in > long mode, and sharing the address space. But even with just one > thread, I'm not seeing how you keep user mode from going from > compatibility mode to L mode with just a far jump. >=20 > But maybe you have some clever scheme in mind that guarantees that > there are no issues, or maybe I've just forgotten all the details of > long mode vs compat mode. The clever scheme is that we have a new (maybe default) compat-and-i-mean-it= mode that removes the DPL=3D3 L code segment from the GDT and prevents oppo= rtunistic SYSRET.=