From: Lyashkov Alex (shadow_at_itt.net.ru)
Date: Fri 11 Apr 2003 - 15:37:18 BST
On Friday 11 April 2003 10:23, Herbert Poetzl wrote:
> On Fri, Apr 11, 2003 at 07:47:24AM +0300, Lyashkov Alex wrote:
> some kind of kill-every-process in one context
> would be nice ...
>
> consider the folowing script (or try it on your box)
>
> ----------------------
> #!/bin/bash
>
> for n in 1 2; do
> sleep 1
> echo "have a nice day $$/$n ..."
> ( $0 & )
> done
> sleep 5
> ----------------------
it's fork bomb :)
>
> start it in a vserver with, lets say a limit
> of 1000 processes (maximum) and try to kill
> these thing once started ... it's not trivial ...
>
trivial.
It's need add new command in new_s_context syscall.
"stop_vserver".
My patch have list all process in context.
code for this simular:
write_lock(&task_lock); // exclusive blocking.
for_each_task_in_context(ctx,tsk)
{
task_t *task = tsk->task;
force_sig(SIGKILL,task); // or SIGTERM
}
write_unlock(&task_lock);
and block creating new process in context.
correctly ?
-- With best regards, Alex