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: <20070426100922.GB12892@in.ibm.com>
Date:	Thu, 26 Apr 2007 15:39:22 +0530
From:	Gautham R Shenoy <ego@...ibm.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	"Rafael J. Wysocki" <rjw@...k.pl>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Oleg Nesterov <oleg@...sign.ru>
Subject: Re: 2.6.21-rc7-mm1: BUG_ON in kthread_bind during _cpu_down

On Wed, Apr 25, 2007 at 04:54:10PM -0700, Andrew Morton wrote:
> On Thu, 26 Apr 2007 01:10:21 +0200 "Rafael J. Wysocki" <rjw@...k.pl> wrote:
> 
> > Hi,
> > 
> > The BUG_ON in khthread_bind (line 165 in kthread.c) triggers for me during
> > attempted suspend to disk, when disable_nonboot_cpus() calls _cpu_down()
> > (on x86_64).
> 
Caused due to Oleg's patch http://lkml.org/lkml/2007/4/13/93.

Agreed that most of the time a kthread_create(p) is followed by a
kthread_bind(p), in which case the assertion 
WARN_ON(p->state != TASK_UNINTERRUPTIBLE) makes sense.

But, in cpu hotplug case, we need to rebind the stop_machine_run thread
from the cpu which has just been offlined to any online cpu.
(kernel/cpu.c line 180)
At this point, the thread would be in TASK_INTERRUPTIBLE waiting for us
to call a kthread_stop on it.(kernel/kthread.c line 161)

We only need to ensure in kthread_bind that the task which is being
bound is not running or exiting. Doesn't matter if it's sleeping in 
TASK_INTERRUPTIBLE or TASK_UNINTERRUPTIBLE state.

Signed-off-by: Gautham R Shenoy <ego@...ibm.com>
---
 kernel/kthread.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.21-rc7/kernel/kthread.c
===================================================================
--- linux-2.6.21-rc7.orig/kernel/kthread.c
+++ linux-2.6.21-rc7/kernel/kthread.c
@@ -162,7 +162,8 @@ EXPORT_SYMBOL(kthread_create);
  */
 void kthread_bind(struct task_struct *k, unsigned int cpu)
 {
-	if (k->state != TASK_UNINTERRUPTIBLE) {
+	if (k->state != TASK_UNINTERRUPTIBLE &&
+	    k->state != TASK_INTERRUPTIBLE) {
 		WARN_ON(1);
 		return;
 	}
-- 
Gautham R Shenoy
Linux Technology Center
IBM India.
"Freedom comes with a price tag of responsibility, which is still a bargain,
because Freedom is priceless!"
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ