Re: Why wrapping PIDs is evil [was 32bit]

From: almesber@lrc.di.epfl.ch
Date: Mon Jan 17 2000 - 17:46:23 EST


Stefan Monnier wrote:
> allow a potential killer to hold on to a process (preventing its
> entry from being reused)

... with dire implications if you fail to kill after grabbing or are
evil-minded.

What about a much simpler solution:
 - make PIDs very long (e.g. 32 bits)
 - only expose 15 bits, as we do now
 - make sure PIDs are unique within the lower 15 bits (otherwise,
   programs using 15 bit PIDs would see duplicate processes)
 - start counting PIDs at a value >= 32768
 - include the full PID somewhere in /proc/<PID>/stat
 - change the kill system call such that it looks for
   process->pid == pid if pid >> 15, or
   !((process->pid ^ pid) & 0x7fff) PID & 0x7fff otherwise
 - extend programs like killall and fuser to use the long PID from
   stat
 - use only those programs for killing (extending the normal ps and
   kill would of course be trivial, too)

If you put the kernel side of all this into 2.3/2.4, I'll make the
necessary extension to killall and fuser. Do we have a deal ? ;-)

- Werner

-- 
  _________________________________________________________________________
 / Werner Almesberger, ICA, EPFL, CH       werner.almesberger@ica.epfl.ch /
/_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jan 23 2000 - 21:00:16 EST