[kernel/f13/master] Fix RHBZ #633037, Process user time incorrectly accounted as system time

Chuck Ebbert cebbert at fedoraproject.org
Tue Sep 21 15:44:27 UTC 2010


commit b8bf1362de279d47e2cf282ed57460d946c8cca8
Author: Chuck Ebbert <cebbert at redhat.com>
Date:   Tue Sep 21 11:43:29 2010 -0400

    Fix RHBZ #633037, Process user time incorrectly accounted as system time

 kernel.spec                                        |    8 +++
 ...rectly-accounted-as-system-time-on-32-bit.patch |   55 ++++++++++++++++++++
 2 files changed, 63 insertions(+), 0 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index 9f52838..9d0c226 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -809,6 +809,8 @@ Patch12550: alsa-seq-oss-fix-double-free-at-error-path-of-snd_seq_oss_open.patch
 # CVE-2010-3079
 Patch12560: tracing-do-not-allow-llseek-to-set_ftrace_filter.patch
 
+Patch12570: sched-00-fix-user-time-incorrectly-accounted-as-system-time-on-32-bit.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1528,6 +1530,9 @@ ApplyPatch alsa-seq-oss-fix-double-free-at-error-path-of-snd_seq_oss_open.patch
 # CVE-2010-3079
 ApplyPatch tracing-do-not-allow-llseek-to-set_ftrace_filter.patch
 
+# BZ 633037
+ApplyPatch sched-00-fix-user-time-incorrectly-accounted-as-system-time-on-32-bit.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -2149,6 +2154,9 @@ fi
 
 
 %changelog
+* Tue Sep 21 2010 Chuck Ebbert <cebbert at redhat.com>
+- Fix RHBZ #633037, Process user time incorrectly accounted as system time
+
 * Mon Sep 20 2010 Chuck Ebbert <cebbert at redhat.com>
 - Fix AGP aperture size detection on Intel G33/Q35 chipsets (#629203)
 
diff --git a/sched-00-fix-user-time-incorrectly-accounted-as-system-time-on-32-bit.patch b/sched-00-fix-user-time-incorrectly-accounted-as-system-time-on-32-bit.patch
new file mode 100644
index 0000000..7c15122
--- /dev/null
+++ b/sched-00-fix-user-time-incorrectly-accounted-as-system-time-on-32-bit.patch
@@ -0,0 +1,55 @@
+From: Stanislaw Gruszka <sgruszka at redhat.com>
+Date: Tue, 14 Sep 2010 14:35:14 +0000 (+0200)
+Subject: sched: Fix user time incorrectly accounted as system time on 32-bit
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fx86%2Flinux-2.6-tip.git;a=commitdiff_plain;h=e75e863dd5c7d96b91ebbd241da5328fc38a78cc
+
+sched: Fix user time incorrectly accounted as system time on 32-bit
+
+We have 32-bit variable overflow possibility when multiply in
+task_times() and thread_group_times() functions. When the
+overflow happens then the scaled utime value becomes erroneously
+small and the scaled stime becomes i erroneously big.
+
+Reported here:
+
+ https://bugzilla.redhat.com/show_bug.cgi?id=633037
+ https://bugzilla.kernel.org/show_bug.cgi?id=16559
+
+Reported-by: Michael Chapman <redhat-bugzilla at very.puzzling.org>
+Reported-by: Ciriaco Garcia de Celis <sysman at etherpilot.com>
+Signed-off-by: Stanislaw Gruszka <sgruszka at redhat.com>
+Signed-off-by: Peter Zijlstra <a.p.zijlstra at chello.nl>
+Cc: Hidetoshi Seto <seto.hidetoshi at jp.fujitsu.com>
+Cc: <stable at kernel.org>  # 2.6.32.19+ (partially) and 2.6.33+
+LKML-Reference: <20100914143513.GB8415 at redhat.com>
+Signed-off-by: Ingo Molnar <mingo at elte.hu>
+---
+
+diff --git a/kernel/sched.c b/kernel/sched.c
+index ed09d4f..dc85ceb 100644
+--- a/kernel/sched.c
++++ b/kernel/sched.c
+@@ -3513,9 +3513,9 @@ void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
+ 	rtime = nsecs_to_cputime(p->se.sum_exec_runtime);
+ 
+ 	if (total) {
+-		u64 temp;
++		u64 temp = rtime;
+ 
+-		temp = (u64)(rtime * utime);
++		temp *= utime;
+ 		do_div(temp, total);
+ 		utime = (cputime_t)temp;
+ 	} else
+@@ -3546,9 +3546,9 @@ void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
+ 	rtime = nsecs_to_cputime(cputime.sum_exec_runtime);
+ 
+ 	if (total) {
+-		u64 temp;
++		u64 temp = rtime;
+ 
+-		temp = (u64)(rtime * cputime.utime);
++		temp *= cputime.utime;
+ 		do_div(temp, total);
+ 		utime = (cputime_t)temp;
+ 	} else


More information about the scm-commits mailing list