Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Sep 2000 18:34:08 -0400 (EDT)
From:      Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To:        Alfred Perlstein <bright@wintelcom.net>
Cc:        wollman@freebsd.org, net@freebsd.org
Subject:   Your comment re so_gencnt
Message-ID:  <200009082234.SAA56346@khavrinen.lcs.mit.edu>
In-Reply-To: <20000908142322.I12231@fw.wintelcom.net>
References:  <20000908142322.I12231@fw.wintelcom.net>

next in thread | previous in thread | raw e-mail | index | archive | help
<<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.)

-GAWollman



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?200009082234.SAA56346>