summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/transport/udp/BUILD
diff options
context:
space:
mode:
authorBhasker Hariharan <bhaskerh@google.com>2020-11-17 10:34:03 -0800
committergVisor bot <gvisor-bot@google.com>2020-11-17 10:36:29 -0800
commit05d2a26f7a86318216db2256815338c4f9cf8cf2 (patch)
treec8b084a8b57e60211bafc47abc730b2c2a6d449d /pkg/tcpip/transport/udp/BUILD
parentfb9a649f39dc6f6a6accbf26db30a21fcc4bcf23 (diff)
Fix possible deadlock in UDP.Write().
In UDP endpoint.Write() sendUDP is called with e.mu Rlocked. But if this happens to send a datagram over loopback which ends up generating an ICMP response of say ErrNoPortReachable, the handling of the response in HandleControlPacket also acquires e.mu using RLock. This is mostly fine unless there is a competing caller trying to acquire e.mu in exclusive mode using Lock(). This will deadlock as a caller waiting in Lock() disallows an new RLocks() to ensure it can actually acquire the Lock. This is documented here https://golang.org/pkg/sync/#RWMutex. This change releases the endpoint mutex before calling sendUDP to resolve the possibility of the deadlock. Reported-by: syzbot+537989797548c66e8ee3@syzkaller.appspotmail.com Reported-by: syzbot+eb0b73b4ab486f7673ba@syzkaller.appspotmail.com PiperOrigin-RevId: 342894148
Diffstat (limited to 'pkg/tcpip/transport/udp/BUILD')
-rw-r--r--pkg/tcpip/transport/udp/BUILD1
1 files changed, 1 insertions, 0 deletions
diff --git a/pkg/tcpip/transport/udp/BUILD b/pkg/tcpip/transport/udp/BUILD
index c78549424..7ebae63d8 100644
--- a/pkg/tcpip/transport/udp/BUILD
+++ b/pkg/tcpip/transport/udp/BUILD
@@ -56,6 +56,7 @@ go_test(
"//pkg/tcpip/network/ipv4",
"//pkg/tcpip/network/ipv6",
"//pkg/tcpip/stack",
+ "//pkg/tcpip/transport/icmp",
"//pkg/waiter",
],
)