freebsd-dev/sys/compat
Alfred Perlstein c636255150 fix races in the uidinfo subsystem, several problems existed:
1) while allocating a uidinfo struct malloc is called with M_WAITOK,
   it's possible that while asleep another process by the same user
   could have woken up earlier and inserted an entry into the uid
   hash table.  Having redundant entries causes inconsistancies that
   we can't handle.

   fix: do a non-waiting malloc, and if that fails then do a blocking
   malloc, after waking up check that no one else has inserted an entry
   for us already.

2) Because many checks for sbsize were done as "test then set" in a non
   atomic manner it was possible to exceed the limits put up via races.

   fix: instead of querying the count then setting, we just attempt to
   set the count and leave it up to the function to return success or
   failure.

3) The uidinfo code was inlining and repeating, lookups and insertions
   and deletions needed to be in their own functions for clarity.

Reviewed by: green
2000-06-22 22:27:16 +00:00
..
linprocfs Make exe a symlink. 2000-05-24 07:37:02 +00:00
linux Linux allows to mmap annonymous with a file descriptor passed, FreeBSD 2000-06-15 09:57:34 +00:00
netbsd Add $FreeBSD$ 2000-05-01 20:32:07 +00:00
svr4 fix races in the uidinfo subsystem, several problems existed: 2000-06-22 22:27:16 +00:00