Re: Reserved PID's

James Mastros (abszero@epix.net)
Thu, 24 Jul 1997 16:35:29 -0400


At 12:17 PM 7/24/97 -0700, B. James Phillippe wrote:
>Greetings,
> [...]
> I've considered writing a simple PID reservation patch that would
>reserve a number of PID's (controlled on the fly by echo'ing an int to
>/proc/sys/kernel/reserved-pids) for root use only. It sounds easy enough
>to implement. If all non-reserved PID's are in use and a process attempts
>to be created under a UID >0, kernel would return EGAIN. This would allow
>only root-owned processes to fill the process table. In other cases, the
>superuser would be able to log in and fix the problem.
>
But, I find that in most cases the offending programs are root owned
anyway. Init and inetd normally spawn their processes as root-owned, no?
(I'm not at my Linux box now, I'll check later if I remember.)

> I also considered reserving PID's for processes with a controlling
>tty, but I don't think I'll be able to figure out how to do that.
I don't think processes get a controlling terminal until after they
completely initialize, so that wouldn't be possible.
>
> Anyone have thoughts on this?
Perhaps a patch to SIGTERM the most recently 10 started (non-root if
possible, otherwise kill off root) programs when the process table fills
up? (10 so that it doesn't go into this too often). Even better, if there
are more than one of any given process running, and the process table fills
up, SIGTERM all but one of them.

>
>-bp

-=- James Mastros