mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-03-09 17:49:56 +00:00
fix: windows crash for golang1.26 on WSARecvFrom syscall
This commit is contained in:
55
.github/patch/issue77975.patch
vendored
Normal file
55
.github/patch/issue77975.patch
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
Subject: [PATCH] move lpFromlen to heap for WSARecvFrom syscall
|
||||
---
|
||||
Index: src/internal/poll/fd_windows.go
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/src/internal/poll/fd_windows.go b/src/internal/poll/fd_windows.go
|
||||
--- a/src/internal/poll/fd_windows.go (revision 8149d992682ce76c6af804b507878e19fc966f7b)
|
||||
+++ b/src/internal/poll/fd_windows.go (revision 25efab96145f416bbae4024e9c110429770b22d1)
|
||||
@@ -76,6 +76,8 @@
|
||||
// fields used by runtime.netpoll
|
||||
runtimeCtx uintptr
|
||||
mode int32
|
||||
+
|
||||
+ rsan int32
|
||||
}
|
||||
|
||||
func (fd *FD) overlapped(o *operation) *syscall.Overlapped {
|
||||
@@ -740,9 +742,9 @@
|
||||
rsa := wsaRsaPool.Get().(*syscall.RawSockaddrAny)
|
||||
defer wsaRsaPool.Put(rsa)
|
||||
n, err := fd.execIO('r', func(o *operation) (qty uint32, err error) {
|
||||
- rsan := int32(unsafe.Sizeof(*rsa))
|
||||
+ o.rsan = int32(unsafe.Sizeof(*rsa))
|
||||
var flags uint32
|
||||
- err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, rsa, &rsan, &o.o, nil)
|
||||
+ err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, rsa, &o.rsan, &o.o, nil)
|
||||
return qty, err
|
||||
})
|
||||
err = fd.eofError(n, err)
|
||||
@@ -771,9 +773,9 @@
|
||||
rsa := wsaRsaPool.Get().(*syscall.RawSockaddrAny)
|
||||
defer wsaRsaPool.Put(rsa)
|
||||
n, err := fd.execIO('r', func(o *operation) (qty uint32, err error) {
|
||||
- rsan := int32(unsafe.Sizeof(*rsa))
|
||||
+ o.rsan = int32(unsafe.Sizeof(*rsa))
|
||||
var flags uint32
|
||||
- err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, rsa, &rsan, &o.o, nil)
|
||||
+ err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, rsa, &o.rsan, &o.o, nil)
|
||||
return qty, err
|
||||
})
|
||||
err = fd.eofError(n, err)
|
||||
@@ -802,9 +804,9 @@
|
||||
rsa := wsaRsaPool.Get().(*syscall.RawSockaddrAny)
|
||||
defer wsaRsaPool.Put(rsa)
|
||||
n, err := fd.execIO('r', func(o *operation) (qty uint32, err error) {
|
||||
- rsan := int32(unsafe.Sizeof(*rsa))
|
||||
+ o.rsan = int32(unsafe.Sizeof(*rsa))
|
||||
var flags uint32
|
||||
- err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, rsa, &rsan, &o.o, nil)
|
||||
+ err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, rsa, &o.rsan, &o.o, nil)
|
||||
return qty, err
|
||||
})
|
||||
err = fd.eofError(n, err)
|
||||
13
.github/workflows/build.yml
vendored
13
.github/workflows/build.yml
vendored
@@ -179,12 +179,19 @@ jobs:
|
||||
tar zxf go1.26.0.linux-amd64-abi1.tar.gz -C $HOME/usr/local
|
||||
echo "$HOME/usr/local/go/bin" >> $GITHUB_PATH
|
||||
|
||||
# TODO: remove after CL747663 merged, see: https://github.com/golang/go/issues/77731
|
||||
- name: Apply CL747663 for Golang1.26
|
||||
# TODO: remove after issue77731 merged, see: https://github.com/golang/go/issues/77731
|
||||
- name: Apply issue77731 for Golang1.26
|
||||
if: ${{ matrix.jobs.goversion == '' }}
|
||||
run: |
|
||||
cd $(go env GOROOT)
|
||||
patch --verbose -p 1 < $GITHUB_WORKSPACE/.github/patch/cl747663.patch
|
||||
patch --verbose -p 1 < $GITHUB_WORKSPACE/.github/patch/issue77731.patch
|
||||
|
||||
# TODO: remove after issue77975 fixed, see: https://github.com/golang/go/issues/77975
|
||||
- name: Fix issue77975 for Golang1.26
|
||||
if: ${{ matrix.jobs.goversion == '' }}
|
||||
run: |
|
||||
cd $(go env GOROOT)
|
||||
patch --verbose -p 1 < $GITHUB_WORKSPACE/.github/patch/issue77975.patch
|
||||
|
||||
# this patch file only works on golang1.26.x
|
||||
# that means after golang1.27 release it must be changed
|
||||
|
||||
7
.github/workflows/test.yml
vendored
7
.github/workflows/test.yml
vendored
@@ -50,6 +50,13 @@ jobs:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
check-latest: true # Always check for the latest patch release
|
||||
|
||||
# TODO: remove after issue77975 fixed, see: https://github.com/golang/go/issues/77975
|
||||
- name: Fix issue77975 for Golang1.26
|
||||
if: ${{ matrix.jobs.goversion == '1.26' }}
|
||||
run: |
|
||||
cd $(go env GOROOT)
|
||||
patch --verbose -p 1 < $GITHUB_WORKSPACE/.github/patch/issue77975.patch
|
||||
|
||||
- name: Revert Golang commit for Windows7/8
|
||||
if: ${{ runner.os == 'Windows' && matrix.go-version != '1.20' }}
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user