From owner-cvs-all Thu Jun 22 15:27:20 2000 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 6765E37BECD; Thu, 22 Jun 2000 15:27:17 -0700 (PDT) (envelope-from alfred@FreeBSD.org) Received: (from alfred@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id PAA81776; Thu, 22 Jun 2000 15:27:17 -0700 (PDT) (envelope-from alfred@FreeBSD.org) Message-Id: <200006222227.PAA81776@freefall.freebsd.org> From: Alfred Perlstein Date: Thu, 22 Jun 2000 15:27:17 -0700 (PDT) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/kern init_main.c kern_exit.c kern_fork.c kern_proc.c kern_prot.c uipc_socket.c uipc_socket2.c uipc_usrreq.c src/sys/svr4 svr4_misc.c src/sys/sys proc.h X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG alfred 2000/06/22 15:27:17 PDT Modified files: sys/kern init_main.c kern_exit.c kern_fork.c kern_proc.c kern_prot.c uipc_socket.c uipc_socket2.c uipc_usrreq.c sys/svr4 svr4_misc.c sys/sys proc.h Log: 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 Revision Changes Path 1.135 +2 -2 src/sys/kern/init_main.c 1.98 +2 -2 src/sys/kern/kern_exit.c 1.76 +4 -5 src/sys/kern/kern_fork.c 1.66 +92 -54 src/sys/kern/kern_proc.c 1.59 +7 -7 src/sys/kern/kern_prot.c 1.78 +3 -3 src/sys/kern/uipc_socket.c 1.60 +5 -5 src/sys/kern/uipc_socket2.c 1.55 +4 -3 src/sys/kern/uipc_usrreq.c 1.15 +2 -2 src/sys/svr4/svr4_misc.c 1.106 +3 -3 src/sys/sys/proc.h To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message