From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753099AbdLHVim (ORCPT ); Fri, 8 Dec 2017 16:38:42 -0500 Received: from mail-oi0-f51.google.com ([209.85.218.51]:33206 "EHLO mail-oi0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752172AbdLHVil (ORCPT ); Fri, 8 Dec 2017 16:38:41 -0500 X-Google-Smtp-Source: AGs4zMYwJpKq3tjd5aejhkvHnK+9CqP3cGf1bYDz9XwzJRoY692vxOHKuoi6TDfhUZQnEB/XDsx4b0cPOJxkoMWiJ+Y= MIME-Version: 1.0 In-Reply-To: References: From: Linus Torvalds Date: Fri, 8 Dec 2017 13:38:40 -0800 X-Google-Sender-Auth: gCvm33LMYSFC6-S8L5JeyQgGRfU Message-ID: Subject: Re: x86/ldt: Prevent ldt inheritance on exec To: Thomas Gleixner Cc: Andy Lutomirski , "the arch/x86 maintainers" , LKML , Borislav Petkov , Brian Gerst , David Laight , Kees Cook , Peter Zijlstra Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 8, 2017 at 12:02 PM, Thomas Gleixner wrote: > > The reason why this happens is that init_new_context_ldt() is called from > init_new_context() which obviously needs to be called for both fork() and > exec(). > > It would be surprising if anything relies on that behaviour, so it seems to > be safe to remove that misfeature. Looks sane. That said, can't we separate this out into the copy_mm() phase only? We have "arch_dup_mmap()" that is called on fork() only, so that could do the LDT copy from the old mm, and the actual init_new_context would just zero it out. Then there wouldn't be any odd "check if this is an execve" because the copying would be done in the right place. Hmm? Linus