[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120207065120.GG1496@oksana.dev.rtsoft.ru>
Date: Tue, 7 Feb 2012 10:51:20 +0400
From: Anton Vorontsov <anton.vorontsov@...aro.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Greg KH <gregkh@...uxfoundation.org>,
KOSAKI Motohiro <kosaki.motohiro@...il.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Paul Mundt <lethal@...ux-sh.org>,
Russell King <linux@....linux.org.uk>,
Mike Frysinger <vapier@...too.org>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Richard Weinberger <richard@....at>,
linux-kernel@...r.kernel.org
Subject: [PATCH 7/8] um: Should hold tasklist_lock while traversing processes
Traversing the tasks requires holding tasklist_lock, otherwise it
is unsafe.
Signed-off-by: Anton Vorontsov <anton.vorontsov@...aro.org>
---
p.s. However, I'm not sure that calling os_kill_ptraced_process()
in the 'atomic' context is correct. It seem to work, but please
take a closer look.
arch/um/kernel/reboot.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
index 4d93dff..66d754c 100644
--- a/arch/um/kernel/reboot.c
+++ b/arch/um/kernel/reboot.c
@@ -4,6 +4,7 @@
*/
#include "linux/sched.h"
+#include "linux/spinlock.h"
#include "linux/slab.h"
#include "kern_util.h"
#include "os.h"
@@ -22,6 +23,7 @@ static void kill_off_processes(void)
struct task_struct *p;
int pid;
+ read_lock(&tasklist_lock);
for_each_process(p) {
if (p->mm == NULL)
continue;
@@ -29,6 +31,7 @@ static void kill_off_processes(void)
pid = p->mm->context.id.u.pid;
os_kill_ptraced_process(pid, 1);
}
+ read_unlock(&tasklist_lock);
}
}
--
1.7.7.6
--
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