lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190718132114.GB116002@google.com>
Date:   Thu, 18 Jul 2019 09:21:14 -0400
From:   Joel Fernandes <joel@...lfernandes.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Vegard Nossum <vegard.nossum@...cle.com>, tglx@...utronix.de,
        bp@...en8.de, mingo@...nel.org, rostedt@...dmis.org,
        luto@...nel.org, torvalds@...ux-foundation.org, hpa@...or.com,
        dave.hansen@...ux.intel.com, jgross@...e.com,
        linux-kernel@...r.kernel.org, zhe.he@...driver.com,
        devel@...ukata.com
Subject: Re: [PATCH] stacktrace: Force USER_DS for stack_trace_save_user()

On Thu, Jul 18, 2019 at 10:57:54AM +0200, Peter Zijlstra wrote:
> On Wed, Jul 17, 2019 at 10:09:45AM +0200, Vegard Nossum wrote:
> > On 7/17/19 10:07 AM, Peter Zijlstra wrote:
> 
> > > Does something like the below help?
> 
> > Yes.
> 
> Thanks!
> 
> ---
> Subject: stacktrace: Force USER_DS for stack_trace_save_user()
> From: Peter Zijlstra <peterz@...radead.org>
> Date: Thu Jul 18 10:47:47 CEST 2019
> 
> When walking userspace stacks, we should set USER_DS, otherwise
> access_ok() will not function as expected.
> 
> Reported-by: Vegard Nossum <vegard.nossum@...cle.com>
> Tested-by: Vegard Nossum <vegard.nossum@...cle.com>
> Reported-by: Eiichi Tsukata <devel@...ukata.com>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>

Reviewed-by: Joel Fernandes (Google) <joel@...lfernandes.org>

thanks,

 - Joel


> ---
> --- a/kernel/stacktrace.c
> +++ b/kernel/stacktrace.c
> @@ -226,12 +226,17 @@ unsigned int stack_trace_save_user(unsig
>  		.store	= store,
>  		.size	= size,
>  	};
> +	mm_segment_t fs;
>  
>  	/* Trace user stack if not a kernel thread */
>  	if (current->flags & PF_KTHREAD)
>  		return 0;
>  
> +	fs = get_fs();
> +	set_fs(USER_DS);
>  	arch_stack_walk_user(consume_entry, &c, task_pt_regs(current));
> +	set_fs(fs);
> +
>  	return c.len;
>  }
>  #endif

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ