golang: Update to 1.20.2, refresh patch

Includes fixes for:

* 1.20.1:
  * CVE-2022-41722: path/filepath: path traversal in filepath.Clean on
    Windows
  * CVE-2022-41723: net/http: avoid quadratic complexity in HPACK
    decoding
  * CVE-2022-41724: crypto/tls: large handshake records may cause panics
  * CVE-2022-41725: net/http, mime/multipart: denial of service from
    excessive resource consumption

* 1.20.2:
  * CVE-2023-24532: crypto/elliptic: specific unreduced P-256 scalars
    produce incorrect results

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
This commit is contained in:
Jeffery To 2023-03-16 11:19:10 +08:00 committed by Beginner-Go
parent 7d573938ed
commit b6468a6bd5
4 changed files with 48 additions and 13 deletions

View File

@ -76,8 +76,10 @@ define GoCompiler/Default/Install/Bin
$(INSTALL_BIN) -p "$(1)/bin/$(4)"/* "$(2)/lib/go-$(3)/bin/" $(INSTALL_BIN) -p "$(1)/bin/$(4)"/* "$(2)/lib/go-$(3)/bin/"
endif endif
$(INSTALL_DIR) "$(2)/lib/go-$(3)/pkg" if [ -d "$(1)/pkg/$(4)$(if $(5),_$(5))" ]; then \
$(CP) "$(1)/pkg/$(4)$(if $(5),_$(5))" "$(2)/lib/go-$(3)/pkg/" $(INSTALL_DIR) "$(2)/lib/go-$(3)/pkg" ; \
$(CP) "$(1)/pkg/$(4)$(if $(5),_$(5))" "$(2)/lib/go-$(3)/pkg/" ; \
fi
$(INSTALL_DIR) "$(2)/lib/go-$(3)/pkg/tool/$(4)" $(INSTALL_DIR) "$(2)/lib/go-$(3)/pkg/tool/$(4)"
$(INSTALL_BIN) -p "$(1)/pkg/tool/$(4)"/* "$(2)/lib/go-$(3)/pkg/tool/$(4)/" $(INSTALL_BIN) -p "$(1)/pkg/tool/$(4)"/* "$(2)/lib/go-$(3)/pkg/tool/$(4)/"

View File

@ -65,6 +65,10 @@ unexport \
GOPPC64 \ GOPPC64 \
GOWASM GOWASM
# Environment variables for use with code coverage:
unexport \
GOCOVERDIR
# Special-purpose environment variables: # Special-purpose environment variables:
unexport \ unexport \
GCCGOTOOLDIR \ GCCGOTOOLDIR \
@ -202,12 +206,11 @@ GO_ARCH_DEPENDS:=@(aarch64||arm||i386||i686||mips||mips64||mips64el||mipsel||pow
# ASLR/PIE # ASLR/PIE
# From https://go.dev/src/cmd/internal/sys/supported.go # From https://go.dev/src/internal/platform/supported.go
GO_PIE_SUPPORTED_OS_ARCH:= \ GO_PIE_SUPPORTED_OS_ARCH:= \
android_386 android_amd64 android_arm android_arm64 \ android_386 android_amd64 android_arm android_arm64 \
linux_386 linux_amd64 linux_arm linux_arm64 \ linux_386 linux_amd64 linux_arm linux_arm64 \
\ windows_386 windows_amd64 windows_arm windows_arm64 \
windows_386 windows_amd64 windows_arm \
\ \
darwin_amd64 darwin_arm64 \ darwin_amd64 darwin_arm64 \
ios_amd64 ios_arm64 \ ios_amd64 ios_arm64 \
@ -219,7 +222,7 @@ GO_PIE_SUPPORTED_OS_ARCH:= \
linux_ppc64le linux_riscv64 linux_s390x linux_ppc64le linux_riscv64 linux_s390x
# From https://go.dev/src/cmd/go/internal/work/init.go # From https://go.dev/src/cmd/go/internal/work/init.go
go_pie_install_suffix=$(if $(filter $(1),aix_ppc64 windows_386 windows_amd64 windows_arm),,shared) go_pie_install_suffix=$(if $(filter $(1),aix_ppc64 windows_386 windows_amd64 windows_arm windows_arm64),,shared)
ifneq ($(filter $(GO_HOST_OS_ARCH),$(GO_PIE_SUPPORTED_OS_ARCH)),) ifneq ($(filter $(GO_HOST_OS_ARCH),$(GO_PIE_SUPPORTED_OS_ARCH)),)
GO_HOST_PIE_SUPPORTED:=1 GO_HOST_PIE_SUPPORTED:=1

View File

@ -7,8 +7,8 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
GO_VERSION_MAJOR_MINOR:=1.19 GO_VERSION_MAJOR_MINOR:=1.20
GO_VERSION_PATCH:=7 GO_VERSION_PATCH:=2
PKG_NAME:=golang PKG_NAME:=golang
PKG_VERSION:=$(GO_VERSION_MAJOR_MINOR)$(if $(GO_VERSION_PATCH),.$(GO_VERSION_PATCH)) PKG_VERSION:=$(GO_VERSION_MAJOR_MINOR)$(if $(GO_VERSION_PATCH),.$(GO_VERSION_PATCH))
@ -20,7 +20,7 @@ GO_SOURCE_URLS:=https://dl.google.com/go/ \
PKG_SOURCE:=go$(PKG_VERSION).src.tar.gz PKG_SOURCE:=go$(PKG_VERSION).src.tar.gz
PKG_SOURCE_URL:=$(GO_SOURCE_URLS) PKG_SOURCE_URL:=$(GO_SOURCE_URLS)
PKG_HASH:=775bdf285ceaba940da8a2fe20122500efd7a0b65dbcee85247854a8d7402633 PKG_HASH:=4d0e2850d197b4ddad3bdb0196300179d095bb3aefd4dfbc3b36702c3728f8ab
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com> PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
PKG_LICENSE:=BSD-3-Clause PKG_LICENSE:=BSD-3-Clause
@ -63,6 +63,8 @@ HOST_GO_VALID_OS_ARCH:= \
aix_ppc64 \ aix_ppc64 \
js_wasm \ js_wasm \
\ \
freebsd_riscv64 \
\
linux_ppc64 linux_ppc64le \ linux_ppc64 linux_ppc64le \
linux_mips linux_mipsle linux_mips64 linux_mips64le \ linux_mips linux_mipsle linux_mips64 linux_mips64le \
linux_loong64 linux_riscv64 linux_s390x \ linux_loong64 linux_riscv64 linux_s390x \
@ -86,6 +88,12 @@ BOOTSTRAP_GO_VALID_OS_ARCH:= \
solaris_amd64 \ solaris_amd64 \
windows_386 windows_amd64 windows_386 windows_amd64
BOOTSTRAP_1_17_SOURCE:=go1.17.13.src.tar.gz
BOOTSTRAP_1_17_SOURCE_URL:=$(GO_SOURCE_URLS)
BOOTSTRAP_1_17_HASH:=a1a48b23afb206f95e7bbaa9b898d965f90826f6f1d1fc0c1d784ada0cd300fd
BOOTSTRAP_1_17_BUILD_DIR:=$(HOST_BUILD_DIR)/.go_bootstrap_1.17
include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
include ../golang-compiler.mk include ../golang-compiler.mk
@ -94,6 +102,7 @@ include ../golang-package.mk
PKG_UNPACK:=$(HOST_TAR) -C "$(PKG_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(PKG_SOURCE)" PKG_UNPACK:=$(HOST_TAR) -C "$(PKG_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(PKG_SOURCE)"
HOST_UNPACK:=$(HOST_TAR) -C "$(HOST_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(PKG_SOURCE)" HOST_UNPACK:=$(HOST_TAR) -C "$(HOST_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(PKG_SOURCE)"
BOOTSTRAP_UNPACK:=$(HOST_TAR) -C "$(BOOTSTRAP_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(BOOTSTRAP_SOURCE)" BOOTSTRAP_UNPACK:=$(HOST_TAR) -C "$(BOOTSTRAP_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(BOOTSTRAP_SOURCE)"
BOOTSTRAP_1_17_UNPACK:=$(HOST_TAR) -C "$(BOOTSTRAP_1_17_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(BOOTSTRAP_1_17_SOURCE)"
# don't strip ELF executables in test data # don't strip ELF executables in test data
RSTRIP:=: RSTRIP:=:
@ -181,8 +190,7 @@ ifeq ($(BOOTSTRAP_ROOT_DIR),)
$(eval $(call Download,golang-bootstrap)) $(eval $(call Download,golang-bootstrap))
define Bootstrap/Prepare define Bootstrap/Prepare
mkdir -p "$(BOOTSTRAP_BUILD_DIR)" mkdir -p "$(BOOTSTRAP_BUILD_DIR)" && $(BOOTSTRAP_UNPACK) ;
$(BOOTSTRAP_UNPACK)
endef endef
Hooks/HostPrepare/Post+=Bootstrap/Prepare Hooks/HostPrepare/Post+=Bootstrap/Prepare
@ -190,6 +198,23 @@ ifeq ($(BOOTSTRAP_ROOT_DIR),)
endif endif
# Bootstrap 1.17
define Download/golang-bootstrap-1.17
FILE:=$(BOOTSTRAP_1_17_SOURCE)
URL:=$(BOOTSTRAP_1_17_SOURCE_URL)
HASH:=$(BOOTSTRAP_1_17_HASH)
endef
$(eval $(call Download,golang-bootstrap-1.17))
define Bootstrap-1.17/Prepare
mkdir -p "$(BOOTSTRAP_1_17_BUILD_DIR)" && $(BOOTSTRAP_1_17_UNPACK) ;
endef
Hooks/HostPrepare/Post+=Bootstrap-1.17/Prepare
$(eval $(call GoCompiler/AddProfile,Bootstrap-1.17,$(BOOTSTRAP_1_17_BUILD_DIR),,bootstrap-1.17,$(GO_HOST_OS_ARCH)))
# Host # Host
ifeq ($(GO_HOST_PIE_SUPPORTED),1) ifeq ($(GO_HOST_PIE_SUPPORTED),1)
@ -220,8 +245,13 @@ define Host/Compile
$(HOST_GO_VARS) \ $(HOST_GO_VARS) \
) )
$(call GoCompiler/Host/Make, \ $(call GoCompiler/Bootstrap-1.17/Make, \
GOROOT_BOOTSTRAP="$(BOOTSTRAP_ROOT_DIR)" \ GOROOT_BOOTSTRAP="$(BOOTSTRAP_ROOT_DIR)" \
$(HOST_GO_VARS) \
)
$(call GoCompiler/Host/Make, \
GOROOT_BOOTSTRAP="$(BOOTSTRAP_1_17_BUILD_DIR)" \
$(if $(HOST_GO_ENABLE_PIE),GO_LDFLAGS="-buildmode pie") \ $(if $(HOST_GO_ENABLE_PIE),GO_LDFLAGS="-buildmode pie") \
$(HOST_GO_VARS) \ $(HOST_GO_VARS) \
) )

View File

@ -13,7 +13,7 @@ Fixes #22040.
--- a/src/cmd/link/internal/ld/lib.go --- a/src/cmd/link/internal/ld/lib.go
+++ b/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go
@@ -1502,25 +1502,20 @@ func (ctxt *Link) hostlink() { @@ -1535,25 +1535,20 @@ func (ctxt *Link) hostlink() {
} }
if ctxt.Arch.InFamily(sys.ARM, sys.ARM64) && buildcfg.GOOS == "linux" { if ctxt.Arch.InFamily(sys.ARM, sys.ARM64) && buildcfg.GOOS == "linux" {