Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1103285ybi; Fri, 12 Jul 2019 09:46:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqwdwvZebxWUrvNqhJEFUXzdLWNzhkStwmc8TqM2wBJJrWVE2ZJPnYrALO3HBKvEzkwZcwlL X-Received: by 2002:a17:902:744c:: with SMTP id e12mr12406092plt.287.1562949983973; Fri, 12 Jul 2019 09:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562949983; cv=none; d=google.com; s=arc-20160816; b=ONZasNC52n4qRjo+Vd4/L/UKG8pwzIYWxpxBehn2Uzi3hxoJqnRtj0my4+N2Mhy2lc p4rz+KNX7s7S0+hJkzyP2IpYazvBc73NqD0ReITTKn/M82NQJR1o15KPeQHiD4VWCyKL 99pKbLA95m/baB+VF+tizyjWtfPs7EPr3H9BCJlw98lWfG/GUCW5hVT0UuPvn+mP7P0P cu+XPTzM535omNVkG9cV+0UBL0wBykDdg9RVGAwZH8oYYRGVrxBobVnUfklFB6H01s8X aow8eYovoEZjdmRLgirlVE9Qu8afKkxYaNSGmRJ4W265kZu1tfjBRztD5iMFNn//0SfO 9xUQ== 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; bh=6LnAzjOasKxUwXGzTNC0/064h+/s+kUgeRd8GGr+dNc=; b=HqAUurWSr/qx6KT42FZMyANtiznf3VAl+uqNnOM8Ju/V6iEMMTqapgWXF2N5j5i2GX jsYNgxUyTpdTRVli1Nk7EOK9DscpnrR+rmLsR8+gozqoWffjxrQi9Kih7By0pLNQbMxT R3yBQqDNE6SV++LzbHnoOXCSFridE3pR8rwSqNxhY8k2Orqhpk5PElOxZRwfouMmAwYR +Cnl8A6Zj3GVxHU9r5Ki0smDgdQtTGyNPZtfXEPwuTeI6fmUsf7CYUzXCSaTpWubKNJT HBKXBTYwFW0I+gxBKwga0fS5X4efZAEFjCJI7ZvMYWEiv3zxDepapPWbM8/mJQlbu860 xXzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=y+5Jhhgm; 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 v8si7941322plp.179.2019.07.12.09.46.07; Fri, 12 Jul 2019 09:46:23 -0700 (PDT) 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=y+5Jhhgm; 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 S1727356AbfGLQpL (ORCPT + 99 others); Fri, 12 Jul 2019 12:45:11 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:42262 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726449AbfGLQpK (ORCPT ); Fri, 12 Jul 2019 12:45:10 -0400 Received: by mail-oi1-f195.google.com with SMTP id s184so7739104oie.9 for ; Fri, 12 Jul 2019 09:45:09 -0700 (PDT) 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=6LnAzjOasKxUwXGzTNC0/064h+/s+kUgeRd8GGr+dNc=; b=y+5JhhgmNMeM1wyuwj/XzOeYCh3l6ziC7Q771WlrgOuxNGzdruLij0Bd0bIoG5jM3d Db3yFOQe9oJ72rqInCLv5IT5U/tzZ44PeQK0oBMW4m+IauKOslZy7IC+GgteBJcQrXLS w3h9o5dlT/8wb9rL46HzQKkWKfxY+n/JIPNZ9G2FZIINBpDbDTRFNRtcHxKDRJVpwEqH nipdZSzIaSUQBX0DYu19v+AM+C3QxQZUmy1qXgyaytK38F3Sv+yUnmfjmLiB7/oZYGXu 73n0iYnMYyaID7e2Y6q3kyCjzXOYqsuihAlcYX+2cpr0DFcDvSj1C1ys/nJkkUVByenh Fn4g== 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=6LnAzjOasKxUwXGzTNC0/064h+/s+kUgeRd8GGr+dNc=; b=ouKyA1pAyS5hBHfvW2RuIKLwB9/DN0L2UeQoXBN/jkiobJqmZAQv7KnDslNY4nfwFZ BPVpluDmBUgXF4I22PPGwF6u20yWIRFTtQowsK3WqF2KBeF+ydv0pzXNqYGZrxVuobPZ tB6YZ1FGBVnVOywED6POcNvuCrm3XQuywC6iyep/5CIBRKoG0de40sONTphszMEcvkvk QB0OQNqi/5qoqR5teTol9nKvCG5X8kDqxcgNB1jeOkXTI7zwxG8amnObP3SUOOVIClTV 1IV9N5uuFB6n8oyLcrjKQlaThhGoYq4AkOwrHEJxGOrl08GowSDzOmEIkTuGOytUae4S 2lOA== X-Gm-Message-State: APjAAAX29QdMt0Ld5eHKzn7g87GjmT2WE9IY7wDCorhiwdXHAhHwaubX NGZCf1eG1sHd7qBRhNm3KkrqFg== X-Received: by 2002:aca:cfd0:: with SMTP id f199mr6026297oig.50.1562949909275; Fri, 12 Jul 2019 09:45:09 -0700 (PDT) Received: from ?IPv6:2600:100e:b03e:b:3dba:7fb8:8988:ae37? ([2600:100e:b03e:b:3dba:7fb8:8988:ae37]) by smtp.gmail.com with ESMTPSA id l5sm3141381otf.53.2019.07.12.09.45.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jul 2019 09:45:08 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [RFC v2 00/27] Kernel Address Space Isolation From: Andy Lutomirski X-Mailer: iPhone Mail (16F203) In-Reply-To: <3ca70237-bf8e-57d9-bed5-bc2329d17177@oracle.com> Date: Fri, 12 Jul 2019 10:45:06 -0600 Cc: Thomas Gleixner , Peter Zijlstra , Dave Hansen , pbonzini@redhat.com, rkrcmar@redhat.com, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, kvm@vger.kernel.org, x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, konrad.wilk@oracle.com, jan.setjeeilers@oracle.com, liran.alon@oracle.com, jwadams@google.com, graf@amazon.de, rppt@linux.vnet.ibm.com, Paul Turner Content-Transfer-Encoding: quoted-printable Message-Id: <7FDF08CB-A429-441B-872D-FAE7293858F5@amacapital.net> References: <1562855138-19507-1-git-send-email-alexandre.chartre@oracle.com> <5cab2a0e-1034-8748-fcbe-a17cf4fa2cd4@intel.com> <61d5851e-a8bf-e25c-e673-b71c8b83042c@oracle.com> <20190712125059.GP3419@hirez.programming.kicks-ass.net> <3ca70237-bf8e-57d9-bed5-bc2329d17177@oracle.com> To: Alexandre Chartre Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jul 12, 2019, at 10:37 AM, Alexandre Chartre wrote: >=20 >=20 >=20 >> On 7/12/19 5:16 PM, Thomas Gleixner wrote: >>> On Fri, 12 Jul 2019, Peter Zijlstra wrote: >>>> On Fri, Jul 12, 2019 at 01:56:44PM +0200, Alexandre Chartre wrote: >>>>=20 >>>> I think that's precisely what makes ASI and PTI different and independe= nt. >>>> PTI is just about switching between userland and kernel page-tables, wh= ile >>>> ASI is about switching page-table inside the kernel. You can have ASI w= ithout >>>> having PTI. You can also use ASI for kernel threads so for code that wo= n't >>>> be triggered from userland and so which won't involve PTI. >>>=20 >>> PTI is not mapping kernel space to avoid speculation= crap (meltdown). >>> ASI is not mapping part of kernel space to avoid (different) speculation= crap (MDS). >>>=20 >>> See how very similar they are? >>>=20 >>> Furthermore, to recover SMT for userspace (under MDS) we not only need >>> core-scheduling but core-scheduling per address space. And ASI was >>> specifically designed to help mitigate the trainwreck just described. >>>=20 >>> By explicitly exposing (hopefully harmless) part of the kernel to MDS, >>> we reduce the part that needs core-scheduling and thus reduce the rate >>> the SMT siblngs need to sync up/schedule. >>>=20 >>> But looking at it that way, it makes no sense to retain 3 address >>> spaces, namely: >>>=20 >>> user / kernel exposed / kernel private. >>>=20 >>> Specifically, it makes no sense to expose part of the kernel through MDS= >>> but not through Meltdow. Therefore we can merge the user and kernel >>> exposed address spaces. >>>=20 >>> And then we've fully replaced PTI. >>>=20 >>> So no, they're not orthogonal. >> Right. If we decide to expose more parts of the kernel mappings then that= 's >> just adding more stuff to the existing user (PTI) map mechanics. >=20 > If we expose more parts of the kernel mapping by adding them to the existi= ng > user (PTI) map, then we only control the mapping of kernel sensitive data b= ut > we don't control user mapping (with ASI, we exclude all user mappings). >=20 > How would you control the mapping of userland sensitive data and exclude t= hem > from the user map? As I see it, if we think part of the kernel is okay to leak to VM guests, th= en it should think it=E2=80=99s okay to leak to userspace and versa. At the e= nd of the day, this may just have to come down to an administrator=E2=80=99s= choice of how careful the mitigations need to be. > Would you have the application explicitly identify sensitive > data (like Andy suggested with a /dev/xpfo device)? That=E2=80=99s not really the intent of my suggestion. I was suggesting that= maybe we don=E2=80=99t need ASI at all if we allow VMs to exclude their mem= ory from the kernel mapping entirely. Heck, in a setup like this, we can ma= ybe even get away with turning PTI off under very, very controlled circumsta= nces. I=E2=80=99m not quite sure what to do about the kernel random pools, t= hough.=