summaryrefslogtreecommitdiffhomepage
path: root/pkg/usermem/addr.go
diff options
context:
space:
mode:
authorKevin Krakauer <krakauer@google.com>2021-02-25 13:34:01 -0800
committergVisor bot <gvisor-bot@google.com>2021-02-25 13:35:44 -0800
commit38c42bbf4ad2200f0ec72e51d1cfbbd83d782a63 (patch)
tree10db75d71fa93f329cca518d6a14a0a54a17037b /pkg/usermem/addr.go
parente50ee26207a99930be966bd48e04f5bccd85cc05 (diff)
Remove deadlock in raw.endpoint caused by recursive read locking
Prevents the following deadlock: - Raw packet is sent via e.Write(), which read locks e.mu - Connect() is called, blocking on write locking e.mu - The packet is routed to loopback and back to e.HandlePacket(), which read locks e.mu Per the atomic.RWMutex documentation, this deadlocks: "If a goroutine holds a RWMutex for reading and another goroutine might call Lock, no goroutine should expect to be able to acquire a read lock until the initial read lock is released. In particular, this prohibits recursive read locking. This is to ensure that the lock eventually becomes available; a blocked Lock call excludes new readers from acquiring the lock." Also, release eps.mu earlier in deliverRawPacket. PiperOrigin-RevId: 359600926
Diffstat (limited to 'pkg/usermem/addr.go')
0 files changed, 0 insertions, 0 deletions