From: "Patrick O'Rourke" <porourke@egenera.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] Prevent max_threads from exceeding PID_MAX
Date: Thu, 7 Mar 2002 15:45:17 -0500 (EST) [thread overview]
Message-ID: <200203072045.PAA08386@egenera.com> (raw)
It is possible on large memory systems that the default process limits
can exceed PID_MAX. This will allow a non-root user to consume all pids
resulting in the kernel to basically hang in get_pid().
The following patch to fork_init() will prevent max_threads from exceeding
PID_MAX.
Pat
--- linux-2.4.19-pre2-x/kernel/fork.c Mon Feb 25 14:38:13 2002
+++ linux-2.4.19-pre2/kernel/fork.c Wed Mar 6 09:15:17 2002
@@ -74,6 +74,11 @@
*/
max_threads = mempages / (THREAD_SIZE/PAGE_SIZE) / 8;
+ /* don't let threads go beyond PID_MAX */
+ if (max_threads > PID_MAX) {
+ max_threads = PID_MAX;
+ }
+
init_task.rlim[RLIMIT_NPROC].rlim_cur = max_threads/2;
init_task.rlim[RLIMIT_NPROC].rlim_max = max_threads/2;
}
next reply other threads:[~2002-03-07 20:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-07 20:45 Patrick O'Rourke [this message]
2002-03-07 22:11 ` [PATCH] Prevent max_threads from exceeding PID_MAX Paul Larson
2002-03-07 22:23 ` [PATCH] Fix for get_pid hang Paul Larson
2002-03-07 22:25 ` Paul Larson
2002-03-08 15:02 ` Patrick O'Rourke
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=200203072045.PAA08386@egenera.com \
--to=porourke@egenera.com \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.