Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4071387pxb; Tue, 17 Nov 2020 10:28:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzVvfoHPsqx3xmTKOcG9P7/fZtI4s21LJDFqvBrzB0O49I0AEKLZGUbTACtecBNA1p+InST X-Received: by 2002:a17:907:c14:: with SMTP id ga20mr20172610ejc.526.1605637683499; Tue, 17 Nov 2020 10:28:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605637683; cv=none; d=google.com; s=arc-20160816; b=Vb2E+xospNqUihWM3ACy0qhF3vASR/byRKvTvzZsUHw4ymc9mn+l4sGlp5U6VrqwVx gbDbGgk8l6qcYsygRuadSZ9PU6eWunt7UkDSgRTvbthmphs7DhQwuOwlehXGy/o2sS9S khNEvPZNu7GMGUsy1LbVJT8rqdJn52PNci4K4UVBAmrJWMEby6T2yeL/9vEP2YxN8uPa ytl9erjzMoBoT3XtgP8RDbkeFIoXD5HQvJTyJyd6NrhemKCH92SaJ9roNVwllnVKui9f XQm8WdQ5GFo5wk6G+rUQa84cNMc04WLj4mqf2peuJNaPBu1S7hJAduxzwIzo9LaZk9iM sPCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=RkdMEuojSc3ehI93FYso5qdeBe0QJXljLV+GT8Oxri0=; b=nfeSyk0QmlQCEUkekB2DM6Iq3AHFhxb1Z2KM4LaFQyiXQF819KyYVtRblG//a62MzV 5VBsbc4OpXoS1p0OkYqVzItYz3d6WjZCpePmS3i1znm5m0W3flJGm3E8c/2TRXCMYVDa OQeQAXKNs5ha98/0kLmH9NY3aEpSn9j7vdHYIbn/nafkp15jnLD0FUM2nnfGfFssyxKt DJiWamcQNZNldiMMp6qGpZaVsCzG4jwmm46dOFmWbPJiblk8Ez05sA5kfQHaMtMWj7xF Gz6qCPXZ/n8l7RFhhJNRWf69tI3kikHfNbrK7rNmxY5Smv2IvD8HmCx+4Vb9k+dnlDS8 K1qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=PeCpF2Kh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f5si2235048edt.134.2020.11.17.10.27.39; Tue, 17 Nov 2020 10:28:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=PeCpF2Kh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731055AbgKQSZM (ORCPT + 99 others); Tue, 17 Nov 2020 13:25:12 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:36760 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729614AbgKQSZM (ORCPT ); Tue, 17 Nov 2020 13:25:12 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AHIONmV157259; Tue, 17 Nov 2020 18:24:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=RkdMEuojSc3ehI93FYso5qdeBe0QJXljLV+GT8Oxri0=; b=PeCpF2KhTnT5f+gX4ks0Xn0sriEnHFFqBrf9sIKN7oMJLmdHJx5LCITUriPIF56pijzK iUXdJ14xf9GI6Rmau+u1KONVtut3AifvqG4E1aokuEmuN4GVRAUjikt5/gLWgyhrKedi CpSODOnRbSg76hXJB+8Ibh/NogEuW1vHKuUPIXEMW6cVqIUBpnuVhq6S48TmaKkyI35r ObGl/MrDiCIPRGfFduKV7D8Xs6Wi9jIMgnkf0a2Ppt5kIbMu/pScwnV44TlHccQ+WNaP NiNADORsnvIz9HkxCbYHB/mNGVNKqR8AKcguUIm+bIkQcPca7bJCG0osoKJlTxboYBWm rw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 34t76kv4av-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 17 Nov 2020 18:24:25 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AHI9auK066259; Tue, 17 Nov 2020 18:22:25 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 34usptrcfp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Nov 2020 18:22:25 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0AHIMN5X031425; Tue, 17 Nov 2020 18:22:23 GMT Received: from linux.home (/92.157.91.83) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 17 Nov 2020 10:22:22 -0800 Subject: Re: [RFC][PATCH v2 00/21] x86/pti: Defer CR3 switch to C code To: Borislav Petkov Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, linux-kernel@vger.kernel.org, thomas.lendacky@amd.com, jroedel@suse.de, konrad.wilk@oracle.com, jan.setjeeilers@oracle.com, junaids@google.com, oweisse@google.com, rppt@linux.vnet.ibm.com, graf@amazon.de, mgross@linux.intel.com, kuzuno@gmail.com References: <20201116144757.1920077-1-alexandre.chartre@oracle.com> <20201116202426.GF1131@zn.tnic> <692599af-53c8-7881-2bc7-8898085400cd@oracle.com> <20201117170735.GH5719@zn.tnic> From: Alexandre Chartre Message-ID: <14f4a09c-361c-2110-f2e8-e2465076ab5b@oracle.com> Date: Tue, 17 Nov 2020 19:24:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20201117170735.GH5719@zn.tnic> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9808 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 mlxscore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011170132 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9808 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 adultscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 mlxlogscore=999 malwarescore=0 mlxscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011170133 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/17/20 6:07 PM, Borislav Petkov wrote: > On Tue, Nov 17, 2020 at 09:19:01AM +0100, Alexandre Chartre wrote: >> We are not reversing PTI, we are extending it. > > You're reversing it in the sense that you're mapping more kernel memory > into the user page table than what is mapped now. > >> PTI removes all kernel mapping from the user page-table. However there's >> no issue with mapping some kernel data into the user page-table as long as >> these data have no sensitive information. > > I hope that is the case. > >> Actually, PTI is already doing that but with a very limited scope. PTI adds >> into the user page-table some kernel mappings which are needed for userland >> to enter the kernel (such as the kernel entry text, the ESPFIX, the >> CPU_ENTRY_AREA_BASE...). >> >> So here, we are extending the PTI mapping so that we can execute more kernel >> code while using the user page-table; it's a kind of PTI on steroids. > > And this is what bothers me - someone else might come after you and say, > but but, I need to map more stuff into the user pgt because I wanna do > X... and so on. Agree, any addition should be strictly checked. I have been careful to expand it to the minimum I needed. >> The minimum size would be 1 page (4KB) as this is the minimum mapping size. >> It's certainly enough for now as the usage of the PTI stack is limited, but >> we will need larger stack if we won't to execute more kernel code with the >> user page-table. > > So on a big machine with a million tasks, that's at least a million > pages more which is what, ~4 Gb? > > There better be a very good justification for the additional memory > consumption... Yeah, adding a per-task allocation is my main concern, hence this RFC. alex.