aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-11-27 22:21:11 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2020-11-27 22:21:11 +0100
commit3bb59485ef68f8656cd49d2c4e97add05a35f8ee (patch)
treef19f956d9a5cdf9ae910cc2eaa024c5f30c1098d
parentversion: bump (diff)
downloadwireguard-windows-3bb59485ef68f8656cd49d2c4e97add05a35f8ee.tar.xz
wireguard-windows-3bb59485ef68f8656cd49d2c4e97add05a35f8ee.zip
go-patches: fix isAbort calculation on arm
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--go-patches/0001-cmd-link-recognize-arm-header-of-PE-objects.patch2
-rw-r--r--go-patches/0002-cmd-link-deal-with-ADDR32NB-relocations-the-same-way.patch2
-rw-r--r--go-patches/0003-cmd-link-ignore-SEH-marking-on-PE-objects.patch2
-rw-r--r--go-patches/0004-cmd-link-do-not-mark-resource-section-as-writable.patch2
-rw-r--r--go-patches/0005-cmd-link-handle-grouped-resource-sections.patch2
-rw-r--r--go-patches/0006-Revert-release-branch.go1.15-runtime-detect-services.patch2
-rw-r--r--go-patches/0007-runtime-do-not-explicitly-exit-on-ctrl-handler.patch2
-rw-r--r--go-patches/0008-runtime-allow-callback-functions-with-up-to-8-argume.patch2
-rw-r--r--go-patches/0009-runtime-use-CreateWaitableTimerEx-to-implement-uslee.patch2
-rw-r--r--go-patches/0010-runtime-allow-for-usleep2HighRes-to-run-without-TLS-.patch2
-rw-r--r--go-patches/0011-cmd-link-windows-arm-is-all-pie-so-mark-it-as-such.patch2
-rw-r--r--go-patches/0012-runtime-adjust-address-calculation-in-identifying-ab.patch44
12 files changed, 55 insertions, 11 deletions
diff --git a/go-patches/0001-cmd-link-recognize-arm-header-of-PE-objects.patch b/go-patches/0001-cmd-link-recognize-arm-header-of-PE-objects.patch
index 9cda62f8..ae337f18 100644
--- a/go-patches/0001-cmd-link-recognize-arm-header-of-PE-objects.patch
+++ b/go-patches/0001-cmd-link-recognize-arm-header-of-PE-objects.patch
@@ -1,7 +1,7 @@
From fde4a13eb5eba28ac546b10752b38a80f389cc5a Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Sun, 8 Nov 2020 02:48:09 +0100
-Subject: [PATCH 01/11] cmd/link: recognize arm header of PE objects
+Subject: [PATCH 01/12] cmd/link: recognize arm header of PE objects
The linker recognizes headers for 386 and amd64 PE objects, but not arm
objects. This is easily overlooked, since its the same as the 386 header
diff --git a/go-patches/0002-cmd-link-deal-with-ADDR32NB-relocations-the-same-way.patch b/go-patches/0002-cmd-link-deal-with-ADDR32NB-relocations-the-same-way.patch
index 48247bf2..3bdaa2f4 100644
--- a/go-patches/0002-cmd-link-deal-with-ADDR32NB-relocations-the-same-way.patch
+++ b/go-patches/0002-cmd-link-deal-with-ADDR32NB-relocations-the-same-way.patch
@@ -1,7 +1,7 @@
From a0a59fc25f4d8aef3c7bce38c84f04c504745f0e Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Sun, 8 Nov 2020 03:09:42 +0100
-Subject: [PATCH 02/11] cmd/link: deal with ADDR32NB relocations the same way
+Subject: [PATCH 02/12] cmd/link: deal with ADDR32NB relocations the same way
as ADDR32 on arm
As far as I can tell, the addend is the same for both of these, and in
diff --git a/go-patches/0003-cmd-link-ignore-SEH-marking-on-PE-objects.patch b/go-patches/0003-cmd-link-ignore-SEH-marking-on-PE-objects.patch
index 8d4dda45..60fed7f8 100644
--- a/go-patches/0003-cmd-link-ignore-SEH-marking-on-PE-objects.patch
+++ b/go-patches/0003-cmd-link-ignore-SEH-marking-on-PE-objects.patch
@@ -1,7 +1,7 @@
From e8142ab5e3b3a513683a8e3792e6197644547981 Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Sun, 8 Nov 2020 03:20:36 +0100
-Subject: [PATCH 03/11] cmd/link: ignore SEH marking on PE objects
+Subject: [PATCH 03/12] cmd/link: ignore SEH marking on PE objects
Microsoft's linker looks at whether all input objects have an empty
section called @feat.00. If all of them do, then it enables SEH;
diff --git a/go-patches/0004-cmd-link-do-not-mark-resource-section-as-writable.patch b/go-patches/0004-cmd-link-do-not-mark-resource-section-as-writable.patch
index 6ef0564f..722283df 100644
--- a/go-patches/0004-cmd-link-do-not-mark-resource-section-as-writable.patch
+++ b/go-patches/0004-cmd-link-do-not-mark-resource-section-as-writable.patch
@@ -1,7 +1,7 @@
From 8255e115f325a58fd4746741f9f35c2f54d70d63 Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Sun, 8 Nov 2020 11:11:27 +0100
-Subject: [PATCH 04/11] cmd/link: do not mark resource section as writable
+Subject: [PATCH 04/12] cmd/link: do not mark resource section as writable
Resources are immutable, and all other linkers set this section to be
read-only and not read-write. Fix this oversight by rmoving the writable
diff --git a/go-patches/0005-cmd-link-handle-grouped-resource-sections.patch b/go-patches/0005-cmd-link-handle-grouped-resource-sections.patch
index e917b60d..b0de26fb 100644
--- a/go-patches/0005-cmd-link-handle-grouped-resource-sections.patch
+++ b/go-patches/0005-cmd-link-handle-grouped-resource-sections.patch
@@ -1,7 +1,7 @@
From 5d5d74f35dd3375cda8ef2ba8257547aad107ecb Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Sun, 8 Nov 2020 11:57:42 +0100
-Subject: [PATCH 05/11] cmd/link: handle grouped resource sections
+Subject: [PATCH 05/12] cmd/link: handle grouped resource sections
The Go PE linker does not support enough generalized PE logic to
properly handle .rsrc sections gracefully. Instead a few things are
diff --git a/go-patches/0006-Revert-release-branch.go1.15-runtime-detect-services.patch b/go-patches/0006-Revert-release-branch.go1.15-runtime-detect-services.patch
index c30713a9..635d3553 100644
--- a/go-patches/0006-Revert-release-branch.go1.15-runtime-detect-services.patch
+++ b/go-patches/0006-Revert-release-branch.go1.15-runtime-detect-services.patch
@@ -1,7 +1,7 @@
From e6b4c1b3beb4f843ed40abead27c8132d29a0db8 Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Fri, 11 Sep 2020 13:04:11 +0200
-Subject: [PATCH 06/11] Revert "[release-branch.go1.15] runtime: detect
+Subject: [PATCH 06/12] Revert "[release-branch.go1.15] runtime: detect
services in signal handler"
This reverts commit b1253d24e159129c778377c3a2a0bde15904a417.
diff --git a/go-patches/0007-runtime-do-not-explicitly-exit-on-ctrl-handler.patch b/go-patches/0007-runtime-do-not-explicitly-exit-on-ctrl-handler.patch
index 8dd22e3c..e1c35658 100644
--- a/go-patches/0007-runtime-do-not-explicitly-exit-on-ctrl-handler.patch
+++ b/go-patches/0007-runtime-do-not-explicitly-exit-on-ctrl-handler.patch
@@ -1,7 +1,7 @@
From af4eb34d920c0c727041ebf587e0de608068ed59 Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Tue, 14 Jul 2020 01:41:03 -0600
-Subject: [PATCH 07/11] runtime: do not explicitly exit on ctrl handler
+Subject: [PATCH 07/12] runtime: do not explicitly exit on ctrl handler
The default ctrl+c handler should process exits in situations where it
makes sense, like console apps, but not in situations where it doesn't,
diff --git a/go-patches/0008-runtime-allow-callback-functions-with-up-to-8-argume.patch b/go-patches/0008-runtime-allow-callback-functions-with-up-to-8-argume.patch
index 96d39ca6..0ef3f508 100644
--- a/go-patches/0008-runtime-allow-callback-functions-with-up-to-8-argume.patch
+++ b/go-patches/0008-runtime-allow-callback-functions-with-up-to-8-argume.patch
@@ -1,7 +1,7 @@
From 5a7c808cbacb8c0477395c5656c1eba3ef38cd6e Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Tue, 10 Nov 2020 21:42:36 +0100
-Subject: [PATCH 08/11] runtime: allow callback functions with up to 8
+Subject: [PATCH 08/12] runtime: allow callback functions with up to 8
arguments on windows/arm
Previously, windows/arm programs would abort when trying to use
diff --git a/go-patches/0009-runtime-use-CreateWaitableTimerEx-to-implement-uslee.patch b/go-patches/0009-runtime-use-CreateWaitableTimerEx-to-implement-uslee.patch
index 4aa40061..55e11376 100644
--- a/go-patches/0009-runtime-use-CreateWaitableTimerEx-to-implement-uslee.patch
+++ b/go-patches/0009-runtime-use-CreateWaitableTimerEx-to-implement-uslee.patch
@@ -1,7 +1,7 @@
From 1a163f2e676e4664f2db3f614eb4168bda9d4fd8 Mon Sep 17 00:00:00 2001
From: Alex Brainman <alex.brainman@gmail.com>
Date: Sun, 19 Jul 2020 16:06:48 +1000
-Subject: [PATCH 09/11] runtime: use CreateWaitableTimerEx to implement usleep
+Subject: [PATCH 09/12] runtime: use CreateWaitableTimerEx to implement usleep
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
diff --git a/go-patches/0010-runtime-allow-for-usleep2HighRes-to-run-without-TLS-.patch b/go-patches/0010-runtime-allow-for-usleep2HighRes-to-run-without-TLS-.patch
index 890c80ea..66397a53 100644
--- a/go-patches/0010-runtime-allow-for-usleep2HighRes-to-run-without-TLS-.patch
+++ b/go-patches/0010-runtime-allow-for-usleep2HighRes-to-run-without-TLS-.patch
@@ -1,7 +1,7 @@
From 1edac4879e2d4a36d339353c151cb7b9871e135f Mon Sep 17 00:00:00 2001
From: Alex Brainman <alex.brainman@gmail.com>
Date: Sat, 21 Nov 2020 14:56:26 +1100
-Subject: [PATCH 10/11] runtime: allow for usleep2HighRes to run without TLS
+Subject: [PATCH 10/12] runtime: allow for usleep2HighRes to run without TLS
setup
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
diff --git a/go-patches/0011-cmd-link-windows-arm-is-all-pie-so-mark-it-as-such.patch b/go-patches/0011-cmd-link-windows-arm-is-all-pie-so-mark-it-as-such.patch
index 4fc38459..b1ed0b30 100644
--- a/go-patches/0011-cmd-link-windows-arm-is-all-pie-so-mark-it-as-such.patch
+++ b/go-patches/0011-cmd-link-windows-arm-is-all-pie-so-mark-it-as-such.patch
@@ -1,7 +1,7 @@
From fee7906e1a7e62b655bea0f25c921572ee29fc44 Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Thu, 26 Nov 2020 22:38:45 +0100
-Subject: [PATCH 11/11] cmd/link: windows/arm is all pie, so mark it as such
+Subject: [PATCH 11/12] cmd/link: windows/arm is all pie, so mark it as such
If the linker thinks that it's making an exe instead of a pie object, it
won't apply relocations to the pclntab and we wind up with crashes like:
diff --git a/go-patches/0012-runtime-adjust-address-calculation-in-identifying-ab.patch b/go-patches/0012-runtime-adjust-address-calculation-in-identifying-ab.patch
new file mode 100644
index 00000000..f0e60ad6
--- /dev/null
+++ b/go-patches/0012-runtime-adjust-address-calculation-in-identifying-ab.patch
@@ -0,0 +1,44 @@
+From 8ec41fee1e6ef074ef74e56fe079c70c8a1d0548 Mon Sep 17 00:00:00 2001
+From: "Jason A. Donenfeld" <Jason@zx2c4.com>
+Date: Fri, 27 Nov 2020 22:07:23 +0100
+Subject: [PATCH 12/12] runtime: adjust address calculation in identifying
+ abort on windows/arm
+
+Apparently we're being called on arm 1 byte off, just like on 386 and
+amd64, so unify the handler for isAbortPC.
+
+Fixes #42859.
+Updates #29050.
+
+Change-Id: I97fffeb4a33d93ca3397ce1c9ba2b05137f391ca
+---
+ src/runtime/signal_windows.go | 13 +++----------
+ 1 file changed, 3 insertions(+), 10 deletions(-)
+
+diff --git a/src/runtime/signal_windows.go b/src/runtime/signal_windows.go
+index d123276d3e..8db24fb805 100644
+--- a/src/runtime/signal_windows.go
++++ b/src/runtime/signal_windows.go
+@@ -43,16 +43,9 @@ func initExceptionHandler() {
+ //
+ //go:nosplit
+ func isAbort(r *context) bool {
+- switch GOARCH {
+- case "386", "amd64":
+- // In the case of an abort, the exception IP is one byte after
+- // the INT3 (this differs from UNIX OSes).
+- return isAbortPC(r.ip() - 1)
+- case "arm":
+- return isAbortPC(r.ip())
+- default:
+- return false
+- }
++ // In the case of an abort, the exception IP is one byte after
++ // the INT3 (this differs from UNIX OSes).
++ return isAbortPC(r.ip() - 1)
+ }
+
+ // isgoexception reports whether this exception should be translated
+--
+2.29.2
+