Skip to content

WireGuard proxy: Prevent panic when closing netTun with a write in flight - #6778

Merged
RPRX merged 1 commit into
XTLS:mainfrom
hossinasaadi:patch-wg-crash
Sep 20, 2026
Merged

RPRX merged 1 commit into
XTLS:mainfrom
hossinasaadi:patch-wg-crash

Conversation

@hossinasaadi

Copy link
Copy Markdown
Contributor

No description provided.

@Fangliding

Copy link
Copy Markdown
Member

I remember dealing with similar issues on the old Wireguard implementation... only the sender should have the right to close the channel

@LjhAUMEM LjhAUMEM left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

怎么官方写的也是这样,这下不能愉快的无脑同步了,先这样吧,以后再看看有没有更好的方式,nice fix

@LjhAUMEM

Copy link
Copy Markdown
Contributor

想了一下 RWLock 的方式似乎行不通,先这样吧

I remember dealing with similar issues on the old Wireguard implementation... only the sender should have the right to close the channel

再往下就需要深入到 gvisor 的设计里了解了

@RPRX

RPRX commented Sep 20, 2026

Copy link
Copy Markdown
Member

@LjhAUMEM 这个 PR 是出入站都占还是

@RPRX

RPRX commented Sep 20, 2026

Copy link
Copy Markdown
Member

看了下代码,应该是两边都占,看 @LjhAUMEM 的意思似乎是这代码是从 WG 官方 copy 来的,你们谁去 PR fix 一下吧

@RPRX RPRX changed the title wireguard: prevent panic when closing wireguard netTun with a write in flight WireGuard: Prevent panic when closing netTun with a write in flight Sep 20, 2026
@RPRX RPRX changed the title WireGuard: Prevent panic when closing netTun with a write in flight WireGuard proxy: Prevent panic when closing netTun with a write in flight Sep 20, 2026
@RPRX
RPRX merged commit dbb1ea3 into XTLS:main Sep 20, 2026
40 checks passed
@hossinasaadi
hossinasaadi deleted the patch-wg-crash branch September 20, 2026 20:13
onesyue pushed a commit to onesyue/Xray-core that referenced this pull request Sep 21, 2026
GFW-knocker pushed a commit to GFW-knocker/Xray-core that referenced this pull request Oct 2, 2026
…ight (XTLS#6778)

XTLS#6778 (review)
(cherry picked from commit dbb1ea3)

[GFW-knocker: hand-merged. The fork already had the closed channel, closeOnce
and Release-on-close in WriteNotify; this brings Read waiting on closed and
Close no longer closing incomingPacket.]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants