Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1444045

Re: [PATCH 08/11] x86: Move uaccess_err and sig_on_uaccess_err to thread_struct

From Ingo Molnar <mingo@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 08/11] x86: Move uaccess_err and sig_on_uaccess_err to thread_struct
Date 2016-07-15 10:20 +0200
Message-ID <rV6vN-4wu-41@gated-at.bofh.it> (permalink)
References <rUVqF-5SB-3@gated-at.bofh.it> <rUVqF-5SB-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


* Andy Lutomirski <luto@kernel.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@kernel.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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 08/11] x86: Move uaccess_err and sig_on_uaccess_err to thread_struct Andy Lutomirski <luto@kernel.org> - 2016-07-14 22:30 +0200
  Re: [PATCH 08/11] x86: Move uaccess_err and sig_on_uaccess_err to  thread_struct Ingo Molnar <mingo@kernel.org> - 2016-07-15 10:20 +0200
  [tip:x86/mm] x86/uaccess: Move thread_info::uaccess_err and  thread_info::sig_on_uaccess_err to thread_struct tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-07-15 14:10 +0200

csiph-web