[MLUG] Process ID recycling

Nick Sklav sklav at teksavvy.com
Thu Jul 17 14:30:51 EDT 2008


On Thu, 2008-07-17 at 11:57 -0400, Patrick McLean wrote:
> David Filion wrote:
> > Anyone know what the turnaround time or rule is on a process id being 
> > reused? 
> > 
> > I'm looking for ways to kill a process after a fixed amount of time.  
> > None of the scripts I've seen so far check that the process ID they 
> > saved after the fork/exec actually belongs to the process they launched.
> > 
> 
> Generally it loops when it reaches the value in 
> /proc/sys/kernel/pid_max, it just allocates sequentially from the PID's 
> that aren't already in use.
> 
> You could just check if /proc/$PID/cmdline matches the command line of 
> the process you want to kill, you can also check if the start time is 
> what you think it should be. You can get the full start time of a 
> process with "ps h PID -o lstart".

Would it not make more sense from a security stand point for the proc ID
to be randomized like you can do on the *BSD's?



More information about the mlug mailing list