lkml.org 
[lkml]   [2010]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/4] INIT_TASK() should initialize ->thread_group list
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.



\
 
 \ /
  Last update: 2010-05-12 18:01    [W:0.167 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site