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]
Date:	Wed, 10 Aug 2016 20:57:28 +0200
From:	Mike Galbraith <umgwanakikbuti@...il.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [patch] sched/cputime: Fix NO_HZ_FULL getrusage() monotonicity
 regression

On Wed, 2016-08-10 at 14:30 +0200, Peter Zijlstra wrote:
> On Wed, Aug 10, 2016 at 01:14:29PM +0200, Mike Galbraith wrote:

> > --- a/kernel/sched/cputime.c
> > +++ b/kernel/sched/cputime.c
> > @@ -608,11 +608,13 @@ static void cputime_adjust(struct task_c
> >  
> >  	if (utime == 0) {
> >  		stime = rtime;
> > +		utime = prev->utime;
> >  		goto update;
> >  	}
> >  
> >  	if (stime == 0) {
> >  		utime = rtime;
> > +		stime = prev->stime;
> >  		goto update;
> >  	}
> 
> This cannot be right; it violates that utime+stime==rtime. Let me try
> and figure out what actually happens.

How about this instead.

sched/cputime: Fix NO_HZ_FULL getrusage() monotonicity regression

Roughly 10% of the time, ltp testcase getrusage04 fails:
getrusage04    0  TINFO  :  Expected timers granularity is 4000 us
getrusage04    0  TINFO  :  Using 1 as multiply factor for max [us]time increment (1000+4000us)!
getrusage04    0  TINFO  :  utime:           0us; stime:         179us
getrusage04    0  TINFO  :  utime:        3751us; stime:           0us
getrusage04    1  TFAIL  :  getrusage04.c:133: stime increased > 5000us:

If ->sum_exec_runtime has moved beyond the rtime of ->prev_cputime, but
no time has as yet been accounted to the task, bail.

Fixes: 9d7fb0427648 ("sched/cputime: Guarantee stime + utime == rtime")
Signed-off-by: Mike Galbraith <umgwanakikbuti@...il.com>
Cc: stable@...r.kernel.org # 4.3+
---
 kernel/sched/cputime.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -606,6 +606,13 @@ static void cputime_adjust(struct task_c
 	stime = curr->stime;
 	utime = curr->utime;
 
+	/*
+	 * sum_exec_runtime has moved, but nothing has yet been
+	 * accounted to the task, there's nothing to update.
+	 */
+	if (utime + stime == 0)
+		goto out;
+
 	if (utime == 0) {
 		stime = rtime;
 		goto update;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ