From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751698AbcFXRVy (ORCPT ); Fri, 24 Jun 2016 13:21:54 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:33212 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751175AbcFXRVw (ORCPT ); Fri, 24 Jun 2016 13:21:52 -0400 MIME-Version: 1.0 In-Reply-To: References: <20160623143126.GA16664@redhat.com> <20160623170352.GA17372@redhat.com> <20160623185340.GO30154@twins.programming.kicks-ass.net> From: Linus Torvalds Date: Fri, 24 Jun 2016 10:21:50 -0700 X-Google-Sender-Auth: AGhED9NOtA1wMqXEYgA-maMeEVs Message-ID: Subject: Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) To: Brian Gerst Cc: Peter Zijlstra , Oleg Nesterov , Andy Lutomirski , Andy Lutomirski , "the arch/x86 maintainers" , Linux Kernel Mailing List , "linux-arch@vger.kernel.org" , Borislav Petkov , Nadav Amit , Kees Cook , "kernel-hardening@lists.openwall.com" , Josh Poimboeuf , Jann Horn , Heiko Carstens 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, Jun 24, 2016 at 5:25 AM, Brian Gerst wrote: > * > * rdi: prev task we switched from > + * rsi: task we're switching to > */ > ENTRY(ret_from_fork) > - LOCK ; btr $TIF_FORK, TI_flags(%r8) > + LOCK ; btr $TIF_FORK, TI_flags(%rsi) /* rsi: this newly forked task */ > > call schedule_tail /* rdi: 'prev' task parameter */ > > I think you forgot GET_THREAD_INFO() here. RSI is the task, not the > thread_info. FYI, this goes away with my switch_to() rewrite, which > removes TIF_FORK. The point of that patch series is to make the thread_info and the task_struct pointer have the same value on x86 - we hide the thread_info inside the task_struct itself, and in fact at the beginning of it. That allows for the above kinds of simplification - use the task struct pointer and thread info interchangably in the asm code. But as mentioned, I must have missed something. There were a number of places where the code used the task_stack_page() and task_thread_info() interchangably, which used to work and is no longer true. There might simply be cases I missed. Or there might simply be cases I screwed up. Linus From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) Date: Fri, 24 Jun 2016 10:21:50 -0700 Message-ID: References: <20160623143126.GA16664@redhat.com> <20160623170352.GA17372@redhat.com> <20160623185340.GO30154@twins.programming.kicks-ass.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from mail-oi0-f67.google.com ([209.85.218.67]:33212 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751175AbcFXRVw (ORCPT ); Fri, 24 Jun 2016 13:21:52 -0400 In-Reply-To: Sender: linux-arch-owner@vger.kernel.org List-ID: To: Brian Gerst Cc: Peter Zijlstra , Oleg Nesterov , Andy Lutomirski , Andy Lutomirski , the arch/x86 maintainers , Linux Kernel Mailing List , "linux-arch@vger.kernel.org" , Borislav Petkov , Nadav Amit , Kees Cook , "kernel-hardening@lists.openwall.com" , Josh Poimboeuf , Jann Horn , Heiko Carstens On Fri, Jun 24, 2016 at 5:25 AM, Brian Gerst wrote: > * > * rdi: prev task we switched from > + * rsi: task we're switching to > */ > ENTRY(ret_from_fork) > - LOCK ; btr $TIF_FORK, TI_flags(%r8) > + LOCK ; btr $TIF_FORK, TI_flags(%rsi) /* rsi: this newly forked task */ > > call schedule_tail /* rdi: 'prev' task parameter */ > > I think you forgot GET_THREAD_INFO() here. RSI is the task, not the > thread_info. FYI, this goes away with my switch_to() rewrite, which > removes TIF_FORK. The point of that patch series is to make the thread_info and the task_struct pointer have the same value on x86 - we hide the thread_info inside the task_struct itself, and in fact at the beginning of it. That allows for the above kinds of simplification - use the task struct pointer and thread info interchangably in the asm code. But as mentioned, I must have missed something. There were a number of places where the code used the task_stack_page() and task_thread_info() interchangably, which used to work and is no longer true. There might simply be cases I missed. Or there might simply be cases I screwed up. Linus From mboxrd@z Thu Jan 1 00:00:00 1970 Reply-To: kernel-hardening@lists.openwall.com MIME-Version: 1.0 Sender: linus971@gmail.com In-Reply-To: References: <20160623143126.GA16664@redhat.com> <20160623170352.GA17372@redhat.com> <20160623185340.GO30154@twins.programming.kicks-ass.net> From: Linus Torvalds Date: Fri, 24 Jun 2016 10:21:50 -0700 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: [kernel-hardening] Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) To: Brian Gerst Cc: Peter Zijlstra , Oleg Nesterov , Andy Lutomirski , Andy Lutomirski , the arch/x86 maintainers , Linux Kernel Mailing List , "linux-arch@vger.kernel.org" , Borislav Petkov , Nadav Amit , Kees Cook , "kernel-hardening@lists.openwall.com" , Josh Poimboeuf , Jann Horn , Heiko Carstens List-ID: On Fri, Jun 24, 2016 at 5:25 AM, Brian Gerst wrote: > * > * rdi: prev task we switched from > + * rsi: task we're switching to > */ > ENTRY(ret_from_fork) > - LOCK ; btr $TIF_FORK, TI_flags(%r8) > + LOCK ; btr $TIF_FORK, TI_flags(%rsi) /* rsi: this newly forked task */ > > call schedule_tail /* rdi: 'prev' task parameter */ > > I think you forgot GET_THREAD_INFO() here. RSI is the task, not the > thread_info. FYI, this goes away with my switch_to() rewrite, which > removes TIF_FORK. The point of that patch series is to make the thread_info and the task_struct pointer have the same value on x86 - we hide the thread_info inside the task_struct itself, and in fact at the beginning of it. That allows for the above kinds of simplification - use the task struct pointer and thread info interchangably in the asm code. But as mentioned, I must have missed something. There were a number of places where the code used the task_stack_page() and task_thread_info() interchangably, which used to work and is no longer true. There might simply be cases I missed. Or there might simply be cases I screwed up. Linus