Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3269269ybi; Sun, 14 Jul 2019 10:13:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/u847OZiFU7hu6tBfmxUvNg5OlfHYHwyVSPt4T0j9gNVpmPmUjC0rIQr2D60BW/+tIG+g X-Received: by 2002:a63:124a:: with SMTP id 10mr22348338pgs.254.1563124388635; Sun, 14 Jul 2019 10:13:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563124388; cv=none; d=google.com; s=arc-20160816; b=F4NQowYl8krp9eyMDR6I6H4+/XAJrSoOe4A76CTabUsrw9mNB205HuTOXw4xHn9SnB YORFmOX3lJzRVBrxNK7EBcUk4qbckLPlZ8sURfCyH0s0EOGSsTgc9mviJ76a9JUQG2tf MTjGhyf8QTE1970OR+l3a98vPH06Kk7PubjmhX1cmNPIXIjqSIZUzmuR+I3qnzj92HUo EvWkR3vMN0h5452miXC/fMWVLOCQrnSM7xQGkdzdZjkQw+7RkcRHFTHVsQluGPaoDEvW RurGTkDRfWRKzbOvlcxOm+ua2JaHE9bOQ/MNkLrOZ5LJgPEMbLESEJQ7gEJ2mh6X4ueh ejRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:subject:cc:to:from:date; bh=LXYhoAzIAko0pjuEZO6mefKeBSfRy4BP1eDO9GE2VDw=; b=nBuLZFfotffcK4M4FBUTIftG09QEe9fgWHXfeXCo1DKvLVwHZrulALvD+qi5PjTfrn 89nwxAqz/n3u+fbCNhxIZSnZY4j+Sg7SAabts/v/7E0ucC0nJg7bseDEKbc0ykHx2JrS NEP1phunotLwRqCggMERi9XIHRBCsZxLkuNfYpxt3M/KEsyPJLtEtwpGL8UWN37bRX4N JjRgol4vk4X5rq279EkK6/qKNlxj16Ks9UtixqFqMnI61J6M+A4rtmYzeASTi+sjuWqC z2KaOt7QboI7aZDLSPEIsI/e06GmBD7XttI9cfAKUKry0Yrkvp80dIVziSkPKh6Nj3V0 TBOw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si740932pfe.271.2019.07.14.10.12.47; Sun, 14 Jul 2019 10:13:08 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728624AbfGNRLo (ORCPT + 99 others); Sun, 14 Jul 2019 13:11:44 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:13068 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728125AbfGNRLo (ORCPT ); Sun, 14 Jul 2019 13:11:44 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6EH6qGe088209 for ; Sun, 14 Jul 2019 13:11:42 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2tqvwrkm0w-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 14 Jul 2019 13:11:42 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 14 Jul 2019 18:11:40 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 14 Jul 2019 18:11:34 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6EHBXm638994046 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 14 Jul 2019 17:11:33 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3AE1211C052; Sun, 14 Jul 2019 17:11:33 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 22C2C11C04C; Sun, 14 Jul 2019 17:11:31 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.204.136]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Sun, 14 Jul 2019 17:11:31 +0000 (GMT) Date: Sun, 14 Jul 2019 20:11:29 +0300 From: Mike Rapoport To: Andy Lutomirski Cc: Alexandre Chartre , 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 Subject: Re: [RFC v2 00/27] Kernel Address Space Isolation 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> <7FDF08CB-A429-441B-872D-FAE7293858F5@amacapital.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7FDF08CB-A429-441B-872D-FAE7293858F5@amacapital.net> User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 19071417-0008-0000-0000-000002FD2B05 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071417-0009-0000-0000-0000226A9A79 Message-Id: <20190714171127.GA15645@rapoport-lnx> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-07-14_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907140213 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 12, 2019 at 10:45:06AM -0600, Andy Lutomirski wrote: > > > > On Jul 12, 2019, at 10:37 AM, Alexandre Chartre wrote: > > > > > > > >> 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: > >>>> > >>>> I think that's precisely what makes ASI and PTI different and independent. > >>>> PTI is just about switching between userland and kernel page-tables, while > >>>> ASI is about switching page-table inside the kernel. You can have ASI without > >>>> having PTI. You can also use ASI for kernel threads so for code that won't > >>>> be triggered from userland and so which won't involve PTI. > >>> > >>> 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). > >>> > >>> See how very similar they are? > >>> > >>> 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. > >>> > >>> 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. > >>> > >>> But looking at it that way, it makes no sense to retain 3 address > >>> spaces, namely: > >>> > >>> user / kernel exposed / kernel private. > >>> > >>> 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. > >>> > >>> And then we've fully replaced PTI. > >>> > >>> 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. > > > > If we expose more parts of the kernel mapping by adding them to the existing > > user (PTI) map, then we only control the mapping of kernel sensitive data but > > we don't control user mapping (with ASI, we exclude all user mappings). > > > > How would you control the mapping of userland sensitive data and exclude them > > from the user map? > > As I see it, if we think part of the kernel is okay to leak to VM guests, > then it should think it’s okay to leak to userspace and versa. At the end > of the day, this may just have to come down to an administrator’s 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’s not really the intent of my suggestion. I was suggesting that > maybe we don’t need ASI at all if we allow VMs to exclude their memory > from the kernel mapping entirely. Heck, in a setup like this, we can > maybe even get away with turning PTI off under very, very controlled > circumstances. I’m not quite sure what to do about the kernel random > pools, though. I think KVM already allows excluding VMs memory from the kernel mapping with the "new guest mapping interface" [1]. The memory managed by the host can be restricted with "mem=" and KVM maps/unmaps the guest memory pages only when needed. It would be interesting to see if /dev/xpfo or even madvise(MAKE_MY_MEMORY_PRIVATE) can be made useful for multi-tenant container hosts. [1] https://lore.kernel.org/lkml/1548966284-28642-1-git-send-email-karahmed@amazon.de/ -- Sincerely yours, Mike.