aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-12-14 22:17:23 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2021-12-16 03:14:14 +0100
commitcb3a67ffccfa1d3436bd9384c428242b6d8fc558 (patch)
tree0cb6d1c0ca005ee136ed314e6b9233f33bd7ec8f
parentbuild: remove patcher (diff)
downloadwireguard-windows-cb3a67ffccfa1d3436bd9384c428242b6d8fc558.tar.xz
wireguard-windows-cb3a67ffccfa1d3436bd9384c428242b6d8fc558.zip
global: update to go 1.18 beta1
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--Makefile4
-rw-r--r--build.bat2
-rw-r--r--conf/config.go3
-rw-r--r--conf/dnsresolver_windows.go2
-rw-r--r--conf/parser.go3
-rw-r--r--conf/parser_test.go3
-rw-r--r--conf/writer.go3
-rw-r--r--go-patches/0001-runtime-allow-builtin-write-function-to-be-redirecte.patch56
-rw-r--r--go-patches/0002-release-branch.go1.17-cmd-compile-speed-up-unsafe.Sl.patch328
-rw-r--r--go-patches/0003-release-branch.go1.17-runtime-support-non-cooperativ.patch59
-rw-r--r--go-patches/0004-runtime-support-non-cooperative-preemption-on-window.patch65
-rw-r--r--go.mod9
-rw-r--r--go.mod.master3
-rw-r--r--go.sum12
-rw-r--r--tunnel/addressconfig.go3
-rw-r--r--tunnel/firewall/blocker.go3
-rw-r--r--tunnel/firewall/rules.go3
-rw-r--r--tunnel/pitfalls.go2
-rw-r--r--tunnel/winipcfg/luid.go3
-rw-r--r--tunnel/winipcfg/netsh.go3
-rw-r--r--tunnel/winipcfg/types.go3
-rw-r--r--tunnel/winipcfg/winipcfg_test.go3
-rw-r--r--ui/editdialog.go3
23 files changed, 27 insertions, 551 deletions
diff --git a/Makefile b/Makefile
index ab386e97..d30aa5a7 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,7 @@ define download =
if ! mv $$@.unverified $$@; then rm -f $$@.unverified; exit 1; fi
endef
-$(eval $(call download,go.tar.gz,https://go.dev/dl/go1.17.4.linux-amd64.tar.gz,adab2483f644e2f8a10ae93122f0018cef525ca48d0b8764dae87cb5f4fd4206))
+$(eval $(call download,go.tar.gz,https://go.dev/dl/go1.18beta1.linux-amd64.tar.gz,128f72c5c22640085e4187cd1b540c587cf8fb280f941519bd2d1ae9fdab4f37))
$(eval $(call download,wireguard-nt.zip,https://download.wireguard.com/wireguard-nt/wireguard-nt-0.10.1.zip,772c0b1463d8d2212716f43f06f4594d880dea4f735165bd68e388fc41b81605))
.deps/go/prepared: .distfiles/go.tar.gz
@@ -71,7 +71,7 @@ remaster: .deps/go/prepared
rm -f go.sum go.mod
cp go.mod.master go.mod
go get -d
- sed -i $(shell curl -L https://go.dev/dl/?mode=json | jq -r '(".windows-amd64.zip",".linux-amd64.tar.gz") as $$suffix | .[0].files[] | select(.filename|endswith($$suffix)) | ("-e", "s/go[0-9][^ ]*\\\($$suffix)\\([ ,]\\)[a-f0-9]\\+/\(.filename)\\1\(.sha256)/") | @sh') Makefile build.bat
+ sed -i $(shell curl -L 'https://go.dev/dl/?mode=json&include=all' | jq -r '(".windows-amd64.zip",".linux-amd64.tar.gz") as $$suffix | .[-1].files[] | select(.filename|endswith($$suffix)) | ("-e", "s/go[0-9][^ ]*\\\($$suffix)\\([ ,]\\)[a-f0-9]\\+/\(.filename)\\1\(.sha256)/") | @sh') Makefile build.bat
fmt: export GOARCH := amd64
fmt: .deps/go/prepared
diff --git a/build.bat b/build.bat
index ae3aac11..4f313806 100644
--- a/build.bat
+++ b/build.bat
@@ -13,7 +13,7 @@ if exist .deps\prepared goto :render
rmdir /s /q .deps 2> NUL
mkdir .deps || goto :error
cd .deps || goto :error
- call :download go.zip https://go.dev/dl/go1.17.4.windows-amd64.zip 903cffeb7c6ab7490b9101086a2b978076bd9356e56369404b9c45dff866da77 || goto :error
+ call :download go.zip https://go.dev/dl/go1.18beta1.windows-amd64.zip 3a43ab4ec28eee6b10fd412a055724d962227f1c27a78960d6d229d741f8353d || goto :error
rem Mirror of https://github.com/mstorsjo/llvm-mingw/releases/download/20201020/llvm-mingw-20201020-msvcrt-x86_64.zip
call :download llvm-mingw-msvcrt.zip https://download.wireguard.com/windows-toolchain/distfiles/llvm-mingw-20201020-msvcrt-x86_64.zip 2e46593245090df96d15e360e092f0b62b97e93866e0162dca7f93b16722b844 || goto :error
rem Mirror of https://imagemagick.org/download/binaries/ImageMagick-7.0.8-42-portable-Q16-x64.zip
diff --git a/conf/config.go b/conf/config.go
index d8935b44..37ab5cd4 100644
--- a/conf/config.go
+++ b/conf/config.go
@@ -10,11 +10,10 @@ import (
"crypto/subtle"
"encoding/base64"
"fmt"
+ "net/netip"
"strings"
"time"
- "golang.zx2c4.com/go118/netip"
-
"golang.org/x/crypto/curve25519"
"golang.zx2c4.com/wireguard/windows/l18n"
diff --git a/conf/dnsresolver_windows.go b/conf/dnsresolver_windows.go
index b09f4603..3869cf68 100644
--- a/conf/dnsresolver_windows.go
+++ b/conf/dnsresolver_windows.go
@@ -7,10 +7,10 @@ package conf
import (
"log"
+ "net/netip"
"time"
"unsafe"
- "golang.zx2c4.com/go118/netip"
"golang.zx2c4.com/wireguard/windows/tunnel/winipcfg"
"golang.org/x/sys/windows"
diff --git a/conf/parser.go b/conf/parser.go
index ff030362..f015a89b 100644
--- a/conf/parser.go
+++ b/conf/parser.go
@@ -7,11 +7,10 @@ package conf
import (
"encoding/base64"
+ "net/netip"
"strconv"
"strings"
- "golang.zx2c4.com/go118/netip"
-
"golang.org/x/sys/windows"
"golang.org/x/text/encoding/unicode"
diff --git a/conf/parser_test.go b/conf/parser_test.go
index 67a208eb..da8539ab 100644
--- a/conf/parser_test.go
+++ b/conf/parser_test.go
@@ -6,11 +6,10 @@
package conf
import (
+ "net/netip"
"reflect"
"runtime"
"testing"
-
- "golang.zx2c4.com/go118/netip"
)
const testInput = `
diff --git a/conf/writer.go b/conf/writer.go
index 61abb672..ab624e98 100644
--- a/conf/writer.go
+++ b/conf/writer.go
@@ -7,11 +7,10 @@ package conf
import (
"fmt"
+ "net/netip"
"strings"
"unsafe"
- "golang.zx2c4.com/go118/netip"
-
"golang.org/x/sys/windows"
"golang.zx2c4.com/wireguard/windows/driver"
"golang.zx2c4.com/wireguard/windows/tunnel/winipcfg"
diff --git a/go-patches/0001-runtime-allow-builtin-write-function-to-be-redirecte.patch b/go-patches/0001-runtime-allow-builtin-write-function-to-be-redirecte.patch
deleted file mode 100644
index 3b44b363..00000000
--- a/go-patches/0001-runtime-allow-builtin-write-function-to-be-redirecte.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: "Jason A. Donenfeld" <Jason@zx2c4.com>
-Date: Thu, 3 Dec 2020 13:29:58 +0100
-Subject: [PATCH] runtime: allow builtin write function to be redirected with
- function pointer
-
-The x/sys/windows package currently uses go:linkname for other facilities
-inside of runtime that are not suitable to be exposed as a public API
-due to their dangers but are still necessary for manipulating any
-low-level plumbing that the runtime controls.
-
-Logging, via the built-in println and panic handler, is one such
-low-level plumbing feature. In this case, x/sys/windows/svc needs to be
-able to redirect panics to the Windows event log. Because the event log
-is a complicated interface, this requires a bit more fiddling than the
-simple solution used on Android (baking it into runtime itself), and
-because Windows services are very diverse, the event log might not even
-always be a desirable destination.
-
-This commit accomplishes this by exposing a function pointer called
-"overrideWrite" that low-level runtime packages like x/sys/windows/svc
-can use to redirect output logs toward the event log or otherwise.
-
-It is not safe or acceptable to use as a generic mechanism, and for that
-reason, we wouldn't want to expose this as a real stable API, similar to
-the other instances of go:linkname in x/sys/windows. But for packages
-that must interoperate with low-level Go runtime fundamentals, this is a
-safety hatch for packages that are developed in tandem with the runtime.
-x/sys/windows is one such package.
-
-Updates #42888.
-
-Change-Id: I77a32ff7e1494324e8cc38e792e007f86d32672d
----
- src/runtime/time_nofake.go | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/src/runtime/time_nofake.go b/src/runtime/time_nofake.go
-index 5a4ceaf43d..68c01805a5 100644
---- a/src/runtime/time_nofake.go
-+++ b/src/runtime/time_nofake.go
-@@ -20,9 +20,14 @@ func nanotime() int64 {
- return nanotime1()
- }
-
-+var overrideWrite func(fd uintptr, p unsafe.Pointer, n int32) int32
-+
- // write must be nosplit on Windows (see write1)
- //
- //go:nosplit
- func write(fd uintptr, p unsafe.Pointer, n int32) int32 {
-+ if overrideWrite != nil {
-+ return overrideWrite(fd, noescape(p), n)
-+ }
- return write1(fd, p, n)
- }
diff --git a/go-patches/0002-release-branch.go1.17-cmd-compile-speed-up-unsafe.Sl.patch b/go-patches/0002-release-branch.go1.17-cmd-compile-speed-up-unsafe.Sl.patch
deleted file mode 100644
index 0dac195a..00000000
--- a/go-patches/0002-release-branch.go1.17-cmd-compile-speed-up-unsafe.Sl.patch
+++ /dev/null
@@ -1,328 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: "Jason A. Donenfeld" <Jason@zx2c4.com>
-Date: Mon, 11 Oct 2021 21:31:47 -0600
-Subject: [PATCH] [release-branch.go1.17] cmd/compile: speed up unsafe.Slice by
- omitting checks
-
-unsafe.Slice is already an unsafe operation, like unsafe.Pointer casts.
-So, assume the user knows what they're doing, unless checkptr is used,
-in which case, we can then emit the checker code, just like
-unsafe.Pointer casts do.
-
-Fixes #48798.
-
-Change-Id: Ice1f615b49fe13556f71495f303d4ff0eb794bd9
----
- src/cmd/compile/internal/typecheck/builtin.go | 179 +++++++++---------
- .../internal/typecheck/builtin/runtime.go | 2 -
- src/cmd/compile/internal/walk/builtin.go | 19 +-
- test/unsafebuiltins.go | 30 +--
- 4 files changed, 92 insertions(+), 138 deletions(-)
-
-diff --git a/src/cmd/compile/internal/typecheck/builtin.go b/src/cmd/compile/internal/typecheck/builtin.go
-index 833b17b414..add59020a7 100644
---- a/src/cmd/compile/internal/typecheck/builtin.go
-+++ b/src/cmd/compile/internal/typecheck/builtin.go
-@@ -136,72 +136,70 @@ var runtimeDecls = [...]struct {
- {"makeslice64", funcTag, 113},
- {"makeslicecopy", funcTag, 114},
- {"growslice", funcTag, 116},
-- {"unsafeslice", funcTag, 117},
-- {"unsafeslice64", funcTag, 118},
-- {"unsafeslicecheckptr", funcTag, 118},
-- {"memmove", funcTag, 119},
-- {"memclrNoHeapPointers", funcTag, 120},
-- {"memclrHasPointers", funcTag, 120},
-- {"memequal", funcTag, 121},
-- {"memequal0", funcTag, 122},
-- {"memequal8", funcTag, 122},
-- {"memequal16", funcTag, 122},
-- {"memequal32", funcTag, 122},
-- {"memequal64", funcTag, 122},
-- {"memequal128", funcTag, 122},
-- {"f32equal", funcTag, 123},
-- {"f64equal", funcTag, 123},
-- {"c64equal", funcTag, 123},
-- {"c128equal", funcTag, 123},
-- {"strequal", funcTag, 123},
-- {"interequal", funcTag, 123},
-- {"nilinterequal", funcTag, 123},
-- {"memhash", funcTag, 124},
-- {"memhash0", funcTag, 125},
-- {"memhash8", funcTag, 125},
-- {"memhash16", funcTag, 125},
-- {"memhash32", funcTag, 125},
-- {"memhash64", funcTag, 125},
-- {"memhash128", funcTag, 125},
-- {"f32hash", funcTag, 125},
-- {"f64hash", funcTag, 125},
-- {"c64hash", funcTag, 125},
-- {"c128hash", funcTag, 125},
-- {"strhash", funcTag, 125},
-- {"interhash", funcTag, 125},
-- {"nilinterhash", funcTag, 125},
-- {"int64div", funcTag, 126},
-- {"uint64div", funcTag, 127},
-- {"int64mod", funcTag, 126},
-- {"uint64mod", funcTag, 127},
-- {"float64toint64", funcTag, 128},
-- {"float64touint64", funcTag, 129},
-- {"float64touint32", funcTag, 130},
-- {"int64tofloat64", funcTag, 131},
-- {"uint64tofloat64", funcTag, 132},
-- {"uint32tofloat64", funcTag, 133},
-- {"complex128div", funcTag, 134},
-- {"getcallerpc", funcTag, 135},
-- {"getcallersp", funcTag, 135},
-+ {"unsafeslicecheckptr", funcTag, 117},
-+ {"memmove", funcTag, 118},
-+ {"memclrNoHeapPointers", funcTag, 119},
-+ {"memclrHasPointers", funcTag, 119},
-+ {"memequal", funcTag, 120},
-+ {"memequal0", funcTag, 121},
-+ {"memequal8", funcTag, 121},
-+ {"memequal16", funcTag, 121},
-+ {"memequal32", funcTag, 121},
-+ {"memequal64", funcTag, 121},
-+ {"memequal128", funcTag, 121},
-+ {"f32equal", funcTag, 122},
-+ {"f64equal", funcTag, 122},
-+ {"c64equal", funcTag, 122},
-+ {"c128equal", funcTag, 122},
-+ {"strequal", funcTag, 122},
-+ {"interequal", funcTag, 122},
-+ {"nilinterequal", funcTag, 122},
-+ {"memhash", funcTag, 123},
-+ {"memhash0", funcTag, 124},
-+ {"memhash8", funcTag, 124},
-+ {"memhash16", funcTag, 124},
-+ {"memhash32", funcTag, 124},
-+ {"memhash64", funcTag, 124},
-+ {"memhash128", funcTag, 124},
-+ {"f32hash", funcTag, 124},
-+ {"f64hash", funcTag, 124},
-+ {"c64hash", funcTag, 124},
-+ {"c128hash", funcTag, 124},
-+ {"strhash", funcTag, 124},
-+ {"interhash", funcTag, 124},
-+ {"nilinterhash", funcTag, 124},
-+ {"int64div", funcTag, 125},
-+ {"uint64div", funcTag, 126},
-+ {"int64mod", funcTag, 125},
-+ {"uint64mod", funcTag, 126},
-+ {"float64toint64", funcTag, 127},
-+ {"float64touint64", funcTag, 128},
-+ {"float64touint32", funcTag, 129},
-+ {"int64tofloat64", funcTag, 130},
-+ {"uint64tofloat64", funcTag, 131},
-+ {"uint32tofloat64", funcTag, 132},
-+ {"complex128div", funcTag, 133},
-+ {"getcallerpc", funcTag, 134},
-+ {"getcallersp", funcTag, 134},
- {"racefuncenter", funcTag, 31},
- {"racefuncexit", funcTag, 9},
- {"raceread", funcTag, 31},
- {"racewrite", funcTag, 31},
-- {"racereadrange", funcTag, 136},
-- {"racewriterange", funcTag, 136},
-- {"msanread", funcTag, 136},
-- {"msanwrite", funcTag, 136},
-- {"msanmove", funcTag, 137},
-- {"checkptrAlignment", funcTag, 138},
-- {"checkptrArithmetic", funcTag, 140},
-- {"libfuzzerTraceCmp1", funcTag, 141},
-- {"libfuzzerTraceCmp2", funcTag, 142},
-- {"libfuzzerTraceCmp4", funcTag, 143},
-- {"libfuzzerTraceCmp8", funcTag, 144},
-- {"libfuzzerTraceConstCmp1", funcTag, 141},
-- {"libfuzzerTraceConstCmp2", funcTag, 142},
-- {"libfuzzerTraceConstCmp4", funcTag, 143},
-- {"libfuzzerTraceConstCmp8", funcTag, 144},
-+ {"racereadrange", funcTag, 135},
-+ {"racewriterange", funcTag, 135},
-+ {"msanread", funcTag, 135},
-+ {"msanwrite", funcTag, 135},
-+ {"msanmove", funcTag, 136},
-+ {"checkptrAlignment", funcTag, 137},
-+ {"checkptrArithmetic", funcTag, 139},
-+ {"libfuzzerTraceCmp1", funcTag, 140},
-+ {"libfuzzerTraceCmp2", funcTag, 141},
-+ {"libfuzzerTraceCmp4", funcTag, 142},
-+ {"libfuzzerTraceCmp8", funcTag, 143},
-+ {"libfuzzerTraceConstCmp1", funcTag, 140},
-+ {"libfuzzerTraceConstCmp2", funcTag, 141},
-+ {"libfuzzerTraceConstCmp4", funcTag, 142},
-+ {"libfuzzerTraceConstCmp8", funcTag, 143},
- {"x86HasPOPCNT", varTag, 6},
- {"x86HasSSE41", varTag, 6},
- {"x86HasFMA", varTag, 6},
-@@ -224,7 +222,7 @@ func params(tlist ...*types.Type) []*types.Field {
- }
-
- func runtimeTypes() []*types.Type {
-- var typs [145]*types.Type
-+ var typs [144]*types.Type
- typs[0] = types.ByteType
- typs[1] = types.NewPtr(typs[0])
- typs[2] = types.Types[types.TANY]
-@@ -342,33 +340,32 @@ func runtimeTypes() []*types.Type {
- typs[114] = newSig(params(typs[1], typs[15], typs[15], typs[7]), params(typs[7]))
- typs[115] = types.NewSlice(typs[2])
- typs[116] = newSig(params(typs[1], typs[115], typs[15]), params(typs[115]))
-- typs[117] = newSig(params(typs[1], typs[7], typs[15]), nil)
-- typs[118] = newSig(params(typs[1], typs[7], typs[22]), nil)
-- typs[119] = newSig(params(typs[3], typs[3], typs[5]), nil)
-- typs[120] = newSig(params(typs[7], typs[5]), nil)
-- typs[121] = newSig(params(typs[3], typs[3], typs[5]), params(typs[6]))
-- typs[122] = newSig(params(typs[3], typs[3]), params(typs[6]))
-- typs[123] = newSig(params(typs[7], typs[7]), params(typs[6]))
-- typs[124] = newSig(params(typs[7], typs[5], typs[5]), params(typs[5]))
-- typs[125] = newSig(params(typs[7], typs[5]), params(typs[5]))
-- typs[126] = newSig(params(typs[22], typs[22]), params(typs[22]))
-- typs[127] = newSig(params(typs[24], typs[24]), params(typs[24]))
-- typs[128] = newSig(params(typs[20]), params(typs[22]))
-- typs[129] = newSig(params(typs[20]), params(typs[24]))
-- typs[130] = newSig(params(typs[20]), params(typs[60]))
-- typs[131] = newSig(params(typs[22]), params(typs[20]))
-- typs[132] = newSig(params(typs[24]), params(typs[20]))
-- typs[133] = newSig(params(typs[60]), params(typs[20]))
-- typs[134] = newSig(params(typs[26], typs[26]), params(typs[26]))
-- typs[135] = newSig(nil, params(typs[5]))
-- typs[136] = newSig(params(typs[5], typs[5]), nil)
-- typs[137] = newSig(params(typs[5], typs[5], typs[5]), nil)
-- typs[138] = newSig(params(typs[7], typs[1], typs[5]), nil)
-- typs[139] = types.NewSlice(typs[7])
-- typs[140] = newSig(params(typs[7], typs[139]), nil)
-- typs[141] = newSig(params(typs[64], typs[64]), nil)
-- typs[142] = newSig(params(typs[58], typs[58]), nil)
-- typs[143] = newSig(params(typs[60], typs[60]), nil)
-- typs[144] = newSig(params(typs[24], typs[24]), nil)
-+ typs[117] = newSig(params(typs[1], typs[7], typs[22]), nil)
-+ typs[118] = newSig(params(typs[3], typs[3], typs[5]), nil)
-+ typs[119] = newSig(params(typs[7], typs[5]), nil)
-+ typs[120] = newSig(params(typs[3], typs[3], typs[5]), params(typs[6]))
-+ typs[121] = newSig(params(typs[3], typs[3]), params(typs[6]))
-+ typs[122] = newSig(params(typs[7], typs[7]), params(typs[6]))
-+ typs[123] = newSig(params(typs[7], typs[5], typs[5]), params(typs[5]))
-+ typs[124] = newSig(params(typs[7], typs[5]), params(typs[5]))
-+ typs[125] = newSig(params(typs[22], typs[22]), params(typs[22]))
-+ typs[126] = newSig(params(typs[24], typs[24]), params(typs[24]))
-+ typs[127] = newSig(params(typs[20]), params(typs[22]))
-+ typs[128] = newSig(params(typs[20]), params(typs[24]))
-+ typs[129] = newSig(params(typs[20]), params(typs[60]))
-+ typs[130] = newSig(params(typs[22]), params(typs[20]))
-+ typs[131] = newSig(params(typs[24]), params(typs[20]))
-+ typs[132] = newSig(params(typs[60]), params(typs[20]))
-+ typs[133] = newSig(params(typs[26], typs[26]), params(typs[26]))
-+ typs[134] = newSig(nil, params(typs[5]))
-+ typs[135] = newSig(params(typs[5], typs[5]), nil)
-+ typs[136] = newSig(params(typs[5], typs[5], typs[5]), nil)
-+ typs[137] = newSig(params(typs[7], typs[1], typs[5]), nil)
-+ typs[138] = types.NewSlice(typs[7])
-+ typs[139] = newSig(params(typs[7], typs[138]), nil)
-+ typs[140] = newSig(params(typs[64], typs[64]), nil)
-+ typs[141] = newSig(params(typs[58], typs[58]), nil)
-+ typs[142] = newSig(params(typs[60], typs[60]), nil)
-+ typs[143] = newSig(params(typs[24], typs[24]), nil)
- return typs[:]
- }
-diff --git a/src/cmd/compile/internal/typecheck/builtin/runtime.go b/src/cmd/compile/internal/typecheck/builtin/runtime.go
-index 2b29ea3c08..bd45258058 100644
---- a/src/cmd/compile/internal/typecheck/builtin/runtime.go
-+++ b/src/cmd/compile/internal/typecheck/builtin/runtime.go
-@@ -183,8 +183,6 @@ func makeslice(typ *byte, len int, cap int) unsafe.Pointer
- func makeslice64(typ *byte, len int64, cap int64) unsafe.Pointer
- func makeslicecopy(typ *byte, tolen int, fromlen int, from unsafe.Pointer) unsafe.Pointer
- func growslice(typ *byte, old []any, cap int) (ary []any)
--func unsafeslice(typ *byte, ptr unsafe.Pointer, len int)
--func unsafeslice64(typ *byte, ptr unsafe.Pointer, len int64)
- func unsafeslicecheckptr(typ *byte, ptr unsafe.Pointer, len int64)
-
- func memmove(to *any, frm *any, length uintptr)
-diff --git a/src/cmd/compile/internal/walk/builtin.go b/src/cmd/compile/internal/walk/builtin.go
-index 14efc05e32..2843d468e5 100644
---- a/src/cmd/compile/internal/walk/builtin.go
-+++ b/src/cmd/compile/internal/walk/builtin.go
-@@ -656,27 +656,14 @@ func walkRecover(nn *ir.CallExpr, init *ir.Nodes) ir.Node {
- func walkUnsafeSlice(n *ir.BinaryExpr, init *ir.Nodes) ir.Node {
- ptr := safeExpr(n.X, init)
- len := safeExpr(n.Y, init)
--
-- fnname := "unsafeslice64"
- lenType := types.Types[types.TINT64]
--
-- // Type checking guarantees that TIDEAL len/cap are positive and fit in an int.
-- // The case of len or cap overflow when converting TUINT or TUINTPTR to TINT
-- // will be handled by the negative range checks in unsafeslice during runtime.
-+ t := n.Type()
- if ir.ShouldCheckPtr(ir.CurFunc, 1) {
-- fnname = "unsafeslicecheckptr"
-- // for simplicity, unsafeslicecheckptr always uses int64
-+ fn := typecheck.LookupRuntime("unsafeslicecheckptr")
-+ init.Append(mkcall1(fn, nil, init, reflectdata.TypePtr(t.Elem()), typecheck.Conv(ptr, types.Types[types.TUNSAFEPTR]), typecheck.Conv(len, lenType)))
- } else if len.Type().IsKind(types.TIDEAL) || len.Type().Size() <= types.Types[types.TUINT].Size() {
-- fnname = "unsafeslice"
- lenType = types.Types[types.TINT]
- }
--
-- t := n.Type()
--
-- // Call runtime.unsafeslice{,64,checkptr} to check ptr and len.
-- fn := typecheck.LookupRuntime(fnname)
-- init.Append(mkcall1(fn, nil, init, reflectdata.TypePtr(t.Elem()), typecheck.Conv(ptr, types.Types[types.TUNSAFEPTR]), typecheck.Conv(len, lenType)))
--
- h := ir.NewSliceHeaderExpr(n.Pos(), t,
- typecheck.Conv(ptr, types.Types[types.TUNSAFEPTR]),
- typecheck.Conv(len, types.Types[types.TINT]),
-diff --git a/test/unsafebuiltins.go b/test/unsafebuiltins.go
-index 4c940aa855..d613088827 100644
---- a/test/unsafebuiltins.go
-+++ b/test/unsafebuiltins.go
-@@ -6,10 +6,7 @@
-
- package main
-
--import (
-- "math"
-- "unsafe"
--)
-+import "unsafe"
-
- const maxUintptr = 1 << (8 * unsafe.Sizeof(uintptr(0)))
-
-@@ -29,24 +26,6 @@ func main() {
- assert(&s[0] == &p[0])
- assert(len(s) == len(p))
- assert(cap(s) == len(p))
--
-- // nil pointer with zero length returns nil
-- assert(unsafe.Slice((*int)(nil), 0) == nil)
--
-- // nil pointer with positive length panics
-- mustPanic(func() { _ = unsafe.Slice((*int)(nil), 1) })
--
-- // negative length
-- var neg int = -1
-- mustPanic(func() { _ = unsafe.Slice(new(byte), neg) })
--
-- // length too large
-- var tooBig uint64 = math.MaxUint64
-- mustPanic(func() { _ = unsafe.Slice(new(byte), tooBig) })
--
-- // size overflows address space
-- mustPanic(func() { _ = unsafe.Slice(new(uint64), maxUintptr/8) })
-- mustPanic(func() { _ = unsafe.Slice(new(uint64), maxUintptr/8+1) })
- }
- }
-
-@@ -55,10 +34,3 @@ func assert(ok bool) {
- panic("FAIL")
- }
- }
--
--func mustPanic(f func()) {
-- defer func() {
-- assert(recover() != nil)
-- }()
-- f()
--}
diff --git a/go-patches/0003-release-branch.go1.17-runtime-support-non-cooperativ.patch b/go-patches/0003-release-branch.go1.17-runtime-support-non-cooperativ.patch
deleted file mode 100644
index dbab4ba0..00000000
--- a/go-patches/0003-release-branch.go1.17-runtime-support-non-cooperativ.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: "Jason A. Donenfeld" <Jason@zx2c4.com>
-Date: Tue, 23 Nov 2021 20:04:24 +0100
-Subject: [PATCH] [release-branch.go1.17] runtime: support non-cooperative
- preemption on windows/arm
-
-This adds support for injecting asynchronous preemption calls on
-windows/arm. This code follows sigctxt.pushCall for POSIX OSes
-on arm, except we subtract 1 from IP, just as in CL 273727.
-
-Updates #10958.
-Updates #24543.
-Updates #49759.
-
-Change-Id: Id0c2aed28662f50631b8c8cede3b4e6f088dafea
-Reviewed-on: https://go-review.googlesource.com/c/go/+/366734
-Trust: Jason A. Donenfeld <Jason@zx2c4.com>
-Reviewed-by: Austin Clements <austin@google.com>
-Reviewed-by: Patrik Nyblom <pnyb@google.com>
-Reviewed-by: Cherry Mui <cherryyz@google.com>
----
- src/runtime/os_windows.go | 16 ++++++++++++++--
- 1 file changed, 14 insertions(+), 2 deletions(-)
-
-diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go
-index f0935264ac..faeb6ce552 100644
---- a/src/runtime/os_windows.go
-+++ b/src/runtime/os_windows.go
-@@ -1303,7 +1303,7 @@ func setThreadCPUProfiler(hz int32) {
- atomic.Store((*uint32)(unsafe.Pointer(&getg().m.profilehz)), uint32(hz))
- }
-
--const preemptMSupported = GOARCH == "386" || GOARCH == "amd64"
-+const preemptMSupported = GOARCH != "arm64"
-
- // suspendLock protects simultaneous SuspendThread operations from
- // suspending each other.
-@@ -1396,8 +1396,20 @@ func preemptM(mp *m) {
- *(*uintptr)(unsafe.Pointer(sp)) = newpc
- c.set_sp(sp)
- c.set_ip(targetPC)
-- }
-
-+ case "arm":
-+ // Push LR. The injected call is responsible
-+ // for restoring LR. gentraceback is aware of
-+ // this extra slot. See sigctxt.pushCall in
-+ // signal_arm.go, which is similar except we
-+ // subtract 1 from IP here.
-+ sp := c.sp()
-+ sp -= sys.PtrSize
-+ c.set_sp(sp)
-+ *(*uint32)(unsafe.Pointer(sp)) = uint32(c.lr())
-+ c.set_lr(newpc - 1)
-+ c.set_ip(targetPC)
-+ }
- stdcall2(_SetThreadContext, thread, uintptr(unsafe.Pointer(c)))
- }
- }
diff --git a/go-patches/0004-runtime-support-non-cooperative-preemption-on-window.patch b/go-patches/0004-runtime-support-non-cooperative-preemption-on-window.patch
deleted file mode 100644
index c99ea390..00000000
--- a/go-patches/0004-runtime-support-non-cooperative-preemption-on-window.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: "Jason A. Donenfeld" <Jason@zx2c4.com>
-Date: Tue, 23 Nov 2021 20:57:24 +0100
-Subject: [PATCH] runtime: support non-cooperative preemption on windows/arm64
-
-This adds support for injecting asynchronous preemption calls on
-windows/arm64. This code exactly follows sigctxt.pushCall for POSIX OSes
-on arm64.
-
-Fixes #49759.
-
-Change-Id: Id35ff6bc105c1db9d7ed2918d3ecab0e4e9a9431
-Reviewed-on: https://go-review.googlesource.com/c/go/+/366735
-Trust: Jason A. Donenfeld <Jason@zx2c4.com>
-Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
-TryBot-Result: Go Bot <gobot@golang.org>
-Reviewed-by: Cherry Mui <cherryyz@google.com>
-Reviewed-by: Austin Clements <austin@google.com>
-Reviewed-by: Patrik Nyblom <pnyb@google.com>
----
- src/runtime/os_windows.go | 18 ++++++++++++------
- 1 file changed, 12 insertions(+), 6 deletions(-)
-
-diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go
-index faeb6ce552..7bf9a426d1 100644
---- a/src/runtime/os_windows.go
-+++ b/src/runtime/os_windows.go
-@@ -1303,18 +1303,13 @@ func setThreadCPUProfiler(hz int32) {
- atomic.Store((*uint32)(unsafe.Pointer(&getg().m.profilehz)), uint32(hz))
- }
-
--const preemptMSupported = GOARCH != "arm64"
-+const preemptMSupported = true
-
- // suspendLock protects simultaneous SuspendThread operations from
- // suspending each other.
- var suspendLock mutex
-
- func preemptM(mp *m) {
-- if !preemptMSupported {
-- // TODO: Implement call injection
-- return
-- }
--
- if mp == getg().m {
- throw("self-preempt")
- }
-@@ -1409,6 +1404,17 @@ func preemptM(mp *m) {
- *(*uint32)(unsafe.Pointer(sp)) = uint32(c.lr())
- c.set_lr(newpc - 1)
- c.set_ip(targetPC)
-+
-+ case "arm64":
-+ // Push LR. The injected call is responsible
-+ // for restoring LR. gentraceback is aware of
-+ // this extra slot. See sigctxt.pushCall in
-+ // signal_arm64.go.
-+ sp := c.sp() - 16 // SP needs 16-byte alignment
-+ c.set_sp(sp)
-+ *(*uint64)(unsafe.Pointer(sp)) = uint64(c.lr())
-+ c.set_lr(newpc)
-+ c.set_ip(targetPC)
- }
- stdcall2(_SetThreadContext, thread, uintptr(unsafe.Pointer(c)))
- }
diff --git a/go.mod b/go.mod
index 3935f62a..52c8b64d 100644
--- a/go.mod
+++ b/go.mod
@@ -1,15 +1,14 @@
module golang.zx2c4.com/wireguard/windows
-go 1.17
+go 1.18
require (
github.com/lxn/walk v0.0.0-20210112085537-c389da54e794
github.com/lxn/win v0.0.0-20210218163916-a377121e959e
- golang.org/x/crypto v0.0.0-20211202192323-5770296d904e
- golang.org/x/net v0.0.0-20211201190559-0a0e4e1bb54c
- golang.org/x/sys v0.0.0-20211124211545-fe61309f8881
+ golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3
+ golang.org/x/net v0.0.0-20211215060638-4ddde0e984e9
+ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
golang.org/x/text v0.3.8-0.20211105212822-18b340fc7af2
- golang.zx2c4.com/go118/netip v0.0.0-20211111135330-a4a02eeacf9d
)
require (
diff --git a/go.mod.master b/go.mod.master
index 01ef436e..ca40b2f0 100644
--- a/go.mod.master
+++ b/go.mod.master
@@ -1,6 +1,6 @@
module golang.zx2c4.com/wireguard/windows
-go 1.17
+go 1.18
require (
github.com/lxn/walk latest
@@ -9,7 +9,6 @@ require (
golang.org/x/net latest
golang.org/x/sys latest
golang.org/x/text master
- golang.zx2c4.com/go118/netip master
)
replace (
diff --git a/go.sum b/go.sum
index 74d411f7..504666f6 100644
--- a/go.sum
+++ b/go.sum
@@ -1,18 +1,18 @@
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
-golang.org/x/crypto v0.0.0-20211202192323-5770296d904e h1:MUP6MR3rJ7Gk9LEia0LP2ytiH6MuCfs7qYz+47jGdD8=
-golang.org/x/crypto v0.0.0-20211202192323-5770296d904e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
+golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 h1:0es+/5331RGQPcXlMfP+WrnIIS6dNnNRe0WB02W0F4M=
+golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20211201190559-0a0e4e1bb54c/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20211215060638-4ddde0e984e9/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20211124211545-fe61309f8881 h1:TyHqChC80pFkXWraUUf6RuB5IqFdQieMLwwCJokV2pc=
-golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
+golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.8-0.20211105212822-18b340fc7af2 h1:GLw7MR8AfAG2GmGcmVgObFOHXYypgGjnGno25RDwn3Y=
golang.org/x/text v0.3.8-0.20211105212822-18b340fc7af2/go.mod h1:EFNZuWvGYxIRUEX+K8UmCFwYmZjqcrnq15ZuVldZkZ0=
@@ -23,8 +23,6 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.zx2c4.com/go118/netip v0.0.0-20211111135330-a4a02eeacf9d h1:9+v0G0naRhLPOJEeJOL6NuXTtAHHwmkyZlgQJ0XcQ8I=
-golang.zx2c4.com/go118/netip v0.0.0-20211111135330-a4a02eeacf9d/go.mod h1:5yyfuiqVIJ7t+3MqrpTQ+QqRkMWiESiyDvPNvKYCecg=
golang.zx2c4.com/wireguard/windows v0.0.0-20210121140954-e7fc19d483bd h1:kAUzMAITME2MCtrXBaUa9P4tndiXGWO674k9gn6ZR28=
golang.zx2c4.com/wireguard/windows v0.0.0-20210121140954-e7fc19d483bd/go.mod h1:Y+FYqVFaQO6a+1uigm0N0GiuaZrLEaBxEiJ8tfH9sMQ=
golang.zx2c4.com/wireguard/windows v0.0.0-20210224134948-620c54ef6199 h1:ogXKLng/Myrt2odYTkleySGzQj/GWg9GV1AQ8P9NnU4=
diff --git a/tunnel/addressconfig.go b/tunnel/addressconfig.go
index 8be13fb9..1ab10965 100644
--- a/tunnel/addressconfig.go
+++ b/tunnel/addressconfig.go
@@ -8,10 +8,9 @@ package tunnel
import (
"fmt"
"log"
+ "net/netip"
"time"
- "golang.zx2c4.com/go118/netip"
-
"golang.org/x/sys/windows"
"golang.zx2c4.com/wireguard/windows/conf"
"golang.zx2c4.com/wireguard/windows/services"
diff --git a/tunnel/firewall/blocker.go b/tunnel/firewall/blocker.go
index 4be62aa9..96fd7f1b 100644
--- a/tunnel/firewall/blocker.go
+++ b/tunnel/firewall/blocker.go
@@ -7,10 +7,9 @@ package firewall
import (
"errors"
+ "net/netip"
"unsafe"
- "golang.zx2c4.com/go118/netip"
-
"golang.org/x/sys/windows"
)
diff --git a/tunnel/firewall/rules.go b/tunnel/firewall/rules.go
index c5a0c4e6..1aff9343 100644
--- a/tunnel/firewall/rules.go
+++ b/tunnel/firewall/rules.go
@@ -8,11 +8,10 @@ package firewall
import (
"encoding/binary"
"errors"
+ "net/netip"
"runtime"
"unsafe"
- "golang.zx2c4.com/go118/netip"
-
"golang.org/x/sys/windows"
)
diff --git a/tunnel/pitfalls.go b/tunnel/pitfalls.go
index 6ac0f725..0238dc5b 100644
--- a/tunnel/pitfalls.go
+++ b/tunnel/pitfalls.go
@@ -7,12 +7,12 @@ package tunnel
import (
"log"
+ "net/netip"
"strings"
"unsafe"
"golang.org/x/sys/windows"
"golang.org/x/sys/windows/svc/mgr"
- "golang.zx2c4.com/go118/netip"
"golang.zx2c4.com/wireguard/windows/conf"
"golang.zx2c4.com/wireguard/windows/tunnel/winipcfg"
)
diff --git a/tunnel/winipcfg/luid.go b/tunnel/winipcfg/luid.go
index 744fee62..c794c86f 100644
--- a/tunnel/winipcfg/luid.go
+++ b/tunnel/winipcfg/luid.go
@@ -7,10 +7,9 @@ package winipcfg
import (
"errors"
+ "net/netip"
"strings"
- "golang.zx2c4.com/go118/netip"
-
"golang.org/x/sys/windows"
)
diff --git a/tunnel/winipcfg/netsh.go b/tunnel/winipcfg/netsh.go
index 17e0778c..9c4622b2 100644
--- a/tunnel/winipcfg/netsh.go
+++ b/tunnel/winipcfg/netsh.go
@@ -10,13 +10,12 @@ import (
"errors"
"fmt"
"io"
+ "net/netip"
"os/exec"
"path/filepath"
"strings"
"syscall"
- "golang.zx2c4.com/go118/netip"
-
"golang.org/x/sys/windows"
"golang.org/x/sys/windows/registry"
)
diff --git a/tunnel/winipcfg/types.go b/tunnel/winipcfg/types.go
index 04510bea..96754da6 100644
--- a/tunnel/winipcfg/types.go
+++ b/tunnel/winipcfg/types.go
@@ -8,11 +8,10 @@ package winipcfg
import (
"encoding/binary"
"fmt"
+ "net/netip"
"strconv"
"unsafe"
- "golang.zx2c4.com/go118/netip"
-
"golang.org/x/sys/windows"
)
diff --git a/tunnel/winipcfg/winipcfg_test.go b/tunnel/winipcfg/winipcfg_test.go
index d863b1a2..4424d1dd 100644
--- a/tunnel/winipcfg/winipcfg_test.go
+++ b/tunnel/winipcfg/winipcfg_test.go
@@ -22,13 +22,12 @@ Some tests in this file require:
package winipcfg
import (
+ "net/netip"
"strings"
"syscall"
"testing"
"time"
- "golang.zx2c4.com/go118/netip"
-
"golang.org/x/sys/windows"
)
diff --git a/ui/editdialog.go b/ui/editdialog.go
index 4a7383d1..a3ea43d5 100644
--- a/ui/editdialog.go
+++ b/ui/editdialog.go
@@ -6,10 +6,9 @@
package ui
import (
+ "net/netip"
"strings"
- "golang.zx2c4.com/go118/netip"
-
"github.com/lxn/walk"
"github.com/lxn/win"
"golang.org/x/sys/windows"