Skip to contentSkip to conversation

'kill sig -1' must only apply to caller's namespace

PATCH In review [email protected] 2 participants 2 messages Oct 23, 2008 – Oct 24, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 'kill sig -1' must only apply to caller's namespace

From: Sukadev Bhattiprolu <[email protected]>
Subject: [PATCH] 'kill sig -1' must only apply to caller's namespace

Currently "kill <sig> -1" kills processes in all namespaces and breaks the isolation of namespaces. Earlier attempt to fix this was discussed at:

	http://lkml.org/lkml/2008/7/23/148

As suggested by Oleg Nesterov in that thread, use "task_pid_vnr() > 1" check since task_pid_vnr() returns 0 if process is outside the caller's namespace.

---
 kernel/signal.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
kernel/signal.c +2 -1
index 105217d..4530fc6 100644
@@ -1144,7 +1144,8 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
 		struct task_struct * p;
 
 		for_each_process(p) {
-			if (p->pid > 1 && !same_thread_group(p, current)) {
+			if (task_pid_vnr(p) > 1 &&
+					!same_thread_group(p, current)) {
 				int err = group_send_sig_info(sig, info, p);
 				++count;
 				if (err != -EPERM)
Signature · 1 line
1.5.2.5
#1 lore raw

kernel/signal.c static int kill_something_info(int sig, struct siginfo *info, pid_t pid) · line 1148

Quoted 10 lines · On 10/23, [email protected] wrote:
kernel/signal.c +2 -1
@@ -1144,7 +1144,8 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
 		struct task_struct * p;
 
 		for_each_process(p) {
-			if (p->pid > 1 && !same_thread_group(p, current)) {
+			if (task_pid_vnr(p) > 1 &&
+					!same_thread_group(p, current)) {

Thanks Sukadev!

Oleg.