svn commit: r239329 - head/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Thu Aug 16 13:04:22 UTC 2012
Author: kib
Date: Thu Aug 16 13:04:21 2012
New Revision: 239329
URL: http://svn.freebsd.org/changeset/base/239329
Log:
As a safety measure, disable lowering pid_max too much.
Requested by: Peter Jeremy <peter at rulingia.com>
MFC after: 1 week
Modified:
head/sys/kern/kern_mib.c
head/sys/kern/subr_param.c
Modified: head/sys/kern/kern_mib.c
==============================================================================
--- head/sys/kern/kern_mib.c Thu Aug 16 13:01:56 2012 (r239328)
+++ head/sys/kern/kern_mib.c Thu Aug 16 13:04:21 2012 (r239329)
@@ -510,8 +510,12 @@ sysctl_kern_pid_max(SYSCTL_HANDLER_ARGS)
return (error);
sx_xlock(&proctree_lock);
sx_xlock(&allproc_lock);
- /* Only permit the values less then PID_MAX. */
- if (pm > PID_MAX)
+
+ /*
+ * Only permit the values less then PID_MAX.
+ * As a safety measure, do not allow to limit the pid_max too much.
+ */
+ if (pm < 300 || pm > PID_MAX)
error = EINVAL;
else
pid_max = pm;
Modified: head/sys/kern/subr_param.c
==============================================================================
--- head/sys/kern/subr_param.c Thu Aug 16 13:01:56 2012 (r239328)
+++ head/sys/kern/subr_param.c Thu Aug 16 13:04:21 2012 (r239329)
@@ -255,10 +255,13 @@ init_param1(void)
/*
* Only allow to lower the maximal pid.
+ * Prevent setting up a non-bootable system if pid_max is too low.
*/
TUNABLE_INT_FETCH("kern.pid_max", &pid_max);
if (pid_max > PID_MAX)
pid_max = PID_MAX;
+ else if (pid_max < 300)
+ pid_max = 300;
}
/*
More information about the svn-src-head
mailing list