From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753599AbdKVWyu (ORCPT ); Wed, 22 Nov 2017 17:54:50 -0500 Received: from mga03.intel.com ([134.134.136.65]:4150 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752988AbdKVWug (ORCPT ); Wed, 22 Nov 2017 17:50:36 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,438,1505804400"; d="scan'208";a="152261948" Subject: Re: [PATCH 08/30] x86, kaiser: unmap kernel from userspace page tables (core patch) To: Thomas Gleixner References: <20171110193058.BECA7D88@viggo.jf.intel.com> <20171110193112.6A962D6A@viggo.jf.intel.com> Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, richard.fellner@student.tugraz.at, moritz.lipp@iaik.tugraz.at, daniel.gruss@iaik.tugraz.at, michael.schwarz@iaik.tugraz.at, luto@kernel.org, torvalds@linux-foundation.org, keescook@google.com, hughd@google.com, x86@kernel.org From: Dave Hansen Message-ID: Date: Wed, 22 Nov 2017 14:50:32 -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/20/2017 09:21 AM, Thomas Gleixner wrote: >> +} >> + >> static inline void native_set_p4d(p4d_t *p4dp, p4d_t p4d) >> { >> +#if defined(CONFIG_KAISER) && !defined(CONFIG_X86_5LEVEL) >> + /* >> + * set_pgd() does not get called when we are running >> + * CONFIG_X86_5LEVEL=y. So, just hack around it. We >> + * know here that we have a p4d but that it is really at >> + * the top level of the page tables; it is really just a >> + * pgd. >> + */ >> + /* Do we need to also populate the shadow p4d? */ >> + if (is_userspace_pgd(p4dp)) >> + native_get_shadow_p4d(p4dp)->pgd = p4d.pgd; > native_get_shadow_p4d() is kinda confusing, as it suggest that we get the > entry not the pointer to it. native_get_shadow_p4d_ptr() is what it > actually wants to be, but a setter e.g. native_set_shadow...(), we also > have set_pgd() would be more obvious I think. How about "kernel_to_shadow_pgdp()"? ... and friends