From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751471AbdKUXnD (ORCPT ); Tue, 21 Nov 2017 18:43:03 -0500 Received: from mga05.intel.com ([192.55.52.43]:15117 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751290AbdKUXnC (ORCPT ); Tue, 21 Nov 2017 18:43:02 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,432,1505804400"; d="scan'208";a="8045050" Subject: Re: [PATCH 12/30] x86, kaiser: map GDT into user page tables To: Andy Lutomirski References: <20171110193058.BECA7D88@viggo.jf.intel.com> <20171110193125.EBF58596@viggo.jf.intel.com> <02e48e97-5842-6a19-1ea2-cee4ed5910f4@linux.intel.com> Cc: Thomas Gleixner , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , moritz.lipp@iaik.tugraz.at, Daniel Gruss , michael.schwarz@iaik.tugraz.at, richard.fellner@student.tugraz.at, Linus Torvalds , Kees Cook , Hugh Dickins , X86 ML From: Dave Hansen Message-ID: <62d71c5c-515e-c3be-e8f0-4f640251d20c@linux.intel.com> Date: Tue, 21 Nov 2017 15:42:59 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/21/2017 03:32 PM, Andy Lutomirski wrote: >> To do this, we need to special-case the kernel page table walker to deal >> with PTEs only since we can't just grab PMD or PUD flags and stick them >> in a PTE. We would only be able to use this path when populating things >> that we know are 4k-mapped in the kernel. > I'm not sure I'm understanding the issue. We'd promise to map the > cpu_entry_area without using large pages, but I'm not sure I know what > you're referring to. The only issue I see is that we'd have to be > quite careful when tearing down the user tables to avoid freeing the > shared part. It's just that it currently handles large and small pages in the kernel mapping that it's copying. If we want to have it just copy the PTE, we've got to refactor things a bit to separate out the PTE flags from the paddr being targeted, and also make sure we don't munge the flags conversion from the large-page entries to 4k PTEs. The PAT and PSE bits cause a bit of trouble here. IOW, it would make the call-sites look cleaner, but it largely just shifts the complexity elsewhere. But, either way, it's all contained to kaiser.c