linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: random PID generation
@ 2001-02-23 13:20 Heusden, Folkert van
  2001-02-23 14:18 ` bert hubert
  0 siblings, 1 reply; 10+ messages in thread
From: Heusden, Folkert van @ 2001-02-23 13:20 UTC (permalink / raw)
  To: Linux Kernel Development, ahu

>> I wrote a patch against 2.2.18 and 2.4.1 to have the kernel generate 
>> random PIDs. You can find it at http://vanheusden.com/Linux/security.php3

>> (amongst other patches). Beware: pretty much experimental and likely to 
>> make your linux-pc perform like a win95 platform. 
> Well - I'm not sure that this is a good idea. When PIDs increase 
> monotonically, chances are very small that the race condition implicit in 
> sending any signal to a process results in killing the wrong process (ie,
a 
> new process, but with the same PID) - you'd need to zoom through 32000
PIDs 
> in a very short time to make this happen. 
> With truly random PIDs, there is a much larger chance of a new process 
> sitting on a recently used PID. 

My code runs trough the whole task_list to see if a chosen pid is already
in use or not.

> What would work is to have cryptographically randomly generated PIDs which

> would then guarantee not to return a previously returned number within
32000 
> tries, and also not be predictable - there must be algoritms out there
which 
> do this. 

That's also an option!
But for simplicity-sake, I used the get_random_bytes() function (from
the /dev/random-device) combined with a loop. It's a simplistic hack, but
it'll work for my paranoia mind :o)


Greetings,

Folkert van Heusden

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: random PID generation
@ 2001-02-27 10:35 Heusden, Folkert van
  0 siblings, 0 replies; 10+ messages in thread
From: Heusden, Folkert van @ 2001-02-27 10:35 UTC (permalink / raw)
  To: sean; +Cc: Linux Kernel Development

> I have already written a 2.2 implementation which does not suffer from
these 
> problems.

Yes, someone pointed me at it. To be honest (and with all due respect): I
found
it to be a bit over-complicated. Like; in my opinion it's only usefull to
have
absolute random chosen PIDs, or not. Not all those options are needed in my
opinion.

> It was rejected because Alan Cox (and others) felt it only provided 
> security through obscurity. 

Yeah, well, yeah. My patch wasn't actually ment to be included in the main-
kernel. I agree with the security-by-obscurity argument altough I think it's
_not ALWAYS_ a bad thing.
What I am trying to say is: I agree that sofware should be written so that
they can't be exploited in one way or another. But since software is written
by humans, it's likely that bugs stay always in. Furthermore; it's always
possible that in the future new exploits are invented which exploit things
the original programmer didn't think of, and also; new libcs might have
security-problems which affect your software. To prevent that your system
gets cracked by some script-kiddie, I found it a good thing to patch the
mainstream-kernel with patches that disable executable stacks, make the
/proc filesystem more restricted, etc. etc. And in my quest for creating a
secure-as-possible system which anticipates on future exploits I found that
using random PIDs is a good thing.
I hope I made myself clear; english is not my native language which makes
this a rather big chalenge.


Greetings,
Folkert van Heusden
[ www.vanheusden.com ]

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: random PID generation
@ 2001-02-23 15:34 Heusden, Folkert van
  2001-02-23 15:40 ` Matt Johnston
  0 siblings, 1 reply; 10+ messages in thread
From: Heusden, Folkert van @ 2001-02-23 15:34 UTC (permalink / raw)
  To: ahu, Linux Kernel Development

>> My code runs trough the whole task_list to see if a chosen pid is already

>> in use or not. 
> But it doesn't check for a recently used PID. Lets say your system is 
> exhausting 1000 PIDs/second, and that there is a window of 20ms between
you 
> determining which PID to send to, and the recipient process receiving it. 

Ah, I get your point. Good point :o)

I was thinking: I could split the PIDs up in 2...16383 and 16384-32767 and
then
switch between them when a process ends? nah, that doesn't help it.
hmmm.
I think random increments (instead of last_pid+1) would be the best thing to
do then?



^ permalink raw reply	[flat|nested] 10+ messages in thread
* random PID generation
@ 2001-02-22 15:35 Heusden, Folkert van
  2001-02-22 22:24 ` bert hubert
  0 siblings, 1 reply; 10+ messages in thread
From: Heusden, Folkert van @ 2001-02-22 15:35 UTC (permalink / raw)
  To: Linux Kernel Development

Hi,

I wrote a patch against 2.2.18 and 2.4.1 to have the kernel generate random
PIDs.
You can find it at http://vanheusden.com/Linux/security.php3 (amongst other
patches).
Beware: pretty much experimental and likely to make your linux-pc perform
like a
win95 platform.


Greetings,

Folkert van Heusden

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2001-02-27 10:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-23 13:20 random PID generation Heusden, Folkert van
2001-02-23 14:18 ` bert hubert
  -- strict thread matches above, loose matches on Subject: below --
2001-02-27 10:35 Heusden, Folkert van
2001-02-23 15:34 Heusden, Folkert van
2001-02-23 15:40 ` Matt Johnston
2001-02-23 17:14   ` Sean Hunter
2001-02-23 17:50     ` Richard B. Johnson
2001-02-22 15:35 Heusden, Folkert van
2001-02-22 22:24 ` bert hubert
2001-02-22 21:42   ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).