Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

No re-initialization of TCP stack after Close() #114

Open
floryst opened this issue Mar 20, 2023 · 1 comment
Open

No re-initialization of TCP stack after Close() #114

floryst opened this issue Mar 20, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@floryst
Copy link

floryst commented Mar 20, 2023

I'm pretty sure this is related to Jigsaw-Code/outline-apps#882 and Jigsaw-Code/outline-apps#1476.

When testing the Outline VPN Android client (v1.10.0), I encountered the same logcat output from the linked issues when transitioning from WiFi to LTE while actively connected to an Outline server. I cannot reliably reproduce the issue; it occurs at random.

I did notice that the issue would arise when logcat (on VpnTunnelService) reported that UDP support transitioned from true to false. Looking through tun2socks, I think the issue is the t.lwipStack.Close() call in UpdateUDPSupport(). Close() gets called when UDP support changes, matching the logcat output. Since t.lwipStack is never re-initialized, any call to tunnel.Disconnect() afterwards will call t.lwipStack.Close() on an already closed t.lwipStack, resulting in a double-free. (I tested the double Close() call and got a double free.)

I suppose UpdateUDPSupport should call t.Disconnect() and then re-create a new LWIPStack and tunnel. I haven't had a chance to build the android client to verify the issue and test such a potential fix, so I'm writing up my analysis first to start the discussion.

@maddyhof maddyhof added the bug Something isn't working label Mar 20, 2023
@fortuna
Copy link
Contributor

fortuna commented Jun 8, 2023

@jyyi1 FYI, since you are working on that code. We should make sure we don't have that problem in the new version of the code.

@jyyi1 jyyi1 self-assigned this Jun 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants