From: Rik van Riel <riel@conectiva.com.br>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, linux-kernel@vger.kernel.org
Subject: [PATCH] saner limit for max_threads
Date: Sun, 17 Jun 2001 23:11:33 -0300 (BRST) [thread overview]
Message-ID: <Pine.LNX.4.21.0106172308240.2056-100000@imladris.rielhome.conectiva> (raw)
Hi,
by default the limit for max_threads is such that
the system will try to allocate up to half the
physical memory in task_structs.
Because for each 8kB task struct we'll often want
a struct_mm, a page directory, 3 page tables and
some more structures, this means that a fork bomb
will leave the box DEAD with root never ever getting
a chance of using his reserved tasks and killing the
bad user.
The patch below adjusts the max_threads calculation
to something which should be more sane, though quite
possibly still to high...
Please apply for the next -pre kernel.
thanks,
Rik
--
http://www.surriel.com/ http://distro.conectiva.com/
--- linux-2.4.6-pre3/kernel/fork.c.orig Sun Jun 17 20:45:54 2001
+++ linux-2.4.6-pre3/kernel/fork.c Sun Jun 17 23:07:20 2001
@@ -70,7 +70,7 @@
* value: the thread structures can take up at most half
* of memory.
*/
- max_threads = mempages / (THREAD_SIZE/PAGE_SIZE) / 2;
+ max_threads = mempages / (THREAD_SIZE/PAGE_SIZE) / 16;
init_task.rlim[RLIMIT_NPROC].rlim_cur = max_threads/2;
init_task.rlim[RLIMIT_NPROC].rlim_max = max_threads/2;
reply other threads:[~2001-06-18 2:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=Pine.LNX.4.21.0106172308240.2056-100000@imladris.rielhome.conectiva \
--to=riel@conectiva.com.br \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.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).