[Devel] [PATCH 2/5] pid: use namespaced iteration on processes while using sysrq

Gowrishankar M gowrishankar.m at linux.vnet.ibm.com
Thu Dec 18 08:42:30 PST 2008


From: Gowrishankar M <gomuthuk at linux.vnet.ibm.com>

At present, while signalling processes using sysrq, process iteration
goes beyond current PID namespace.

Below patch uses one of the proposed namespace iteration macros to fix
the boundary.

Signed-off-by: Gowrishankar M <gowrishankar.m at linux.vnet.ibm.com>
---
 drivers/char/sysrq.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index ce0d9da..adca5da 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -13,6 +13,7 @@
  */
 
 #include <linux/sched.h>
+#include <linux/pid_namespace.h>
 #include <linux/interrupt.h>
 #include <linux/mm.h>
 #include <linux/fs.h>
@@ -293,8 +294,8 @@ static void send_sig_all(int sig)
 {
 	struct task_struct *p;
 
-	for_each_process(p) {
-		if (p->mm && !is_global_init(p))
+	for_each_process_in_ns(p, current->nsproxy->pid_ns) {
+		if (p->mm && !is_container_init(p))
 			/* Not swapper, init nor kernel thread */
 			force_sig(sig, p);
 	}
-- 
1.5.5.1

_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list