Date: Fri, 8 Sep 2000 15:57:12 -0700 From: Alfred Perlstein <bright@wintelcom.net> To: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> Cc: wollman@freebsd.org, net@freebsd.org Subject: Re: Your comment re so_gencnt Message-ID: <20000908155712.L12231@fw.wintelcom.net> 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 References: <20000908142322.I12231@fw.wintelcom.net> <200009082234.SAA56346@khavrinen.lcs.mit.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
* Garrett Wollman <wollman@khavrinen.lcs.mit.edu> [000908 15:34] wrote: > <<On Fri, 8 Sep 2000 14:23:23 -0700, Alfred Perlstein <bright@wintelcom.net> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000908155712.L12231>