From: Oleg Nesterov <oleg@redhat.com>
To: Anton Vorontsov <anton.vorontsov@linaro.org>
Cc: Greg KH <gregkh@linuxfoundation.org>,
KOSAKI Motohiro <kosaki.motohiro@gmail.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Paul Mundt <lethal@linux-sh.org>,
Russell King <linux@arm.linux.org.uk>,
Mike Frysinger <vapier@gentoo.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Richard Weinberger <richard@nod.at>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/8] Fixes for common mistakes w/ for_each_process and task->mm
Date: Wed, 8 Feb 2012 16:59:46 +0100 [thread overview]
Message-ID: <20120208155946.GA17177@redhat.com> (raw)
In-Reply-To: <20120207064809.GA29061@oksana.dev.rtsoft.ru>
On 02/07, Anton Vorontsov wrote:
>
> For sysrq case I kept the force_sig() usage, this is because in sysrq
> case I belive we do want to kill PID namespace init processes.
Agreed,
> If using
> force_sig() is still a bad idea, I guess we should fix it somehow
> else.
Yes, I think it is simply wrong here. And I think that force_*
should not take the "struct task_struct *" argument, it should be
used for synchronous signals only.
I am thinking about the patch below. With this patch send_sig_all()
can use send_sig_info(SEND_SIG_FORCED). And probably send_sig_all()
doesn't need tasklist in this case.
I'll recheck this but I need to disappear until Friday, sorry.
Oleg.
--- x/kernel/signal.c
+++ x/kernel/signal.c
@@ -58,21 +58,20 @@ static int sig_handler_ignored(void __us
(handler == SIG_DFL && sig_kernel_ignore(sig));
}
-static int sig_task_ignored(struct task_struct *t, int sig,
- int from_ancestor_ns)
+static int sig_task_ignored(struct task_struct *t, int sig, bool force)
{
void __user *handler;
handler = sig_handler(t, sig);
if (unlikely(t->signal->flags & SIGNAL_UNKILLABLE) &&
- handler == SIG_DFL && !from_ancestor_ns)
+ handler == SIG_DFL && !force)
return 1;
return sig_handler_ignored(handler, sig);
}
-static int sig_ignored(struct task_struct *t, int sig, int from_ancestor_ns)
+static int sig_ignored(struct task_struct *t, int sig, bool force)
{
/*
* Blocked signals are never ignored, since the
@@ -82,7 +81,7 @@ static int sig_ignored(struct task_struc
if (sigismember(&t->blocked, sig) || sigismember(&t->real_blocked, sig))
return 0;
- if (!sig_task_ignored(t, sig, from_ancestor_ns))
+ if (!sig_task_ignored(t, sig, force))
return 0;
/*
@@ -855,7 +854,7 @@ static void ptrace_trap_notify(struct ta
* Returns true if the signal should be actually delivered, otherwise
* it should be dropped.
*/
-static int prepare_signal(int sig, struct task_struct *p, int from_ancestor_ns)
+static int prepare_signal(int sig, struct task_struct *p, bool force)
{
struct signal_struct *signal = p->signal;
struct task_struct *t;
@@ -915,7 +914,7 @@ static int prepare_signal(int sig, struc
}
}
- return !sig_ignored(p, sig, from_ancestor_ns);
+ return !sig_ignored(p, sig, force);
}
/*
@@ -1059,7 +1058,8 @@ static int __send_signal(int sig, struct
assert_spin_locked(&t->sighand->siglock);
- if (!prepare_signal(sig, t, from_ancestor_ns))
+ if (!prepare_signal(sig, t,
+ from_ancestor_ns || (info == SEND_SIG_FORCED)))
return 0;
pending = group ? &t->signal->shared_pending : &t->pending;
prev parent reply other threads:[~2012-02-08 16:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-07 6:48 [PATCH 0/8] Fixes for common mistakes w/ for_each_process and task->mm Anton Vorontsov
2012-02-07 6:49 ` [PATCH 1/8] sysrq: Fix possible race with exiting task Anton Vorontsov
2012-02-09 1:47 ` David Rientjes
2012-02-07 6:49 ` [PATCH 2/8] sysrq: Properly check for kernel threads Anton Vorontsov
2012-02-09 1:46 ` David Rientjes
2012-02-07 6:50 ` [PATCH 3/8] arm: Fix possible race on task->mm Anton Vorontsov
2012-02-08 16:08 ` Oleg Nesterov
2012-02-09 15:33 ` Anton Vorontsov
2012-02-09 15:43 ` Anton Vorontsov
2012-02-10 20:21 ` Oleg Nesterov
2012-02-09 1:46 ` David Rientjes
2012-02-07 6:50 ` [PATCH 4/8] powerpc/mm: " Anton Vorontsov
2012-02-07 6:50 ` [PATCH 5/8] sh: " Anton Vorontsov
2012-02-07 6:50 ` [PATCH 6/8] blackfin: " Anton Vorontsov
2012-02-08 16:20 ` Oleg Nesterov
2012-02-07 6:51 ` [PATCH 7/8] um: Should hold tasklist_lock while traversing processes Anton Vorontsov
2012-02-07 6:51 ` [PATCH 8/8] um: Fix possible race on task->mm Anton Vorontsov
2012-02-08 15:59 ` Oleg Nesterov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120208155946.GA17177@redhat.com \
--to=oleg@redhat.com \
--cc=anton.vorontsov@linaro.org \
--cc=benh@kernel.crashing.org \
--cc=ebiederm@xmission.com \
--cc=gregkh@linuxfoundation.org \
--cc=kosaki.motohiro@gmail.com \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=paulmck@linux.vnet.ibm.com \
--cc=richard@nod.at \
--cc=vapier@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).