Page MenuHomeFreeBSD

D24842.id71799.diff
No OneTemporary

D24842.id71799.diff

Index: head/sys/kern/uipc_socket.c
===================================================================
--- head/sys/kern/uipc_socket.c
+++ head/sys/kern/uipc_socket.c
@@ -4016,8 +4016,17 @@
{
SOCK_LOCK(so);
- so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING);
+
+ /*
+ * There is at least one reader of so_state that does not
+ * acquire socket lock, namely soreceive_generic(). Ensure
+ * that it never sees all flags that track connection status
+ * cleared, by ordering the update with a barrier semantic of
+ * our release thread fence.
+ */
so->so_state |= SS_ISDISCONNECTED;
+ atomic_thread_fence_rel();
+ so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING);
if (!SOLISTENING(so)) {
SOCK_UNLOCK(so);

File Metadata

Mime Type
text/plain
Expires
Tue, Sep 1, 4:15 AM (11 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37710286
Default Alt Text
D24842.id71799.diff (763 B)

Event Timeline