You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
potential deadlock in wireguard-go sending lots of traffic to several peers without handshakes #1971
On mobile platforms, wireguard-go limits the number of buffers that can be outstanding at any time. It also has a per-peer limit on the number of staged packets (packets awaiting a handshake). But with enough peers connected, the staged packets outstanding could consume the entire buffer pool. If that happened, receiving new packets would block, because no buffers were available. If receiving packets fails, then handshakes cannot complete. (Similarly so for sending new packets in this state.)
This would cause at least a temporary deadlock. Eventually the handshake timer would fire enough times to exceed the handshake retry limit and would then clear the staged packets.
In android that would require 32 peers. On iOS with upstream values, 8 peers. On iOS with our restricted values, 1 peer(!).
At this point, this is a theoretical concern that occurred to me lying in bed. Next step is to verify with the code, think about how to reproduce, and consider mitigations (such as device-wide handshake queue dropping when the buffer pool gets low, or a separate buffer pool dedicated to handshake buffers).
A few relevant developments since this bug was filed:
support for iOS versions prior to iOS 15 has been dropped. iOS15 allows Network Extensions to use more memory.. The number of available buffers on iOS is more generous than it was at the time this issue was filed.
As we're approaching two years since this issue was filed with (to my knowledge) no indication that the problem has actually materialized, we'll expect to close this during the next regular bug scrub.
Activity
DentonGentry commentedon Feb 12, 2023
A few relevant developments since this bug was filed:
As we're approaching two years since this issue was filed with (to my knowledge) no indication that the problem has actually materialized, we'll expect to close this during the next regular bug scrub.
device: implement global staged queue packet container limit
device: implement global staged queue packet container limit
device: remove WaitPool wrapper
go.mod,wgengine/wgcfg: bump wg-go & configure staged global limit on iOS
device: implement global staged queue packet container limit
device: remove WaitPool wrapper