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: <1460355375.3444.6.camel@ellerman.id.au>
Date:	Mon, 11 Apr 2016 16:16:15 +1000
From:	Michael Ellerman <mpe@...erman.id.au>
To:	Anton Blanchard <anton@...ba.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...nel.org>
Cc:	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>, tglx@...utronix.de,
	efault@....de, htejun@...il.com, linux-kernel@...r.kernel.org,
	tj@...nel.org, torvalds@...ux-foundation.org,
	zhaolei@...fujitsu.com, yangds.fnst@...fujitsu.com, hpa@...or.com,
	Stephen Rothwell <sfr@...b.auug.org.au>,
	linuxppc-dev@...ts.ozlabs.org
Subject: Ping? Re: [PATCH] sched/cpuacct: Check for NULL when using
 task_pt_regs()

Hi Peter/Ingo,

On Wed, 2016-04-06 at 21:59 +1000, Anton Blanchard wrote:
> Hi Peter,
> 
> > Ah, so sometihng like:
> > 
> > 	struct pt_regs *regs = task_pt_regs();
> > 	int index = CPUACCT_USAGE_SYSTEM;
> > 
> > 	if (regs && user_mode(regs))
> > 		index = CPUACCT_USAGE_USER;
> > 
> > should work, right?
> 
> Looks good, and the patch below does fix the oops for me.

Can we get this merged please? It's blocking all my boot tests.

If anyone's bothered:

Fixes: d740037fac70 ("sched/cpuacct: Split usage accounting into user_usage and sys_usage")

cheers

> task_pt_regs() can return NULL for kernel threads, so add a check.
> This fixes an oops at boot on ppc64.
> 
> Signed-off-by: Anton Blanchard <anton@...ba.org>
> ---
> 
> diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
> index df947e0..41f85c4 100644
> --- a/kernel/sched/cpuacct.c
> +++ b/kernel/sched/cpuacct.c
> @@ -316,12 +316,11 @@ static struct cftype files[] = {
>  void cpuacct_charge(struct task_struct *tsk, u64 cputime)
>  {
>  	struct cpuacct *ca;
> -	int index;
> +	int index = CPUACCT_USAGE_SYSTEM;
> +	struct pt_regs *regs = task_pt_regs(tsk);
>  
> -	if (user_mode(task_pt_regs(tsk)))
> +	if (regs && user_mode(regs))
>  		index = CPUACCT_USAGE_USER;
> -	else
> -		index = CPUACCT_USAGE_SYSTEM;
>  
>  	rcu_read_lock();
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ