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: <20160406110803.GI2906@worktop>
Date:	Wed, 6 Apr 2016 13:08:03 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Anton Blanchard <anton@...ba.org>
Cc:	Ingo Molnar <mingo@...nel.org>,
	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>,
	Michael Ellerman <mpe@...erman.id.au>
Subject: Re: [tip:sched/core] sched/cpuacct: Split usage accounting into
 user_usage and sys_usage

On Wed, Apr 06, 2016 at 08:32:19PM +1000, Anton Blanchard wrote:
> Hi,
> 
> > > >  void cpuacct_charge(struct task_struct *tsk, u64 cputime)
> > > >  {
> > > >  	struct cpuacct *ca;
> > > > +	int index;
> > > > +
> > > > +	if (user_mode(task_pt_regs(tsk)))
> > > > +		index = CPUACCT_USAGE_USER;
> > > > +	else
> > > > +		index = CPUACCT_USAGE_SYSTEM;
> 
> This is oopsing because PowerPC task_pt_regs() returns NULL for
> kernel threads.

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?


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ