Commit b47706c
committed
net/transport: fix yamux dial fd-reuse race and outgoing sub-stream leak
H1: yamux Dial installed a net.Dialer.Control that, on ctx cancellation,
called Shutdown+Close on the raw socket fd. DialContext(ctx) already aborts
the connect and closes its own fd, so the two raced to close the same fd
number (classic fd-reuse hazard). Drop the Control/abortOnCancel machinery
and the abort_{unix,windows,other}.go files; rely on net.Dialer.Timeout +
DialContext(ctx), which handle timeout and cancellation safely.
H2: peer.openDrpcConn opened a sub-stream then ran OutgoingProtoHandshake,
returning the error without closing the stream. The handshake does not close
the conn on three protocol-level error paths (incompatible/declined/
unexpected proto), so a version-skewed peer leaked streams unboundedly. Close
the sub-stream on any handshake error, matching the incoming serve() path.
Refs GO-73131 parent 8b582a6 commit b47706c
5 files changed
Lines changed: 11 additions & 111 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
278 | 283 | | |
279 | 284 | | |
280 | 285 | | |
| |||
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
111 | 112 | | |
112 | 113 | | |
113 | | - | |
114 | 114 | | |
115 | | - | |
116 | 115 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | 116 | | |
122 | 117 | | |
123 | 118 | | |
124 | | - | |
| 119 | + | |
125 | 120 | | |
126 | 121 | | |
127 | 122 | | |
| |||
0 commit comments