From: Oleg Nesterov <oleg@tv-sign.ru>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Christoph Hellwig <hch@infradead.org>,
Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] kill_something_info: misc cleanups
Date: Sun, 17 Dec 2006 17:40:19 +0300 [thread overview]
Message-ID: <20061217144019.GA110@tv-sign.ru> (raw)
In-Reply-To: <m18xh6u5pz.fsf@ebiederm.dsl.xmission.com>
On 12/17, Eric W. Biederman wrote:
>
> I am sitting here wondering why we bother to ignore init, as init
> is protected from all signals it doesn't explicitly setup a signal
> handler for.
> ...
> So I believe we can delete we can delete
> the is_init check entirely without changing anything and with a less
> surprising if anyone ever cares.
is_init() is very cheap. But if we send a signal and it is not ignored
we will wake up /sbin/init without good reason, just to complete unneded
do_signal(). Also, we may have a special setup so that this signal really
means something for init (and it has a handler for). In that case the
caller of kill(-1, sig) will be surprised.
Btw, de_thread() already takes care about multithread init, but
get_signal_to_deliver() does not:
if (current == child_reaper(current))
continue;
// handle sig_kernel_stop()/sig_fatal()
This doesn't protect init from SIGKILL if we send it to sub-thread (and
this can happen even if we use kill(1, sig), not tkill). Yes, the main
thread will survive, but still this is not what we want. SIGSTOP will
manage to stop entire group because sub-thread sets ->group_stop_count.
> > Christoph Hellwig <hch@infradead.org> writes:
> >
> > This also looks rather unreadable, an
> >
> > } else if (pid) {
> > ret = kill_pgrp_info(sig, info, find_pid(-pid));
> > } else {
> > ret = kill_pgrp_info(sig, info, task_pgrp(current));
> > }
> >
> > might be slightly more code, but also a lot more readable.
I personally disagree, but this is matter of taste.
Ok, it was a cleanup only, let's forget it.
Still I don't like "p->pid > 1" check. And I don't think we need a new
helper (pid_leader or such) now. When we have multiple pid namespaces
we should rework kill(-1, sig) anyway. Right now this check means
"skip init", nothing more.
Oleg.
next prev parent reply other threads:[~2006-12-17 14:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-16 20:05 [PATCH 1/2] kill_something_info: misc cleanups Oleg Nesterov
2006-12-16 23:10 ` Eric W. Biederman
2006-12-17 0:37 ` Oleg Nesterov
2006-12-17 1:09 ` Eric W. Biederman
2006-12-17 10:18 ` Christoph Hellwig
2006-12-17 11:22 ` Eric W. Biederman
2006-12-17 14:40 ` Oleg Nesterov [this message]
2006-12-18 13:09 ` Eric W. Biederman
2006-12-18 21:24 ` Oleg Nesterov
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=20061217144019.GA110@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@osdl.org \
--cc=ebiederm@xmission.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.