From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752844AbcGOIPy (ORCPT ); Fri, 15 Jul 2016 04:15:54 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36375 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752641AbcGOIPS (ORCPT ); Fri, 15 Jul 2016 04:15:18 -0400 Date: Fri, 15 Jul 2016 10:14:43 +0200 From: Ingo Molnar To: Andy Lutomirski Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Brian Gerst , Borislav Petkov , Linus Torvalds , Thomas Gleixner , "H. Peter Anvin" Subject: Re: [PATCH 08/11] x86: Move uaccess_err and sig_on_uaccess_err to thread_struct Message-ID: <20160715081443.GA10756@gmail.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Andy Lutomirski wrote: > thread_info is a legacy mess. To prepare for its partial removal, > move the uaccess control fields out -- they're straightforward. > > Signed-off-by: Andy Lutomirski > --- > arch/x86/entry/vsyscall/vsyscall_64.c | 6 +++--- > arch/x86/include/asm/processor.h | 3 +++ > arch/x86/include/asm/thread_info.h | 2 -- > arch/x86/include/asm/uaccess.h | 4 ++-- > arch/x86/mm/extable.c | 2 +- > arch/x86/mm/fault.c | 2 +- > 6 files changed, 10 insertions(+), 9 deletions(-) > > diff --git a/arch/x86/entry/vsyscall/vsyscall_64.c b/arch/x86/entry/vsyscall/vsyscall_64.c > index 174c2549939d..3aba2b043050 100644 > --- a/arch/x86/entry/vsyscall/vsyscall_64.c > +++ b/arch/x86/entry/vsyscall/vsyscall_64.c > @@ -221,8 +221,8 @@ bool emulate_vsyscall(struct pt_regs *regs, unsigned long address) > * With a real vsyscall, page faults cause SIGSEGV. We want to > * preserve that behavior to make writing exploits harder. > */ > - prev_sig_on_uaccess_error = current_thread_info()->sig_on_uaccess_error; > - current_thread_info()->sig_on_uaccess_error = 1; > + prev_sig_on_uaccess_error = current->thread.sig_on_uaccess_error; > + current->thread.sig_on_uaccess_error = 1; > > ret = -EFAULT; > switch (vsyscall_nr) { > @@ -243,7 +243,7 @@ bool emulate_vsyscall(struct pt_regs *regs, unsigned long address) > break; > } > > - current_thread_info()->sig_on_uaccess_error = prev_sig_on_uaccess_error; > + current->thread.sig_on_uaccess_error = prev_sig_on_uaccess_error; > > check_fault: > if (ret == -EFAULT) { > diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h > index 62c6cc3cc5d3..f53ae57bd985 100644 > --- a/arch/x86/include/asm/processor.h > +++ b/arch/x86/include/asm/processor.h > @@ -419,6 +419,9 @@ struct thread_struct { > /* Max allowed port in the bitmap, in bytes: */ > unsigned io_bitmap_max; > > + unsigned int sig_on_uaccess_error:1; > + unsigned int uaccess_err:1; /* uaccess failed */ Btw., while at it I've renamed 'sig_on_uaccess_error' to 'sig_on_uaccess_err' to make the two names consistent. Thanks, Ingo