DragonFly commits List (threaded) for 2005-07
cvs commit: src/sys/kern uipc_socket.c uipc_socket2.c src/sys/sys socketvar.h
dillon 2005/07/23 00:28:36 PDT
DragonFly src repository
sys/kern uipc_socket.c uipc_socket2.c
Fix a sockbuf race. Currently the m_free*() path can block, due to
objcache_put() blocking when it must access the global depot. This breaks
the critical section *AND the BGL during a time when the sockbuf state is
inconsistent. Another process accessing the same sockbuf would then
corrupt it. Since depot access is fairly rare, this bug typically required
a number of hours to reproduce.
Delay the actual freeing of mbufs until after the sockbuf state has been
updated. Encapsulate common operations in a procedure, and add additional
assertions. NULL out sb_lastrecord when it becomes invalid, and add a
considerable amount of debugging code.
SOCKBUF_DEBUG has been added. Note that this is a VERY EXPENSIVE
kernel compile option which should only be used when specifically debugging
the networking subsystem.
This is a stabilization patch is rather hackish. A better cleanup will
occur once we are sure we've fixed all the bugs.
sbcheck provided by: Jeffrey Hsu
Reported-by: David Rhodus, Peter Avalos, YONETANI Tomokazu,
Tomaz Borstnar, and numerous other people.
Revision Changes Path
1.36 +80 -72 src/sys/kern/uipc_socket.c
1.22 +168 -58 src/sys/kern/uipc_socket2.c
1.20 +9 -1 src/sys/sys/socketvar.h