/haiku/src/tests/system/network/posixnet/ |
H A D | SocketTests.cpp | 2112748284f2249e5b811947e2fbdc4b95ea95d6 Wed Jan 29 00:16:08 UTC 2020 Kyle Ambroff-Kao <kyle@ambroffkao.com> tcp: Fix KDL when sockets are reused
This fixes a KDL that is triggered by the following scenario.
1. A socket is created, attempting to establish a session between (loopback, ephemeral port) => (remote address, remote port). 2. That socket ends up in the closed state because the remote is not accepting connections. 3. The socket is re-used to connect to a different (remote address, remote port).
The problem is that fConnectionHash is a BOpenHashTable<TCPEndpoint>, and inserting endpoint multiple times can create a linked list cycle (TCPEndpoint is an intrusive linked list node). That means that, even though TCPEndpoint's destructor removes itself from fConnectionHash, there will still be a pointer to it left behind, which means that future accesses within that hash table bucket will result in a segfault.
The added fConnectionHash.Remove(endpoint) here prevents the KDL, as it ensures that socket reuse doesn't result in a cycle.
Fixes #13927, see that ticket for a detailed explanation of the problem.
Also added some regression tests: * Added SocketTests::ClientSocketReuseTest to PosixNetTest, which reproduces this KDL. * BOpenHashTable: Added tests to cover RemoveUnchecked and removal of an object that isn't in the table.
Change-Id: If4bcc1e0d94350a5ad9ba8e7ae6f1b783b3f6d34 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2173 Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
|
H A D | SocketTests.h | 2112748284f2249e5b811947e2fbdc4b95ea95d6 Wed Jan 29 00:16:08 UTC 2020 Kyle Ambroff-Kao <kyle@ambroffkao.com> tcp: Fix KDL when sockets are reused
This fixes a KDL that is triggered by the following scenario.
1. A socket is created, attempting to establish a session between (loopback, ephemeral port) => (remote address, remote port). 2. That socket ends up in the closed state because the remote is not accepting connections. 3. The socket is re-used to connect to a different (remote address, remote port).
The problem is that fConnectionHash is a BOpenHashTable<TCPEndpoint>, and inserting endpoint multiple times can create a linked list cycle (TCPEndpoint is an intrusive linked list node). That means that, even though TCPEndpoint's destructor removes itself from fConnectionHash, there will still be a pointer to it left behind, which means that future accesses within that hash table bucket will result in a segfault.
The added fConnectionHash.Remove(endpoint) here prevents the KDL, as it ensures that socket reuse doesn't result in a cycle.
Fixes #13927, see that ticket for a detailed explanation of the problem.
Also added some regression tests: * Added SocketTests::ClientSocketReuseTest to PosixNetTest, which reproduces this KDL. * BOpenHashTable: Added tests to cover RemoveUnchecked and removal of an object that isn't in the table.
Change-Id: If4bcc1e0d94350a5ad9ba8e7ae6f1b783b3f6d34 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2173 Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
|
H A D | PosixNetTestAddon.cpp | 2112748284f2249e5b811947e2fbdc4b95ea95d6 Wed Jan 29 00:16:08 UTC 2020 Kyle Ambroff-Kao <kyle@ambroffkao.com> tcp: Fix KDL when sockets are reused
This fixes a KDL that is triggered by the following scenario.
1. A socket is created, attempting to establish a session between (loopback, ephemeral port) => (remote address, remote port). 2. That socket ends up in the closed state because the remote is not accepting connections. 3. The socket is re-used to connect to a different (remote address, remote port).
The problem is that fConnectionHash is a BOpenHashTable<TCPEndpoint>, and inserting endpoint multiple times can create a linked list cycle (TCPEndpoint is an intrusive linked list node). That means that, even though TCPEndpoint's destructor removes itself from fConnectionHash, there will still be a pointer to it left behind, which means that future accesses within that hash table bucket will result in a segfault.
The added fConnectionHash.Remove(endpoint) here prevents the KDL, as it ensures that socket reuse doesn't result in a cycle.
Fixes #13927, see that ticket for a detailed explanation of the problem.
Also added some regression tests: * Added SocketTests::ClientSocketReuseTest to PosixNetTest, which reproduces this KDL. * BOpenHashTable: Added tests to cover RemoveUnchecked and removal of an object that isn't in the table.
Change-Id: If4bcc1e0d94350a5ad9ba8e7ae6f1b783b3f6d34 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2173 Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
|
H A D | Jamfile | 2112748284f2249e5b811947e2fbdc4b95ea95d6 Wed Jan 29 00:16:08 UTC 2020 Kyle Ambroff-Kao <kyle@ambroffkao.com> tcp: Fix KDL when sockets are reused
This fixes a KDL that is triggered by the following scenario.
1. A socket is created, attempting to establish a session between (loopback, ephemeral port) => (remote address, remote port). 2. That socket ends up in the closed state because the remote is not accepting connections. 3. The socket is re-used to connect to a different (remote address, remote port).
The problem is that fConnectionHash is a BOpenHashTable<TCPEndpoint>, and inserting endpoint multiple times can create a linked list cycle (TCPEndpoint is an intrusive linked list node). That means that, even though TCPEndpoint's destructor removes itself from fConnectionHash, there will still be a pointer to it left behind, which means that future accesses within that hash table bucket will result in a segfault.
The added fConnectionHash.Remove(endpoint) here prevents the KDL, as it ensures that socket reuse doesn't result in a cycle.
Fixes #13927, see that ticket for a detailed explanation of the problem.
Also added some regression tests: * Added SocketTests::ClientSocketReuseTest to PosixNetTest, which reproduces this KDL. * BOpenHashTable: Added tests to cover RemoveUnchecked and removal of an object that isn't in the table.
Change-Id: If4bcc1e0d94350a5ad9ba8e7ae6f1b783b3f6d34 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2173 Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
|
/haiku/src/tests/system/kernel/util/ |
H A D | BOpenHashTableTest.h | 2112748284f2249e5b811947e2fbdc4b95ea95d6 Wed Jan 29 00:16:08 UTC 2020 Kyle Ambroff-Kao <kyle@ambroffkao.com> tcp: Fix KDL when sockets are reused
This fixes a KDL that is triggered by the following scenario.
1. A socket is created, attempting to establish a session between (loopback, ephemeral port) => (remote address, remote port). 2. That socket ends up in the closed state because the remote is not accepting connections. 3. The socket is re-used to connect to a different (remote address, remote port).
The problem is that fConnectionHash is a BOpenHashTable<TCPEndpoint>, and inserting endpoint multiple times can create a linked list cycle (TCPEndpoint is an intrusive linked list node). That means that, even though TCPEndpoint's destructor removes itself from fConnectionHash, there will still be a pointer to it left behind, which means that future accesses within that hash table bucket will result in a segfault.
The added fConnectionHash.Remove(endpoint) here prevents the KDL, as it ensures that socket reuse doesn't result in a cycle.
Fixes #13927, see that ticket for a detailed explanation of the problem.
Also added some regression tests: * Added SocketTests::ClientSocketReuseTest to PosixNetTest, which reproduces this KDL. * BOpenHashTable: Added tests to cover RemoveUnchecked and removal of an object that isn't in the table.
Change-Id: If4bcc1e0d94350a5ad9ba8e7ae6f1b783b3f6d34 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2173 Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
|
H A D | BOpenHashTableTest.cpp | 2112748284f2249e5b811947e2fbdc4b95ea95d6 Wed Jan 29 00:16:08 UTC 2020 Kyle Ambroff-Kao <kyle@ambroffkao.com> tcp: Fix KDL when sockets are reused
This fixes a KDL that is triggered by the following scenario.
1. A socket is created, attempting to establish a session between (loopback, ephemeral port) => (remote address, remote port). 2. That socket ends up in the closed state because the remote is not accepting connections. 3. The socket is re-used to connect to a different (remote address, remote port).
The problem is that fConnectionHash is a BOpenHashTable<TCPEndpoint>, and inserting endpoint multiple times can create a linked list cycle (TCPEndpoint is an intrusive linked list node). That means that, even though TCPEndpoint's destructor removes itself from fConnectionHash, there will still be a pointer to it left behind, which means that future accesses within that hash table bucket will result in a segfault.
The added fConnectionHash.Remove(endpoint) here prevents the KDL, as it ensures that socket reuse doesn't result in a cycle.
Fixes #13927, see that ticket for a detailed explanation of the problem.
Also added some regression tests: * Added SocketTests::ClientSocketReuseTest to PosixNetTest, which reproduces this KDL. * BOpenHashTable: Added tests to cover RemoveUnchecked and removal of an object that isn't in the table.
Change-Id: If4bcc1e0d94350a5ad9ba8e7ae6f1b783b3f6d34 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2173 Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
|
/haiku/src/add-ons/kernel/network/protocols/tcp/ |
H A D | EndpointManager.cpp | 2112748284f2249e5b811947e2fbdc4b95ea95d6 Wed Jan 29 00:16:08 UTC 2020 Kyle Ambroff-Kao <kyle@ambroffkao.com> tcp: Fix KDL when sockets are reused
This fixes a KDL that is triggered by the following scenario.
1. A socket is created, attempting to establish a session between (loopback, ephemeral port) => (remote address, remote port). 2. That socket ends up in the closed state because the remote is not accepting connections. 3. The socket is re-used to connect to a different (remote address, remote port).
The problem is that fConnectionHash is a BOpenHashTable<TCPEndpoint>, and inserting endpoint multiple times can create a linked list cycle (TCPEndpoint is an intrusive linked list node). That means that, even though TCPEndpoint's destructor removes itself from fConnectionHash, there will still be a pointer to it left behind, which means that future accesses within that hash table bucket will result in a segfault.
The added fConnectionHash.Remove(endpoint) here prevents the KDL, as it ensures that socket reuse doesn't result in a cycle.
Fixes #13927, see that ticket for a detailed explanation of the problem.
Also added some regression tests: * Added SocketTests::ClientSocketReuseTest to PosixNetTest, which reproduces this KDL. * BOpenHashTable: Added tests to cover RemoveUnchecked and removal of an object that isn't in the table.
Change-Id: If4bcc1e0d94350a5ad9ba8e7ae6f1b783b3f6d34 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2173 Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
|