cvs commit: src/sys/kern sys_socket.c

Robert Watson rwatson at freebsd.org
Sun Jun 20 19:37:17 PDT 2004


On Sun, 20 Jun 2004, Alfred Perlstein wrote:

> * Robert Watson <rwatson at FreeBSD.org> [040620 10:35] wrote:
> > rwatson     2004-06-20 17:35:50 UTC
> > 
> >   FreeBSD src repository
> > 
> >   Modified files:
> >     sys/kern             sys_socket.c 
> >   Log:
> >   Annotate two intentionally unlocked reads with comments.
> >   
> >   Annotate a potentially inconsistent result returned to user space when
> >   performing fstaT() on a socket due to not using socket buffer locking.
> 
> There really isn't much point in documenting races with userspace. 
> 
> You can't fix them. :) 

The races I'm annotating are in-kernel races that result in potentially
cinconsistent results being returned to userspace.  We can provide stale
and consistent, or stale and inconsistent, and the difference is how much
locking we do in kernel before pushing the information to user space.  In
some places, such as the recent SO_LINGER commit, I've opted for stronger
consistency, and it may be I should make the same choice here too.  Since
I haven't yet made that choice, I've annotated the weakness in the current
code.

There will always be some races with user space that we can't solve, based
on some combination of timeliness, API constraints, etc.  The best we can
hope to do in those cases is provide consistent, if stale, data.  I'm
generally not annotating those races, figuring that if they belong
anywhere, it's in man pages or a book on programming user space apps.

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert at fledge.watson.org      Senior Research Scientist, McAfee Research



More information about the cvs-src mailing list