Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3231504pxb; Mon, 16 Nov 2020 09:03:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwg+Lembu89Hyid6t/56YhioVb+oeQn9CW40NR8YH9PLlGVwo4bnKGYDKgWAZDkwlRjF7/k X-Received: by 2002:aa7:cc8f:: with SMTP id p15mr17764470edt.240.1605546186116; Mon, 16 Nov 2020 09:03:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605546186; cv=none; d=google.com; s=arc-20160816; b=YHOfhMnfel8Fe6V7qGiJhczv8YyT6E74Kw0Nw9dDwR1nTIQSFV0VXSyOf3UVm3+lYZ ea0Mwz4NJFWUoSP9b5NDpAMOVYj3Bt69IUx46ebqjRZlCwgFbFfbrlK3V6JSOC/OCO1n 9yABd0XIJo7Noa0JZdZlopN73XQQibEi3TCru9Xqm6rcNWiV1LBKLB2GVGggUuQngXe6 B766JNkEbDM7z3qKEcKhCPr0y+CeSBLD0Hrcmk4Dh1WdeiSDn7T4/kC+kKR+AoGC/4qE UDcKPnFvqyLuyhmxT1W0fqVV8xQq8nuaiJc56hz5vEjIpLD47YB5CgHw0gViZ/0XiKAu /vQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=LG0D62bJ+2Wp9dCLr6uNw6Hx9DfYfmBvaCuVDnYGtag=; b=wwW++g/iWDJvWMOeXzlUpPrmR7DY26PY0M1lEUIsei4ZoEpNEGQY1jL3+RELzbuED5 A4K8cyyuYY4pEhe2cnK/UK1Tj2UzG8DwH8+FmzpTi/xzKu3ohg7GrxdoDNsVXxuN8+bn 7BpzUTBypuqQ1efQNn4hRoXUhtWALEiN69IqLa/3WVhqwfnVETnpx6PxcdIog3DlNQMF G3vrj8Gf4k2KfmzanOvbmGocKyacrzfYHE65h7s5ba2juyHm+3baWKaE4n9c+Hn63dXV K7FVli0rgeKWbB92ugR0GJUSc1Iie56mkFkADUqQQETq1KuItlQPlisw/nXSgNp5N4cd jrGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="ioM/3kO6"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ho18si11963004ejc.19.2020.11.16.09.02.39; Mon, 16 Nov 2020 09:03:06 -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=@kernel.org header.s=default header.b="ioM/3kO6"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732378AbgKPQ6G (ORCPT + 99 others); Mon, 16 Nov 2020 11:58:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:36528 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730972AbgKPQ6G (ORCPT ); Mon, 16 Nov 2020 11:58:06 -0500 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BCE9720773 for ; Mon, 16 Nov 2020 16:58:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605545886; bh=KOGjRKPGbnzDzVIg9XNDhKJ8ongjL1ugga2Rlj6rxog=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ioM/3kO6hyROic0HWymF4H3Z4IRU8ib8PFiWVN0/NaINHj57JaWWngi8wall79DUl VKO4ovZkE8fxPuToWDDRsm2rX3NgPplnErCN9AMsLSgRcaZMnWJgIupEXumAAFiaRc 34ChdBq+L8j+M/phfBYo6U6u53oYHtc6She3stTU= Received: by mail-wr1-f45.google.com with SMTP id s8so19424181wrw.10 for ; Mon, 16 Nov 2020 08:58:05 -0800 (PST) X-Gm-Message-State: AOAM533M3tvYHQiW0A8A3WhWRTES2WcwI0Bqj0Hf8KAcl8EAmszuwpja WAuxwB0/Ebz1YWNdSUKBkfia9Lc6oKK/stUS0u4TcQ== X-Received: by 2002:a5d:49ce:: with SMTP id t14mr20060044wrs.75.1605545884456; Mon, 16 Nov 2020 08:58:04 -0800 (PST) MIME-Version: 1.0 References: <20201116144757.1920077-1-alexandre.chartre@oracle.com> <20201116144757.1920077-13-alexandre.chartre@oracle.com> In-Reply-To: <20201116144757.1920077-13-alexandre.chartre@oracle.com> From: Andy Lutomirski Date: Mon, 16 Nov 2020 08:57:51 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC][PATCH v2 12/21] x86/pti: Use PTI stack instead of trampoline stack To: Alexandre Chartre Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , X86 ML , Dave Hansen , Andrew Lutomirski , Peter Zijlstra , LKML , Tom Lendacky , Joerg Roedel , Konrad Rzeszutek Wilk , jan.setjeeilers@oracle.com, Junaid Shahid , oweisse@google.com, Mike Rapoport , Alexander Graf , mgross@linux.intel.com, kuzuno@gmail.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 16, 2020 at 6:47 AM Alexandre Chartre wrote: > > When entering the kernel from userland, use the per-task PTI stack > instead of the per-cpu trampoline stack. Like the trampoline stack, > the PTI stack is mapped both in the kernel and in the user page-table. > Using a per-task stack which is mapped into the kernel and the user > page-table instead of a per-cpu stack will allow executing more code > before switching to the kernel stack and to the kernel page-table. Why? I can't immediately evaluate how nasty the page table setup is because it's not in this patch. But AFAICS the only thing that this enables is sleeping with user page tables. Do we really need to do that?