mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Makhlis, Lev" <Lev_Makhlis@bmc.com>
To: Andrew Morton <akpm@osdl.org>
Cc: "Makhlis, Lev" <Lev_Makhlis@bmc.com>, linux-kernel@vger.kernel.org
Subject: [PATCH 2.6.9-rc1-mm4] fix BUG in do_task_stat()
Date: Fri, 10 Sep 2004 09:53:25 -0500	[thread overview]
Message-ID: <1094828013.19339.1000.camel@levlinux.boston.bmc.com> (raw)

> 
> kernel BUG in next_thread at kernel/exit.c:852!
> cpu 0x2: Vector: 700 (Program Check) at [c00000027bcf3770]
>     pc: c000000000058454: .next_thread+0x14/0x48
>     lr: c0000000000f1a84: .do_task_stat+0x238/0x53c
> 

I've been able to reproduce this.  This patch makes sure next_thread()
is only called while holding ->sighand->siglock.  Ran it overnight with
a load, and no problems so far.

Signed-off-by: Lev Makhlis <mlev@despammed.com>

diff -pruN linux-2.6.9-rc1-mm4/fs/proc/array.c linux/fs/proc/array.c
--- linux-2.6.9-rc1-mm4/fs/proc/array.c	2004-09-09 18:06:19.265831912 -0400
+++ linux/fs/proc/array.c	2004-09-09 18:01:34.221165288 -0400
@@ -336,6 +336,16 @@ static int do_task_stat(struct task_stru
 		spin_lock_irq(&task->sighand->siglock);
 		num_threads = atomic_read(&task->signal->count);
 		collect_sigign_sigcatch(task, &sigign, &sigcatch);
+		if (whole) {
+			t = task;
+			do {
+				min_flt += t->min_flt;
+				maj_flt += t->maj_flt;
+				utime += t->utime;
+				stime += t->stime;
+				t = next_thread(t);
+			} while (t != task);
+		}
 		spin_unlock_irq(&task->sighand->siglock);
 	}
 	if (task->signal) {
@@ -350,22 +360,12 @@ static int do_task_stat(struct task_stru
 		cutime = task->signal->cutime;
 		cstime = task->signal->cstime;
 		if (whole) {
-			min_flt = task->signal->min_flt;
-			maj_flt = task->signal->maj_flt;
-			utime = task->signal->utime;
-			stime = task->signal->stime;
+			min_flt += task->signal->min_flt;
+			maj_flt += task->signal->maj_flt;
+			utime += task->signal->utime;
+			stime += task->signal->stime;
 		}
 	}
-	if (whole) {
-		t = task;
-		do {
-			min_flt += t->min_flt;
-			maj_flt += t->maj_flt;
-			utime += t->utime;
-			stime += t->stime;
-			t = next_thread(t);
-		} while (t != task);
-	}
 	ppid = task->pid ? task->real_parent->pid : 0;
 	read_unlock(&tasklist_lock);


                 reply	other threads:[~2004-09-10 14:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1094828013.19339.1000.camel@levlinux.boston.bmc.com \
    --to=lev_makhlis@bmc.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome