From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752288AbdLNLoG (ORCPT ); Thu, 14 Dec 2017 06:44:06 -0500 Received: from merlin.infradead.org ([205.233.59.134]:54822 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752159AbdLNLn6 (ORCPT ); Thu, 14 Dec 2017 06:43:58 -0500 Message-Id: <20171214113851.398563731@infradead.org> User-Agent: quilt/0.63-1 Date: Thu, 14 Dec 2017 12:27:32 +0100 From: Peter Zijlstra To: linux-kernel@vger.kernel.org, tglx@linutronix.de Cc: x86@kernel.org, Linus Torvalds , Andy Lutomirsky , Peter Zijlstra , Dave Hansen , Borislav Petkov , Greg KH , keescook@google.com, hughd@google.com, Brian Gerst , Josh Poimboeuf , Denys Vlasenko , Boris Ostrovsky , Juergen Gross , David Laight , Eduardo Valentin , aliguori@amazon.com, Will Deacon , linux-mm@kvack.org, kirill.shutemov@linux.intel.com, dan.j.williams@intel.com Subject: [PATCH v2 06/17] x86/ldt: Do not install LDT for kernel threads References: <20171214112726.742649793@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline; filename=x86-ldt--Do-not-install-LDT-for-kernel-threads.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner Kernel threads can use the mm of a user process temporarily via use_mm(), but there is no point in installing the LDT which is associated to that mm for the kernel thread. Signed-off-by: Thomas Gleixner --- arch/x86/include/asm/mmu_context.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/arch/x86/include/asm/mmu_context.h +++ b/arch/x86/include/asm/mmu_context.h @@ -95,8 +95,7 @@ static inline void load_mm_ldt(struct mm * the local LDT after an IPI loaded a newer value than the one * that we can see. */ - - if (unlikely(ldt)) + if (unlikely(ldt && !(current->flags & PF_KTHREAD))) set_ldt(ldt->entries, ldt->nr_entries); else clear_LDT();