<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c, branch release/6.0.0_cvs</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>This commit was manufactured by cvs2svn to create tag</title>
<updated>2005-11-03T00:35:26+00:00</updated>
<author>
<name>cvs2svn</name>
<email>cvs2svn@FreeBSD.org</email>
</author>
<published>2005-11-03T00:35:26+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=3640cb54210edbb7edbf1b12ef0127ecfcea967d'/>
<id>3640cb54210edbb7edbf1b12ef0127ecfcea967d</id>
<content type='text'>
'RELENG_6_0_0_RELEASE'.

This commit was manufactured to restore the state of the 6.0-RELEASE image.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
'RELENG_6_0_0_RELEASE'.

This commit was manufactured to restore the state of the 6.0-RELEASE image.
</pre>
</div>
</content>
</entry>
<entry>
<title>In the current world order, solisten() implements the state transition of</title>
<updated>2005-02-21T21:58:17+00:00</updated>
<author>
<name>Robert Watson</name>
<email>rwatson@FreeBSD.org</email>
</author>
<published>2005-02-21T21:58:17+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=0daccb9c9439393cb1c83104717ab7e0e4db26b0'/>
<id>0daccb9c9439393cb1c83104717ab7e0e4db26b0</id>
<content type='text'>
a socket from a regular socket to a listening socket able to accept new
connections.  As part of this state transition, solisten() calls into the
protocol to update protocol-layer state.  There were several bugs in this
implementation that could result in a race wherein a TCP SYN received
in the interval between the protocol state transition and the shortly
following socket layer transition would result in a panic in the TCP code,
as the socket would be in the TCPS_LISTEN state, but the socket would not
have the SO_ACCEPTCONN flag set.

This change does the following:

- Pushes the socket state transition from the socket layer solisten() to
  to socket "library" routines called from the protocol.  This permits
  the socket routines to be called while holding the protocol mutexes,
  preventing a race exposing the incomplete socket state transition to TCP
  after the TCP state transition has completed.  The check for a socket
  layer state transition is performed by solisten_proto_check(), and the
  actual transition is performed by solisten_proto().

- Holds the socket lock for the duration of the socket state test and set,
  and over the protocol layer state transition, which is now possible as
  the socket lock is acquired by the protocol layer, rather than vice
  versa.  This prevents additional state related races in the socket
  layer.

This permits the dual transition of socket layer and protocol layer state
to occur while holding locks for both layers, making the two changes
atomic with respect to one another.  Similar changes are likely require
elsewhere in the socket/protocol code.

Reported by:		Peter Holm &lt;peter@holm.cc&gt;
Review and fixes from:	emax, Antoine Brodin &lt;antoine.brodin@laposte.net&gt;
Philosophical head nod:	gnn
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
a socket from a regular socket to a listening socket able to accept new
connections.  As part of this state transition, solisten() calls into the
protocol to update protocol-layer state.  There were several bugs in this
implementation that could result in a race wherein a TCP SYN received
in the interval between the protocol state transition and the shortly
following socket layer transition would result in a panic in the TCP code,
as the socket would be in the TCPS_LISTEN state, but the socket would not
have the SO_ACCEPTCONN flag set.

This change does the following:

- Pushes the socket state transition from the socket layer solisten() to
  to socket "library" routines called from the protocol.  This permits
  the socket routines to be called while holding the protocol mutexes,
  preventing a race exposing the incomplete socket state transition to TCP
  after the TCP state transition has completed.  The check for a socket
  layer state transition is performed by solisten_proto_check(), and the
  actual transition is performed by solisten_proto().

- Holds the socket lock for the duration of the socket state test and set,
  and over the protocol layer state transition, which is now possible as
  the socket lock is acquired by the protocol layer, rather than vice
  versa.  This prevents additional state related races in the socket
  layer.

This permits the dual transition of socket layer and protocol layer state
to occur while holding locks for both layers, making the two changes
atomic with respect to one another.  Similar changes are likely require
elsewhere in the socket/protocol code.

Reported by:		Peter Holm &lt;peter@holm.cc&gt;
Review and fixes from:	emax, Antoine Brodin &lt;antoine.brodin@laposte.net&gt;
Philosophical head nod:	gnn
</pre>
</div>
</content>
</entry>
<entry>
<title>/* -&gt; /*- for license, minor formatting changes</title>
<updated>2005-01-07T01:45:51+00:00</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2005-01-07T01:45:51+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=c398230b64aea809cb7c5cea8db580af7097920c'/>
<id>c398230b64aea809cb7c5cea8db580af7097920c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Push acquisition of the accept mutex out of sofree() into the caller</title>
<updated>2004-10-18T22:19:43+00:00</updated>
<author>
<name>Robert Watson</name>
<email>rwatson@FreeBSD.org</email>
</author>
<published>2004-10-18T22:19:43+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=81158452be7803fda8aa36feb4464d5301dce85c'/>
<id>81158452be7803fda8aa36feb4464d5301dce85c</id>
<content type='text'>
(sorele()/sotryfree()):

- This permits the caller to acquire the accept mutex before the socket
  mutex, avoiding sofree() having to drop the socket mutex and re-order,
  which could lead to races permitting more than one thread to enter
  sofree() after a socket is ready to be free'd.

- This also covers clearing of the so_pcb weak socket reference from
  the protocol to the socket, preventing races in clearing and
  evaluation of the reference such that sofree() might be called more
  than once on the same socket.

This appears to close a race I was able to easily trigger by repeatedly
opening and resetting TCP connections to a host, in which the
tcp_close() code called as a result of the RST raced with the close()
of the accepted socket in the user process resulting in simultaneous
attempts to de-allocate the same socket.  The new locking increases
the overhead for operations that may potentially free the socket, so we
will want to revise the synchronization strategy here as we normalize
the reference counting model for sockets.  The use of the accept mutex
in freeing of sockets that are not listen sockets is primarily
motivated by the potential need to remove the socket from the
incomplete connection queue on its parent (listen) socket, so cleaning
up the reference model here may allow us to substantially weaken the
synchronization requirements.

RELENG_5_3 candidate.

MFC after:	3 days
Reviewed by:	dwhite
Discussed with:	gnn, dwhite, green
Reported by:	Marc UBM Bocklet &lt;ubm at u-boot-man dot de&gt;
Reported by:	Vlad &lt;marchenko at gmail dot com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(sorele()/sotryfree()):

- This permits the caller to acquire the accept mutex before the socket
  mutex, avoiding sofree() having to drop the socket mutex and re-order,
  which could lead to races permitting more than one thread to enter
  sofree() after a socket is ready to be free'd.

- This also covers clearing of the so_pcb weak socket reference from
  the protocol to the socket, preventing races in clearing and
  evaluation of the reference such that sofree() might be called more
  than once on the same socket.

This appears to close a race I was able to easily trigger by repeatedly
opening and resetting TCP connections to a host, in which the
tcp_close() code called as a result of the RST raced with the close()
of the accepted socket in the user process resulting in simultaneous
attempts to de-allocate the same socket.  The new locking increases
the overhead for operations that may potentially free the socket, so we
will want to revise the synchronization strategy here as we normalize
the reference counting model for sockets.  The use of the accept mutex
in freeing of sockets that are not listen sockets is primarily
motivated by the potential need to remove the socket from the
incomplete connection queue on its parent (listen) socket, so cleaning
up the reference model here may allow us to substantially weaken the
synchronization requirements.

RELENG_5_3 candidate.

MFC after:	3 days
Reviewed by:	dwhite
Discussed with:	gnn, dwhite, green
Reported by:	Marc UBM Bocklet &lt;ubm at u-boot-man dot de&gt;
Reported by:	Vlad &lt;marchenko at gmail dot com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Extend coverage of SOCK_LOCK(so) to include so_count, the socket</title>
<updated>2004-06-12T20:47:32+00:00</updated>
<author>
<name>Robert Watson</name>
<email>rwatson@FreeBSD.org</email>
</author>
<published>2004-06-12T20:47:32+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=395a08c90416e029c757cb51721b87b83fd0194b'/>
<id>395a08c90416e029c757cb51721b87b83fd0194b</id>
<content type='text'>
reference count:

- Assert SOCK_LOCK(so) macros that directly manipulate so_count:
  soref(), sorele().

- Assert SOCK_LOCK(so) in macros/functions that rely on the state of
  so_count: sofree(), sotryfree().

- Acquire SOCK_LOCK(so) before calling these functions or macros in
  various contexts in the stack, both at the socket and protocol
  layers.

- In some cases, perform soisdisconnected() before sotryfree(), as
  this could result in frobbing of a non-present socket if
  sotryfree() actually frees the socket.

- Note that sofree()/sotryfree() will release the socket lock even if
  they don't free the socket.

Submitted by:	sam
Sponsored by:	FreeBSD Foundation
Obtained from:	BSD/OS
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
reference count:

- Assert SOCK_LOCK(so) macros that directly manipulate so_count:
  soref(), sorele().

- Assert SOCK_LOCK(so) in macros/functions that rely on the state of
  so_count: sofree(), sotryfree().

- Acquire SOCK_LOCK(so) before calling these functions or macros in
  various contexts in the stack, both at the socket and protocol
  layers.

- In some cases, perform soisdisconnected() before sotryfree(), as
  this could result in frobbing of a non-present socket if
  sotryfree() actually frees the socket.

- Note that sofree()/sotryfree() will release the socket lock even if
  they don't free the socket.

Submitted by:	sam
Sponsored by:	FreeBSD Foundation
Obtained from:	BSD/OS
</pre>
</div>
</content>
</entry>
<entry>
<title>Switch to using C99 sparse initialisers for the type methods array.</title>
<updated>2004-05-29T00:51:19+00:00</updated>
<author>
<name>Julian Elischer</name>
<email>julian@FreeBSD.org</email>
</author>
<published>2004-05-29T00:51:19+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=f8aae7776f85d2fa8aa93f73c37782cd9e1204c6'/>
<id>f8aae7776f85d2fa8aa93f73c37782cd9e1204c6</id>
<content type='text'>
Should make no binary difference.

Submitted by:	Gleb Smirnoff &lt;glebius@cell.sick.ru&gt;
Reviewed by:	Harti Brandt &lt;harti@freebsd.org&gt;
MFC after:	1 week
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Should make no binary difference.

Submitted by:	Gleb Smirnoff &lt;glebius@cell.sick.ru&gt;
Reviewed by:	Harti Brandt &lt;harti@freebsd.org&gt;
MFC after:	1 week
</pre>
</div>
</content>
</entry>
<entry>
<title>Address few style issues pointed out by bde</title>
<updated>2004-04-27T16:38:15+00:00</updated>
<author>
<name>Maksim Yevmenkin</name>
<email>emax@FreeBSD.org</email>
</author>
<published>2004-04-27T16:38:15+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=b84b10f92fe9e702a9f39d4c6b5c4ce70669fa25'/>
<id>b84b10f92fe9e702a9f39d4c6b5c4ce70669fa25</id>
<content type='text'>
Reviewed by:	bde, ru
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reviewed by:	bde, ru
</pre>
</div>
</content>
</entry>
<entry>
<title>Rename dup_sockaddr() to sodupsockaddr() for consistency with other</title>
<updated>2004-03-01T03:14:23+00:00</updated>
<author>
<name>Robert Watson</name>
<email>rwatson@FreeBSD.org</email>
</author>
<published>2004-03-01T03:14:23+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=746e5bf09b1bac72c432687fb613f5e9fbd4a6f2'/>
<id>746e5bf09b1bac72c432687fb613f5e9fbd4a6f2</id>
<content type='text'>
functions in kern_socket.c.

Rename the "canwait" field to "mflags" and pass M_WAITOK and M_NOWAIT
in from the caller context rather than "1" or "0".

Correct mflags pass into mac_init_socket() from previous commit to not
include M_ZERO.

Submitted by:	sam
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
functions in kern_socket.c.

Rename the "canwait" field to "mflags" and pass M_WAITOK and M_NOWAIT
in from the caller context rather than "1" or "0".

Correct mflags pass into mac_init_socket() from previous commit to not
include M_ZERO.

Submitted by:	sam
</pre>
</div>
</content>
</entry>
<entry>
<title>NULL -&gt; 0 where appropriate.</title>
<updated>2003-12-24T18:51:01+00:00</updated>
<author>
<name>Alfred Perlstein</name>
<email>alfred@FreeBSD.org</email>
</author>
<published>2003-12-24T18:51:01+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=b9fe2d6cc2b2c0e515e6c7714a98caddb4ab2326'/>
<id>b9fe2d6cc2b2c0e515e6c7714a98caddb4ab2326</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Update Bluetooth code.</title>
<updated>2003-10-12T22:04:24+00:00</updated>
<author>
<name>Maksim Yevmenkin</name>
<email>emax@FreeBSD.org</email>
</author>
<published>2003-10-12T22:04:24+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=0986ab12e44caea472245845f9a89ced4f137d73'/>
<id>0986ab12e44caea472245845f9a89ced4f137d73</id>
<content type='text'>
Reviewed by: M. Warner Losh &lt;imp@bsdimp.com&gt;; John Hay &lt;jhay@freebsd.org&gt;
Approved by: M. Warner Losh &lt;imp@bsdimp.com&gt; (mentor)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reviewed by: M. Warner Losh &lt;imp@bsdimp.com&gt;; John Hay &lt;jhay@freebsd.org&gt;
Approved by: M. Warner Losh &lt;imp@bsdimp.com&gt; (mentor)
</pre>
</div>
</content>
</entry>
</feed>
