diff options
author | Ghanan Gowripalan <ghanan@google.com> | 2020-04-20 16:31:39 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-04-20 16:32:44 -0700 |
commit | 782041509f4130e8e795b22379368239d5091c8f (patch) | |
tree | 81ed7df40421e1bce4f5c381ce91b79b5362ff11 /pkg/context | |
parent | 1a597e01bed5d5fb30b3d444e0a23669c5587235 (diff) |
Prevent race when reassigning CancellableTimer
Capture a timer's locker for each instance of a CancellableTimer so that
reassigning a tcpip.CancellableTimer does not cause a data race.
Reassigning a tcpip.CancellableTimer updates its underlying locker. When
a timer fires, it does a read of the timer's locker variable to lock it.
This read of the locker was not synchronized so a race existed where one
goroutine may reassign the timer (updating the locker) and another
handles the timer firing (attempts to lock the timer's locker).
Test: tcpip_test.TestCancellableTimerReassignment
PiperOrigin-RevId: 307499822
Diffstat (limited to 'pkg/context')
0 files changed, 0 insertions, 0 deletions