diff options
author | Ghanan Gowripalan <ghanan@google.com> | 2019-12-18 15:12:33 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-12-18 15:18:33 -0800 |
commit | 8e6e87f8e8885eeadb8b3d891e24137f11ebdf31 (patch) | |
tree | 9c9cef8494e1d103e22f41141bed6b78ce137a5d /pkg/sentry/hostmm/hostmm.go | |
parent | ac3b3bb40e596e507a09d850e35a26e0871109c4 (diff) |
Allow 'out-of-line' routing table updates for Router and Prefix discovery events
This change removes the requirement that a new routing table be provided when a
router or prefix discovery event happens so that an updated routing table may
be provided to the stack at a later time from the event.
This change is to address the use case where the netstack integrator may need to
obtain a lock before providing updated routes in response to the events above.
As an example, say we have an integrator that performs the below two operations
operations as described:
A. Normal route update:
1. Obtain integrator lock
2. Update routes in the integrator
3. Call Stack.SetRouteTable with the updated routes
3.1. Obtain Stack lock
3.2. Update routes in Stack
3.3. Release Stack lock
4. Release integrator lock
B. NDP event triggered route update:
1. Obtain Stack lock
2. Call event handler
2.1. Obtain integrator lock
2.2. Update routes in the integrator
2.3. Release integrator lock
2.4. Return updated routes to update Stack
3. Update routes in Stack
4. Release Stack lock
A deadlock may occur if a Normal route update was attemped at the same time an
NDP event triggered route update was attempted. With threads T1 and T2:
1) T1 -> A.1, A.2
2) T2 -> B.1
3) T1 -> A.3 (hangs at A.3.1 since Stack lock is taken in step 2)
4) T2 -> B.2 (hangs at B.2.1 since integrator lock is taken in step 1)
Test: Existing tests were modified to not provide or expect routing table
changes in response to Router and Prefix discovery events.
PiperOrigin-RevId: 286274712
Diffstat (limited to 'pkg/sentry/hostmm/hostmm.go')
0 files changed, 0 insertions, 0 deletions