lkml.org 
[lkml]   [2000]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Why wrapping PIDs is evil [was 32bit]
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/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.037 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site