diff --git a/.gitignore b/.gitignore index 72c275e..d33c2ca 100644 --- a/.gitignore +++ b/.gitignore @@ -103,3 +103,4 @@ /go1.16.4.src.tar.gz /go1.16.5.src.tar.gz /go1.16.6.src.tar.gz +/go1.17rc2.src.tar.gz diff --git a/0003-cmd-go-disable-Google-s-proxy-and-sumdb.patch b/0003-cmd-go-disable-Google-s-proxy-and-sumdb.patch index 9f55553..fba9713 100644 --- a/0003-cmd-go-disable-Google-s-proxy-and-sumdb.patch +++ b/0003-cmd-go-disable-Google-s-proxy-and-sumdb.patch @@ -4,33 +4,27 @@ Date: Mon, 27 May 2019 15:12:53 +0200 Subject: [PATCH 3/3] cmd/go: disable Google's proxy and sumdb --- - src/cmd/go/internal/cfg/cfg.go | 10 +++++----- - src/cmd/go/testdata/script/mod_sumdb_golang.txt | 6 +++--- - 2 files changed, 8 insertions(+), 8 deletions(-) + src/cmd/go/internal/cfg/cfg.go | 4 ++-- + src/cmd/go/testdata/script/mod_sumdb_golang.txt | 6 +++--- + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go -index 9bc48132ae..d5be72473f 100644 +index 57a3c1ff6f..e56c60e591 100644 --- a/src/cmd/go/internal/cfg/cfg.go +++ b/src/cmd/go/internal/cfg/cfg.go -@@ -262,11 +262,11 @@ var ( - GOPPC64 = envOr("GOPPC64", fmt.Sprintf("%s%d", "power", objabi.GOPPC64)) - GOWASM = envOr("GOWASM", fmt.Sprint(objabi.GOWASM)) +@@ -266,8 +266,8 @@ var ( + GOPPC64 = envOr("GOPPC64", fmt.Sprintf("%s%d", "power", buildcfg.GOPPC64)) + GOWASM = envOr("GOWASM", fmt.Sprint(buildcfg.GOWASM)) - GOPROXY = envOr("GOPROXY", "https://proxy.golang.org,direct") - GOSUMDB = envOr("GOSUMDB", "sum.golang.org") -- GOPRIVATE = Getenv("GOPRIVATE") -- GONOPROXY = envOr("GONOPROXY", GOPRIVATE) -- GONOSUMDB = envOr("GONOSUMDB", GOPRIVATE) -+ GOPROXY = envOr("GOPROXY", "direct") -+ GOSUMDB = envOr("GOSUMDB", "off") -+ GOPRIVATE = Getenv("GOPRIVATE") -+ GONOPROXY = envOr("GONOPROXY", GOPRIVATE) -+ GONOSUMDB = envOr("GONOSUMDB", GOPRIVATE) - GOINSECURE = Getenv("GOINSECURE") - GOVCS = Getenv("GOVCS") - ) ++ GOPROXY = envOr("GOPROXY", "direct") ++ GOSUMDB = envOr("GOSUMDB", "off") + GOPRIVATE = Getenv("GOPRIVATE") + GONOPROXY = envOr("GONOPROXY", GOPRIVATE) + GONOSUMDB = envOr("GONOSUMDB", GOPRIVATE) diff --git a/src/cmd/go/testdata/script/mod_sumdb_golang.txt b/src/cmd/go/testdata/script/mod_sumdb_golang.txt -index cc0b0da474..b50689e209 100644 +index becd88b52e..b2a1250372 100644 --- a/src/cmd/go/testdata/script/mod_sumdb_golang.txt +++ b/src/cmd/go/testdata/script/mod_sumdb_golang.txt @@ -2,12 +2,12 @@ @@ -48,7 +42,7 @@ index cc0b0da474..b50689e209 100644 +stdout '^off$' # Download direct from github. - [!net] skip + -- -2.26.2 +2.31.1 diff --git a/golang.spec b/golang.spec index 59a5f61..8101fb8 100644 --- a/golang.spec +++ b/golang.spec @@ -105,11 +105,12 @@ %global gohostarch s390x %endif -%global go_api 1.16 -%global go_version %{go_api}.6 +%global go_api 1.17 +%global go_prerelease rc2 +%global go_version %{go_api}%{?go_prerelease} # For rpmdev-bumpspec and releng automation -%global baserelease 3 +%global baserelease 1 Name: golang Version: %{go_version} @@ -158,8 +159,6 @@ Requires: go-srpm-macros Patch1: 0001-Don-t-use-the-bundled-tzdata-at-runtime-except-for-t.patch Patch2: 0002-syscall-expose-IfInfomsg.X__ifi_pad-on-s390x.patch Patch3: 0003-cmd-go-disable-Google-s-proxy-and-sumdb.patch -# https://go-review.googlesource.com/c/go/+/334410/ -Patch4: ppc64le-vdso-fix.patch # Having documentation separate was broken Obsoletes: %{name}-docs < 1.1-4 @@ -337,6 +336,7 @@ GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -race -v -x std %endif %install +echo "== 1 ==" rm -rf $RPM_BUILD_ROOT # remove GC build cache rm -rf pkg/obj/go-build/* @@ -347,9 +347,9 @@ mkdir -p $RPM_BUILD_ROOT%{goroot} # install everything into libdir (until symlink problems are fixed) # https://code.google.com/p/go/issues/detail?id=5830 -cp -apv api bin doc favicon.ico lib pkg robots.txt src misc test VERSION \ +cp -apv api bin doc lib pkg src misc test VERSION \ $RPM_BUILD_ROOT%{goroot} - +echo "== 2 ==" # bz1099206 find $RPM_BUILD_ROOT%{goroot}/src -exec touch -r $RPM_BUILD_ROOT%{goroot}/VERSION "{}" \; # and level out all the built archives @@ -367,6 +367,7 @@ tests_list=$cwd/go-tests.list rm -f $src_list $pkg_list $docs_list $misc_list $tests_list $shared_list $race_list touch $src_list $pkg_list $docs_list $misc_list $tests_list $shared_list $race_list pushd $RPM_BUILD_ROOT%{goroot} + echo "== 3 ==" find src/ -type d -a \( ! -name testdata -a ! -ipath '*/testdata/*' \) -printf '%%%dir %{goroot}/%p\n' >> $src_list find src/ ! -type d -a \( ! -ipath '*/testdata/*' -a ! -name '*_test.go' \) -printf '%{goroot}/%p\n' >> $src_list @@ -380,6 +381,7 @@ pushd $RPM_BUILD_ROOT%{goroot} find misc/ ! -type d -printf '%{goroot}/%p\n' >> $misc_list %if %{shared} +echo "== 4 ==" mkdir -p %{buildroot}/%{_libdir}/ mkdir -p %{buildroot}/%{golibdir}/ for file in $(find . -iname "*.so" ); do @@ -396,6 +398,8 @@ pushd $RPM_BUILD_ROOT%{goroot} find pkg/*_dynlink/ ! -type d -printf '%{goroot}/%p\n' >> $shared_list %endif +echo "== 5 ==" + %if %{race} find pkg/*_race/ -type d -printf '%%%dir %{goroot}/%p\n' >> $race_list @@ -411,7 +415,7 @@ pushd $RPM_BUILD_ROOT%{goroot} find lib/ -type d -printf '%%%dir %{goroot}/%p\n' >> $tests_list find lib/ ! -type d -printf '%{goroot}/%p\n' >> $tests_list popd - +echo "== 6 ==" # remove the doc Makefile rm -rfv $RPM_BUILD_ROOT%{goroot}/doc/Makefile @@ -426,7 +430,7 @@ mkdir -p $RPM_BUILD_ROOT%{gopath}/src/github.com mkdir -p $RPM_BUILD_ROOT%{gopath}/src/bitbucket.org mkdir -p $RPM_BUILD_ROOT%{gopath}/src/code.google.com/p mkdir -p $RPM_BUILD_ROOT%{gopath}/src/golang.org/x - +echo "== 7 ==" # make sure these files exist and point to alternatives rm -f $RPM_BUILD_ROOT%{_bindir}/go ln -sf /etc/alternatives/go $RPM_BUILD_ROOT%{_bindir}/go @@ -437,6 +441,8 @@ ln -sf /etc/alternatives/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d cp -av %{SOURCE100} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d/golang.gdb +echo "== END OF INSTALL ==" + %check export GOROOT=$(pwd -P) export PATH="$GOROOT"/bin:"$PATH" @@ -491,8 +497,6 @@ fi %dir %{goroot} %{goroot}/api/ %{goroot}/lib/time/ -%{goroot}/favicon.ico -%{goroot}/robots.txt # ensure directory ownership, so they are cleaned up if empty %dir %{gopath} @@ -531,6 +535,11 @@ fi %endif %changelog +* Mon Aug 09 2021 Alejandro Sáez - 1.17-0.rc2 +- Update to go1.17rc2 +- Update patches +- Remove patch, already in the source https://go-review.googlesource.com/c/go/+/334410/ + * Thu Jul 29 2021 Jakub Čajka - 1.16.6-3 - fix crash in VDSO calls on ppc64le with new kernels diff --git a/ppc64le-vdso-fix.patch b/ppc64le-vdso-fix.patch deleted file mode 100644 index 0d9fe6f..0000000 --- a/ppc64le-vdso-fix.patch +++ /dev/null @@ -1,227 +0,0 @@ -From 7cb7ce3cfae172ff7b128592c3ca9ac591b0f7cb Mon Sep 17 00:00:00 2001 -From: Derek Parker -Date: Thu, 17 Jun 2021 20:22:40 +0000 -Subject: [PATCH] [release-branch.go1.16] runtime: fix crash during VDSO calls on PowerPC - -This patch reinstates a fix for PowerPC with regard to making VDSO calls -while receiving a signal, and subsequently crashing. The crash happens -because certain VDSO calls can modify the r30 register, which is where g -is stored. This change was reverted for PowerPC because r30 is supposed -to be a non-volatile register. This is true, but that only makes a -guarantee across function calls, but not "within" a function call. This -patch was seemingly fine before because the Linux kernel still had hand -rolled assembly VDSO function calls, however with a recent change to C -function calls it seems the compiler used can generate instructions -which temporarily clobber r30. This means that when we receive a signal -during one of these calls the value of r30 will not be the g as the -runtime expects, causing a segfault. - -You can see from this assembly dump how the register is clobbered during -the call: - -(the following is from a 5.13rc2 kernel) - -``` -Dump of assembler code for function __cvdso_clock_gettime_data: - 0x00007ffff7ff0700 <+0>: cmplwi r4,15 - 0x00007ffff7ff0704 <+4>: bgt 0x7ffff7ff07f0 <__cvdso_clock_gettime_data+240> - 0x00007ffff7ff0708 <+8>: li r9,1 - 0x00007ffff7ff070c <+12>: slw r9,r9,r4 - 0x00007ffff7ff0710 <+16>: andi. r10,r9,2179 - 0x00007ffff7ff0714 <+20>: beq 0x7ffff7ff0810 <__cvdso_clock_gettime_data+272> - 0x00007ffff7ff0718 <+24>: rldicr r10,r4,4,59 - 0x00007ffff7ff071c <+28>: lis r9,32767 - 0x00007ffff7ff0720 <+32>: std r30,-16(r1) - 0x00007ffff7ff0724 <+36>: std r31,-8(r1) - 0x00007ffff7ff0728 <+40>: add r6,r3,r10 - 0x00007ffff7ff072c <+44>: ori r4,r9,65535 - 0x00007ffff7ff0730 <+48>: lwz r8,0(r3) - 0x00007ffff7ff0734 <+52>: andi. r9,r8,1 - 0x00007ffff7ff0738 <+56>: bne 0x7ffff7ff07d0 <__cvdso_clock_gettime_data+208> - 0x00007ffff7ff073c <+60>: lwsync - 0x00007ffff7ff0740 <+64>: mftb r30 <---- RIGHT HERE -=> 0x00007ffff7ff0744 <+68>: ld r12,40(r6) -``` - -What I believe is happening is that the kernel changed the PowerPC VDSO -calls to use standard C calls instead of using hand rolled assembly. The -hand rolled assembly calls never touched r30, so this change was safe to -roll back. That does not seem to be the case anymore as on the 5.13rc2 -kernel the compiler *is* generating assembly which modifies r30, making -this change again unsafe and causing a crash when the program receives a -signal during these calls (which will happen often due to async -preempt). This change happened here: -https://lwn.net/ml/linux-kernel/235e5571959cfa89ced081d7e838ed5ff38447d2.1601365870.git.christophe.leroy@csgroup.eu/. - -I realize this was reverted due to unexplained hangs in PowerPC -builders, but I think we should reinstate this change and investigate -those issues separately: -https://github.com/golang/go/commit/f4ca3c1e0a2066ca4f7bd6203866d282ed34acf2 - -Fixes #46858 - -Change-Id: Ib18d7bbfc80a1a9cb558f0098878d41081324b52 -GitHub-Last-Rev: c3002bcfca3ef58b27485e31328e6297b7a9dfe7 -GitHub-Pull-Request: golang/go#46767 -Reviewed-on: https://go-review.googlesource.com/c/go/+/328110 -Run-TryBot: Lynn Boger -TryBot-Result: Go Bot -Reviewed-by: Cherry Mui -Trust: Lynn Boger -(cherry picked from commit 16e82be454cbf41299e6a055d54d489ca4612ee0) ---- - -diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go -index 3f70707..89f936e 100644 ---- a/src/runtime/signal_unix.go -+++ b/src/runtime/signal_unix.go -@@ -381,7 +381,7 @@ - //go:nosplit - func sigFetchG(c *sigctxt) *g { - switch GOARCH { -- case "arm", "arm64": -+ case "arm", "arm64", "ppc64", "ppc64le": - if !iscgo && inVDSOPage(c.sigpc()) { - // When using cgo, we save the g on TLS and load it from there - // in sigtramp. Just use that. -diff --git a/src/runtime/sys_linux_ppc64x.s b/src/runtime/sys_linux_ppc64x.s -index fd69ee7..7be8c4c 100644 ---- a/src/runtime/sys_linux_ppc64x.s -+++ b/src/runtime/sys_linux_ppc64x.s -@@ -215,15 +215,45 @@ - MOVD (g_sched+gobuf_sp)(R7), R1 // Set SP to g0 stack - - noswitch: -- SUB $16, R1 // Space for results -- RLDICR $0, R1, $59, R1 // Align for C code -+ SUB $16, R1 // Space for results -+ RLDICR $0, R1, $59, R1 // Align for C code - MOVD R12, CTR - MOVD R1, R4 -- BL (CTR) // Call from VDSO -- MOVD $0, R0 // Restore R0 -- MOVD 0(R1), R3 // sec -- MOVD 8(R1), R5 // nsec -- MOVD R15, R1 // Restore SP -+ -+ // Store g on gsignal's stack, so if we receive a signal -+ // during VDSO code we can find the g. -+ // If we don't have a signal stack, we won't receive signal, -+ // so don't bother saving g. -+ // When using cgo, we already saved g on TLS, also don't save -+ // g here. -+ // Also don't save g if we are already on the signal stack. -+ // We won't get a nested signal. -+ MOVBZ runtime·iscgo(SB), R22 -+ CMP R22, $0 -+ BNE nosaveg -+ MOVD m_gsignal(R21), R22 // g.m.gsignal -+ CMP R22, $0 -+ BEQ nosaveg -+ -+ CMP g, R22 -+ BEQ nosaveg -+ MOVD (g_stack+stack_lo)(R22), R22 // g.m.gsignal.stack.lo -+ MOVD g, (R22) -+ -+ BL (CTR) // Call from VDSO -+ -+ MOVD $0, (R22) // clear g slot, R22 is unchanged by C code -+ -+ JMP finish -+ -+nosaveg: -+ BL (CTR) // Call from VDSO -+ -+finish: -+ MOVD $0, R0 // Restore R0 -+ MOVD 0(R1), R3 // sec -+ MOVD 8(R1), R5 // nsec -+ MOVD R15, R1 // Restore SP - - // Restore vdsoPC, vdsoSP - // We don't worry about being signaled between the two stores. -@@ -235,7 +265,7 @@ - MOVD 32(R1), R6 - MOVD R6, m_vdsoPC(R21) - --finish: -+return: - MOVD R3, sec+0(FP) - MOVW R5, nsec+8(FP) - RET -@@ -246,7 +276,7 @@ - SYSCALL $SYS_clock_gettime - MOVD 32(R1), R3 - MOVD 40(R1), R5 -- JMP finish -+ JMP return - - TEXT runtime·nanotime1(SB),NOSPLIT,$16-8 - MOVD $1, R3 // CLOCK_MONOTONIC -@@ -282,7 +312,37 @@ - RLDICR $0, R1, $59, R1 // Align for C code - MOVD R12, CTR - MOVD R1, R4 -- BL (CTR) // Call from VDSO -+ -+ // Store g on gsignal's stack, so if we receive a signal -+ // during VDSO code we can find the g. -+ // If we don't have a signal stack, we won't receive signal, -+ // so don't bother saving g. -+ // When using cgo, we already saved g on TLS, also don't save -+ // g here. -+ // Also don't save g if we are already on the signal stack. -+ // We won't get a nested signal. -+ MOVBZ runtime·iscgo(SB), R22 -+ CMP R22, $0 -+ BNE nosaveg -+ MOVD m_gsignal(R21), R22 // g.m.gsignal -+ CMP R22, $0 -+ BEQ nosaveg -+ -+ CMP g, R22 -+ BEQ nosaveg -+ MOVD (g_stack+stack_lo)(R22), R22 // g.m.gsignal.stack.lo -+ MOVD g, (R22) -+ -+ BL (CTR) // Call from VDSO -+ -+ MOVD $0, (R22) // clear g slot, R22 is unchanged by C code -+ -+ JMP finish -+ -+nosaveg: -+ BL (CTR) // Call from VDSO -+ -+finish: - MOVD $0, R0 // Restore R0 - MOVD 0(R1), R3 // sec - MOVD 8(R1), R5 // nsec -@@ -298,7 +358,7 @@ - MOVD 32(R1), R6 - MOVD R6, m_vdsoPC(R21) - --finish: -+return: - // sec is in R3, nsec in R5 - // return nsec in R3 - MOVD $1000000000, R4 -@@ -313,7 +373,7 @@ - SYSCALL $SYS_clock_gettime - MOVD 32(R1), R3 - MOVD 40(R1), R5 -- JMP finish -+ JMP return - - TEXT runtime·rtsigprocmask(SB),NOSPLIT|NOFRAME,$0-28 - MOVW how+0(FP), R3 -@@ -366,7 +426,7 @@ - // this might be called in external code context, - // where g is not set. - MOVBZ runtime·iscgo(SB), R6 -- CMP R6, $0 -+ CMP R6, $0 - BEQ 2(PC) - BL runtime·load_g(SB) - diff --git a/sources b/sources index d551505..bdb678c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (go1.16.6.src.tar.gz) = 82634763dce636c9e9cba1bbf74a669e8b88e6df095e80672f295edb82cc1fc4b8ffde91a1f56c3470f2c4d9ee0404f65146d7478b645890623f6c463513a61f +SHA512 (go1.17rc2.src.tar.gz) = d1f9e687011acee30232c30e75c66cb920f314db02bf1f0c90e360095f0fb089d2adb346acaac1a22b7e114efa6d880b721e461edc67ccb79bedf15eff619de8