From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"kosaki.motohiro@jp.fujitsu.com" <kosaki.motohiro@jp.fujitsu.com>,
rientjes@google.com, Oleg Nesterov <oleg@redhat.com>,
Andrey Vagin <avagin@openvz.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"minchan.kim@gmail.com" <minchan.kim@gmail.com>
Subject: Re: [RFC][PATCH] fork bomb killer
Date: Tue, 15 Mar 2011 12:42:26 +0200 [thread overview]
Message-ID: <20110315104226.GB10165@shutemov.name> (raw)
In-Reply-To: <20110315185242.9533e65b.kamezawa.hiroyu@jp.fujitsu.com>
On Tue, Mar 15, 2011 at 06:52:42PM +0900, KAMEZAWA Hiroyuki wrote:
> While testing Andrey's case, I confirmed I need to reboot the system by
> power off when I ran a fork-bomb. The speed of fork() is much faster
> than some smart killing as pkill(1) and oom-killer cannot reach the speed.
>
> I wonder it's better to have a fork-bomb killer even if it's a just heuristic
> method. This is a one. This one works fine with Andrey's case and I don't need
> to reboot more. And I confirmed this can kill a case like
>
> while True:
> os.fork()
>
> BTW, does usual man see fork-bomb in a production system ?
> I saw only once which was caused be a shell script.
>
> ==
> A fork bomb killer.
>
> When fork-bomb runs, the system exhausts memory and we need to
> reboot the system, in usual. The oom-killer or admin's killall
> is slower than fork-bomb if system memory is exhausted.
>
> So, fork-bomb-killer is appreciated even if it's a just heuristic.
>
> This patch implements a heuristic for fork-bomb. The logic finds
> a fork bomb which
> - has spawned 10+ tasks recently (10 min).
> - aggregate score of bomb is larger than the baddest task's badness.
>
> When fork-bomb found,
> - new fork in the session under where fork bomb is will return -ENOMEM
> for the next 30secs.
-EAGAIN is more appropiate, I think. At least -EAGAIN returns if
RLIMIT_NPROC resource limit was encountered.
Will the fork-bomb-killer work, if a fork-bomb calls setsid() before
fork()?
> - all tasks of fork-bomb will be killed.
>
> Note:
> - I wonder I shoud add a sysctl knob for this.
>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
--
Kirill A. Shutemov
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-03-15 10:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-15 9:52 [RFC][PATCH] fork bomb killer KAMEZAWA Hiroyuki
2011-03-15 10:42 ` Kirill A. Shutemov [this message]
2011-03-15 23:55 ` KAMEZAWA Hiroyuki
2011-03-15 14:33 ` Oleg Nesterov
2011-03-16 0:34 ` KAMEZAWA Hiroyuki
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=20110315104226.GB10165@shutemov.name \
--to=kirill@shutemov.name \
--cc=akpm@linux-foundation.org \
--cc=avagin@openvz.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=minchan.kim@gmail.com \
--cc=oleg@redhat.com \
--cc=rientjes@google.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).