From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752526AbdK2WEE (ORCPT ); Wed, 29 Nov 2017 17:04:04 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:42496 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752391AbdK2WEC (ORCPT ); Wed, 29 Nov 2017 17:04:02 -0500 X-Google-Smtp-Source: AGs4zMYpfvXGqCYiCJ9peQ4+2XhX48diVGcIxSqnFkXKpkh3TzLLsmEDoX9/UyOFPNNq6b/IKVs0Hw== Date: Wed, 29 Nov 2017 14:03:59 -0800 From: Guenter Roeck To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Dave Hansen , Andy Lutomirski , Thomas Gleixner , "H . Peter Anvin" , Peter Zijlstra , Borislav Petkov , Linus Torvalds Subject: Re: [08/24] x86/mm/kaiser: Map the dynamically-allocated LDTs Message-ID: <20171129220359.GA24360@roeck-us.net> References: <20171127104923.14378-9-mingo@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20171127104923.14378-9-mingo@kernel.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 27, 2017 at 11:49:07AM +0100, Ingo Molnar wrote: > From: Dave Hansen > > Normally, a process has a NULL mm->context.ldt. But, there is a > syscall for a process to set a new one. If a process does that, > the LDT be mapped into the user page tables, just like the > default copy. > > The original KAISER patch missed this case. > > Signed-off-by: Dave Hansen > Signed-off-by: Thomas Gleixner > Cc: Andy Lutomirski > Cc: Borislav Petkov > Cc: Brian Gerst > Cc: Denys Vlasenko > Cc: H. Peter Anvin > Cc: Josh Poimboeuf > Cc: Linus Torvalds > Cc: Peter Zijlstra > Cc: Rik van Riel > Cc: daniel.gruss@iaik.tugraz.at > Cc: hughd@google.com > Cc: keescook@google.com > Cc: linux-mm@kvack.org > Cc: michael.schwarz@iaik.tugraz.at > Cc: moritz.lipp@iaik.tugraz.at > Cc: richard.fellner@student.tugraz.at > Link: https://lkml.kernel.org/r/20171123003455.275397F7@viggo.jf.intel.com > Signed-off-by: Ingo Molnar > --- > arch/x86/kernel/ldt.c | 25 ++++++++++++++++++++----- > 1 file changed, 20 insertions(+), 5 deletions(-) > ... > + > /* The caller must call finalize_ldt_struct on the result. LDT starts zeroed. */ > static struct ldt_struct *alloc_ldt_struct(unsigned int num_entries) > { > struct ldt_struct *new_ldt; > unsigned int alloc_size; > + int ret; > > if (num_entries > LDT_ENTRIES) > return NULL; > @@ -89,6 +100,12 @@ static struct ldt_struct *alloc_ldt_struct(unsigned int num_entries) > return NULL; > } > > + ret = kaiser_add_mapping((unsigned long)new_ldt->entries, alloc_size, > + __PAGE_KERNEL | _PAGE_GLOBAL); This results in: arch/x86/kernel/ldt.c: In function ‘alloc_ldt_struct’: arch/x86/kernel/ldt.c:104:6: warning: large integer implicitly truncated to unsigned type [-Woverflow] __PAGE_KERNEL | _PAGE_GLOBAL); ^ in ARCH=i386 builds with CONFIG_X86_PAE enabled. See https://groups.google.com/forum/#!topic/cros-kernel-buildreports/8R41aX07daU Guenter