From owner-freebsd-net Fri Sep 8 15:57:16 2000 Delivered-To: freebsd-net@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 555C837B50B; Fri, 8 Sep 2000 15:57:13 -0700 (PDT) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id e88MvCj17036; Fri, 8 Sep 2000 15:57:12 -0700 (PDT) Date: Fri, 8 Sep 2000 15:57:12 -0700 From: Alfred Perlstein To: Garrett Wollman Cc: wollman@freebsd.org, net@freebsd.org Subject: Re: Your comment re so_gencnt Message-ID: <20000908155712.L12231@fw.wintelcom.net> References: <20000908142322.I12231@fw.wintelcom.net> <200009082234.SAA56346@khavrinen.lcs.mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.4i In-Reply-To: <200009082234.SAA56346@khavrinen.lcs.mit.edu>; from wollman@khavrinen.lcs.mit.edu on Fri, Sep 08, 2000 at 06:34:08PM -0400 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org * Garrett Wollman [000908 15:34] wrote: > < said: > > > /* XXX race condition for reentrant kernel */ > > bzero(so, sizeof *so); > > so->so_gencnt = ++so_gencnt; > > > Is the race condition on the ++so_gencnt? > > No, the race condition is between the bzero (which might set > so->so_gencnt to a currently-valid value) and the assignment to > so->so_gencnt. Statistically speaking, it's a fairly unlikely race, > but the correct thing to do would be to zero everything *but* the > generation count, and do the assignment before zeroing anything. I > didn't want to worry about that case. (I probably should have written > ``preemptible'' rather than ``reentrant'' there.) From reading the code there doesn't seem to be a single place that reads the gencount in the socket, except the xsocket stuff. I'm tempted to remove it, am I missing something though? -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message