linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Cedric Le Goater <clg@vnet.ibm.com>,
	Dave Hansen <haveblue@us.ibm.com>,
	Eric Biederman <ebiederm@xmission.com>,
	Herbert Poetzl <herbert@13thfloor.at>,
	Ingo Molnar <mingo@elte.hu>,
	Mathias Krause <Mathias.Krause@secunet.com>,
	Roland McGrath <roland@redhat.com>,
	Serge Hallyn <serue@us.ibm.com>,
	Sukadev Bhattiprolu <sukadev@us.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] INIT_TASK() should initialize ->thread_group list
Date: Wed, 12 May 2010 17:54:53 +0200	[thread overview]
Message-ID: <20100512155453.GA20906@redhat.com> (raw)
In-Reply-To: <20100512021537.GA11805@us.ibm.com>

On 05/11, Sukadev Bhattiprolu wrote:
>
> Oleg Nesterov [oleg@redhat.com] wrote:
> | The trivial /sbin/init doing
> |
> | 	int main(void)
> | 	{
> | 		kill(0, SIGKILL)
> | 	}
> |
> | crashes the kernel.
>
> Really subtle. Good catch.

Thanks to Mathias ;)

> So, now init is not part of any process group until it calls setsid().
> So the above SIGKILL is lost right ? - i.e it does not kill even init
> itself.

No, no. swapper != init. With or without these patches (more precisely,
the next patch) /sbin/init still belongs to the 0 pgrp/sid.

> In my quick test, the following init process lives on inspite of the
> SIGKILL.

Yes, /sbin/init is not killable, that is why it survies.

But:

> 	main()
> 	{
> 		kill(0, SIGKILL);
>
> 		while(1)
> 			sleep(1);
> 	}

Yes. if /sbin/init exits the kernel panics. The real test-case shouldn't
exit, like your example.

> I don't have a better solution. Maybe a hung init is better than a
> crashed kernel.

Agreed!!! I sent the patch a long ago. But security people do not
like it, they use exit() from init to provoke the crash intentionally.
And I still think they are wrong, but this is another story.

> Acked-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>

Thanks!

Oleg.


  reply	other threads:[~2010-05-12 15:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4BE01C86.3050908@secunet.com>
2010-05-09 18:45 ` kernel panic on kill(0, SIGTERM) with PGID == 0 Oleg Nesterov
2010-05-09 19:06   ` Oleg Nesterov
2010-05-10  7:20   ` Mathias Krause
2010-05-10 19:49     ` [PATCH 0/4] swapper fixes (Was: kernel panic on kill(0, SIGTERM) with PGID == 0) Oleg Nesterov
2010-05-10 19:49       ` [PATCH 1/4] INIT_TASK() should initialize ->thread_group list Oleg Nesterov
2010-05-11  7:52         ` Serge E. Hallyn
2010-05-12  2:15         ` Sukadev Bhattiprolu
2010-05-12 15:54           ` Oleg Nesterov [this message]
2010-05-10 19:50       ` [PATCH 2/4] pids: init_struct_pid.tasks should never see the swapper process Oleg Nesterov
2010-05-11  9:54         ` Serge E. Hallyn
2010-05-12 16:03           ` Oleg Nesterov
2010-05-10 19:50       ` [PATCH 3/4] pids: fix fork_idle() to setup ->pids correctly Oleg Nesterov
2010-05-11  8:54         ` Serge E. Hallyn
2010-05-10 19:51       ` [PATCH 4/4] INIT_SIGHAND: use SIG_DFL instead of NULL Oleg Nesterov
2010-05-11  8:54         ` Serge E. Hallyn
2010-05-10 21:08       ` [PATCH 0/4] swapper fixes (Was: kernel panic on kill(0, SIGTERM) with PGID == 0) Andrew Morton
2010-05-10 21:41         ` Oleg Nesterov
2010-05-10 23:55       ` Roland McGrath

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=20100512155453.GA20906@redhat.com \
    --to=oleg@redhat.com \
    --cc=Mathias.Krause@secunet.com \
    --cc=akpm@linux-foundation.org \
    --cc=clg@vnet.ibm.com \
    --cc=ebiederm@xmission.com \
    --cc=haveblue@us.ibm.com \
    --cc=herbert@13thfloor.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=roland@redhat.com \
    --cc=serue@us.ibm.com \
    --cc=sukadev@linux.vnet.ibm.com \
    --cc=sukadev@us.ibm.com \
    /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).