From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756321AbdLPAjv (ORCPT ); Fri, 15 Dec 2017 19:39:51 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:41299 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755861AbdLPAjs (ORCPT ); Fri, 15 Dec 2017 19:39:48 -0500 Date: Sat, 16 Dec 2017 01:39:45 +0100 (CET) From: Thomas Gleixner To: Andy Lutomirski cc: x86@kernel.org, linux-kernel@vger.kernel.org, Borislav Petkov , Brian Gerst , David Laight , Kees Cook , Peter Zijlstra , "Kirill A. Shutemov" , Dave Hansen Subject: Re: [PATCH PTI v3 10/10] x86/pti: Put the LDT in its own PGD if PTI is on In-Reply-To: <6e2fc833b964e8dc18af406f3fb86e0fc7fbf736.1513035461.git.luto@kernel.org> Message-ID: References: <24c898b4f44fdf8c22d93703850fb384ef87cfdc.1513035461.git.luto@kernel.org> <6e2fc833b964e8dc18af406f3fb86e0fc7fbf736.1513035461.git.luto@kernel.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 12 Dec 2017, Andy Lutomirski wrote: > + > + return 0; > +#else > + return -EINVAL; Errm. What's the point of that? Breaking non PTI? > new_ldt = alloc_ldt_struct(old_mm->context.ldt->nr_entries); > if (!new_ldt) { > @@ -155,8 +266,17 @@ int init_new_context_ldt(struct task_struct *tsk, struct mm_struct *mm) > memcpy(new_ldt->entries, old_mm->context.ldt->entries, > new_ldt->nr_entries * LDT_ENTRY_SIZE); > finalize_ldt_struct(new_ldt); > + retval = map_ldt_struct(mm, new_ldt, 0); > + if (retval) > + goto out_free; > > mm->context.ldt = new_ldt; > + goto out_unlock; > + > +out_free: > + free_ldt_pgtables(mm); > + free_ldt_struct(new_ldt); > + return retval; Leaks old_mm->context_lock; Thanks, tglx