Skip to content

Commit a1841cc

Browse files
authored
msft-golang: upgrade 1.22.2 -> 1.22.3 to address CVE-2024-24787 & CVE-2024-24788 (#9108)
Changelog: https://go.dev/doc/devel/release#go1.22.0 Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
1 parent 7ec4d97 commit a1841cc

3 files changed

Lines changed: 60 additions & 56 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"Signatures": {
33
"go.20230802.5.src.tar.gz": "56b9e0e0c3c13ca95d5efa6de4e7d49a9d190eca77919beff99d33cd3fa74e95",
4-
"go.20240321.6.src.tar.gz": "6be4a8eee684f502d1311ed18acd8bf0cadbf824db666340a60b4f99e74de5a3",
5-
"go1.22.2-20240403.7.src.tar.gz": "b1aff61fcc226c910919f89ccde7d30f1bfe8c59c6bfa09c4e5c857b716fda3b",
4+
"go.20240206.2.src.tar.gz": "7982e0011aa9ab95fd0530404060410af4ba57326d26818690f334fdcb6451cd",
5+
"go1.22.3-20240507.3.src.tar.gz": "43d600d563ac00c2e9ca485691c26114b29496ec6f811431469c85f495df23c8",
66
"go1.4-bootstrap-20171003.tar.gz": "f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52"
77
}
88
}

SPECS/msft-golang/msft-golang.spec

Lines changed: 56 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
%global bootstrap_pre_1_20_compiler_version 20230802.5
2-
%global bootstrap_post_1_20_compiler_version 20240321.6
31
%global goroot %{_libdir}/golang
42
%global gopath %{_datadir}/gocode
3+
%global ms_go_filename go1.22.3-20240507.3.src.tar.gz
4+
%global ms_go_revision 1
55
%ifarch aarch64
66
%global gohostarch arm64
77
%else
@@ -14,17 +14,20 @@
1414
%define __find_requires %{nil}
1515
Summary: Go
1616
Name: msft-golang
17-
Version: 1.22.2
17+
Version: 1.22.3
1818
Release: 1%{?dist}
1919
License: BSD
2020
Vendor: Microsoft Corporation
2121
Distribution: Mariner
2222
Group: System Environment/Security
2323
URL: https://github.com/microsoft/go
24-
Source0: https://github.com/microsoft/go/releases/download/v1.22.2-1/go1.22.2-20240403.7.src.tar.gz
25-
Source1: https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz
26-
Source2: https://github.com/microsoft/go/releases/download/v1.19.12-1/go.%{bootstrap_pre_1_20_compiler_version}.src.tar.gz
27-
Source3: https://github.com/microsoft/go/releases/download/v1.21.8-3/go.%{bootstrap_post_1_20_compiler_version}.src.tar.gz
24+
Source0: https://github.com/microsoft/go/releases/download/v%{version}-%{ms_go_revision}/%{ms_go_filename}
25+
# bootstrap 00, same content as https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz
26+
Source1: https://github.com/microsoft/go/releases/download/v1.4.0-1/go1.4-bootstrap-20171003.tar.gz
27+
# bootstrap 01
28+
Source2: https://github.com/microsoft/go/releases/download/v1.19.12-1/go.20230802.5.src.tar.gz
29+
# bootstrap 02
30+
Source3: https://github.com/microsoft/go/releases/download/v1.20.14-1/go.20240206.2.src.tar.gz
2831
Patch0: go14_bootstrap_aarch64.patch
2932
Conflicts: go
3033
Conflicts: golang
@@ -36,51 +39,47 @@ Go is an open source programming language that makes it easy to build simple, re
3639
# Setup go 1.4 bootstrap source
3740
tar xf %{SOURCE1} --no-same-owner
3841
patch -Np1 --ignore-whitespace < %{PATCH0}
39-
mv -v go go-bootstrap
42+
mv -v go go-bootstrap-00
43+
44+
tar xf %{SOURCE2} --no-same-owner
45+
mv -v go go-bootstrap-01
46+
47+
tar xf %{SOURCE3} --no-same-owner
48+
mv -v go go-bootstrap-02
4049

4150
%setup -q -n go
4251

4352
%build
44-
# Go >= 1.20, < 1.22 bootstraps with go >= 1.17 and
45-
# go >= 1.22 bootstraps with go >= 1.20.6.
46-
# This condition makes go compiler >= 1.20 build a 4 step process:
47-
# - Build the bootstrap compiler 1.4 (bootstrap bits in c)
48-
# - Use the 1.4 compiler to build the %%{bootstrap_pre_1_20_compiler_version} compiler.
49-
# - Use the %%{bootstrap_pre_1_20_compiler_version} compiler to build go %%{bootstrap_post_1_20_compiler_version} compiler.
50-
# - Use the go %%{bootstrap_post_1_20_compiler_version} compiler to build the final go compiler.
51-
52-
# Build go 1.4 bootstrap
53-
pushd %{_topdir}/BUILD/go-bootstrap/src
54-
CGO_ENABLED=0 ./make.bash
55-
popd
56-
mv -v %{_topdir}/BUILD/go-bootstrap %{_libdir}/golang
57-
export GOROOT=%{_libdir}/golang
58-
59-
# Use go1.4 bootstrap to compile go.%%{bootstrap_pre_1_20_compiler_version} (C bootstrap)
60-
export GOROOT_BOOTSTRAP=%{_libdir}/golang
61-
mkdir -p %{_topdir}/BUILD/go.%{bootstrap_pre_1_20_compiler_version}
62-
tar xf %{SOURCE2} -C %{_topdir}/BUILD/go.%{bootstrap_pre_1_20_compiler_version} --strip-components=1
63-
pushd %{_topdir}/BUILD/go.%{bootstrap_pre_1_20_compiler_version}/src
64-
CGO_ENABLED=0 ./make.bash
65-
popd
66-
67-
# Nuke the older go 1.4 bootstrap
68-
rm -rf %{_libdir}/golang
69-
70-
# Make go.%%{bootstrap_pre_1_20_compiler_version} as the new bootstrapper (Go boostrap)
71-
mv -v %{_topdir}/BUILD/go.%{bootstrap_pre_1_20_compiler_version} %{_libdir}/golang
72-
73-
# Build go %%{bootstrap_post_1_20_compiler_version}
74-
export GOROOT_BOOTSTRAP=%{_libdir}/golang
75-
mkdir -p %{_topdir}/BUILD/go.%{bootstrap_pre_1_20_compiler_version}
76-
tar xf %{SOURCE3} -C %{_topdir}/BUILD/go.%{bootstrap_pre_1_20_compiler_version} --strip-components=1
77-
pushd %{_topdir}/BUILD/go.%{bootstrap_pre_1_20_compiler_version}/src
78-
CGO_ENABLED=0 ./make.bash
79-
popd
80-
# Remove %%{bootstrap_pre_1_20_compiler_version} bootstrapper
81-
rm -rf %{_libdir}/golang
82-
# Make %%{bootstrap_post_1_20_compiler_version} as the new bootstrapper
83-
mv -v %{_topdir}/BUILD/go.%{bootstrap_pre_1_20_compiler_version} %{_libdir}/golang
53+
# go 1.4 bootstraps with C.
54+
# go 1.20 bootstraps with go >= 1.17.13
55+
# go >= 1.22 bootstraps with go >= 1.20.14
56+
#
57+
# These conditions make building the current go compiler from C a multistep
58+
# process. Approximately once a year, the bootstrap requirement is moved
59+
# forward, adding another step.
60+
#
61+
# PS: Since go compiles fairly quickly, the extra overhead is around 2-3 minutes
62+
# on a reasonable machine.
63+
64+
# Use prev bootstrap to compile next bootstrap.
65+
function go_bootstrap() {
66+
local bootstrap=$1
67+
local new_root=%{_topdir}/BUILD/go-bootstrap-${bootstrap}
68+
(
69+
cd ${new_root}/src
70+
CGO_ENABLED=0 ./make.bash
71+
)
72+
# Nuke the older bootstrapper
73+
rm -rf %{_libdir}/golang
74+
# Install the new bootstrapper
75+
mv -v $new_root %{_libdir}/golang
76+
export GOROOT=%{_libdir}/golang
77+
export GOROOT_BOOTSTRAP=%{_libdir}/golang
78+
}
79+
80+
go_bootstrap 00
81+
go_bootstrap 01
82+
go_bootstrap 02
8483

8584
# Build current go version
8685
export GOHOSTOS=linux
@@ -91,9 +90,10 @@ export GOROOT="`pwd`"
9190
export GOPATH=%{gopath}
9291
export GOROOT_FINAL=%{_bindir}/go
9392
rm -f %{gopath}/src/runtime/*.c
94-
pushd src
95-
./make.bash --no-clean
96-
popd
93+
(
94+
cd src
95+
./make.bash --no-clean
96+
)
9797

9898
%install
9999

@@ -153,6 +153,10 @@ fi
153153
%{_bindir}/*
154154

155155
%changelog
156+
* Wed May 15 2024 Muhammad Falak <mwani@microsoft.com> - 1.22.3-1
157+
- Introduce function in spec to simplify bootstrapping
158+
- Bump version to 1.22.3
159+
156160
* Mon Apr 15 2024 Muhammad Falak <mwani@microsoft.com> - 1.22.2-1
157161
- Bump version to 1.22.2
158162

@@ -171,7 +175,7 @@ fi
171175

172176
* Wed Aug 16 2023 Brian Fjeldstad <bfjelds@microsoft.com> - 1.19.12-1
173177
- Upgrade to 1.19.12 to fix CVE-2023-39533
174-
178+
1.22.2
175179
* Tue Jun 06 2023 Bala <balakumaran.kannan@microsoft.com> - 1.19.10-1
176180
- Upgrade to 1.19.10 to fix CVE-2023-29404
177181

cgmanifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13653,8 +13653,8 @@
1365313653
"type": "other",
1365413654
"other": {
1365513655
"name": "msft-golang",
13656-
"version": "1.22.2",
13657-
"downloadUrl": "https://github.com/microsoft/go/releases/download/v1.22.2-1/go1.22.2-20240403.7.src.tar.gz"
13656+
"version": "1.22.3",
13657+
"downloadUrl": "https://github.com/microsoft/go/releases/download/v1.22.3-1/go1.22.3-20240507.3.src.tar.gz"
1365813658
}
1365913659
}
1366013660
},

0 commit comments

Comments
 (0)