[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160715081443.GA10756@gmail.com>
Date: Fri, 15 Jul 2016 10:14:43 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Andy Lutomirski <luto@...nel.org>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Brian Gerst <brgerst@...il.com>,
Borislav Petkov <bp@...en8.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH 08/11] x86: Move uaccess_err and sig_on_uaccess_err to
thread_struct
* Andy Lutomirski <luto@...nel.org> 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 <luto@...nel.org>
> ---
> 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
Powered by blists - more mailing lists