As a safety measure, disable lowering pid_max too much.
Requested by: Peter Jeremy <peter@rulingia.com> MFC after: 1 week
This commit is contained in:
parent
abce621c3a
commit
3fa615bc11
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user