signals: zap_pid_ns_process() should use force_sig()

send_signal() assumes that signals with SEND_SIG_PRIV are generated from
within the same namespace.  So any nested container-init processes become
immune to the SIGKILL generated by kill_proc_info() in
zap_pid_ns_processes().

Use force_sig() in zap_pid_ns_processes() instead - force_sig() clears the
SIGNAL_UNKILLABLE flag ensuring the signal is processed by
container-inits.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Sukadev Bhattiprolu 2009-04-02 16:58:06 -07:00 коммит произвёл Linus Torvalds
Родитель 921cf9f630
Коммит e4da026f98
1 изменённых файлов: 14 добавлений и 1 удалений

Просмотреть файл

@ -152,6 +152,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
{ {
int nr; int nr;
int rc; int rc;
struct task_struct *task;
/* /*
* The last thread in the cgroup-init thread group is terminating. * The last thread in the cgroup-init thread group is terminating.
@ -169,7 +170,19 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
nr = next_pidmap(pid_ns, 1); nr = next_pidmap(pid_ns, 1);
while (nr > 0) { while (nr > 0) {
kill_proc_info(SIGKILL, SEND_SIG_PRIV, nr); rcu_read_lock();
/*
* Use force_sig() since it clears SIGNAL_UNKILLABLE ensuring
* any nested-container's init processes don't ignore the
* signal
*/
task = pid_task(find_vpid(nr), PIDTYPE_PID);
if (task)
force_sig(SIGKILL, task);
rcu_read_unlock();
nr = next_pidmap(pid_ns, nr); nr = next_pidmap(pid_ns, nr);
} }
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);