From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752665AbdLLRgq (ORCPT ); Tue, 12 Dec 2017 12:36:46 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:33818 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752511AbdLLReW (ORCPT ); Tue, 12 Dec 2017 12:34:22 -0500 Message-Id: <20171212173334.097591438@linutronix.de> User-Agent: quilt/0.63-1 Date: Tue, 12 Dec 2017 18:32:31 +0100 From: Thomas Gleixner To: LKML 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 Subject: [patch 10/16] x86/ldt: Do not install LDT for kernel threads References: <20171212173221.496222173@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 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();