Merge branch 'master' into el6

Rebase to 1.9.2 from f27/f28
This commit is contained in:
Jakub Čajka 2017-11-27 14:41:01 +01:00
commit 40390077fd
12 changed files with 460 additions and 101 deletions

18
.gitignore vendored
View File

@ -24,7 +24,25 @@
/go1.5rc1.src.tar.gz
/go1.5.src.tar.gz
/go1.5.1.src.tar.gz
/go1.5.2.src.tar.gz
/Mark.Twain-Tom.Sawyer.txt.bz2
/go1.5.3.src.tar.gz
/go1.6rc1.src.tar.gz
/go1.6.src.tar.gz
/go1.6.1.src.tar.gz
/go1.6.2.src.tar.gz
/go1.7rc2.src.tar.gz
/go1.7rc5.src.tar.gz
/go1.7.src.tar.gz
/go1.7.1.src.tar.gz
/go1.7.3.src.tar.gz
/go1.7.4.src.tar.gz
/go1.7.6.src.tar.gz
/go1.8rc3.src.tar.gz
/go1.8.src.tar.gz
/go1.8.1.src.tar.gz
/go1.8.3.src.tar.gz
/go1.9beta2.src.tar.gz
/go1.9.src.tar.gz
/go1.9.1.src.tar.gz
/go1.9.2.src.tar.gz

83
31bit-OID-asn1.patch Normal file
View File

@ -0,0 +1,83 @@
From 94aba76639cf4d5e30975d846bb0368db8202269 Mon Sep 17 00:00:00 2001
From: Monis Khan <mkhan@redhat.com>
Date: Wed, 12 Apr 2017 16:00:58 -0400
Subject: [PATCH] encoding/asn1: support 31 bit identifiers with OID
The current implementation uses a max of 28 bits when decoding an
ObjectIdentifier. This change makes it so that an int64 is used to
accumulate up to 35 bits. If the resulting data would not overflow
an int32, it is used as an int. Thus up to 31 bits may be used to
represent each subidentifier of an ObjectIdentifier.
Fixes #19933
Change-Id: I95d74b64b24cdb1339ff13421055bce61c80243c
Reviewed-on: https://go-review.googlesource.com/40436
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
---
src/encoding/asn1/asn1.go | 15 ++++++++++++---
src/encoding/asn1/asn1_test.go | 3 +++
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/encoding/asn1/asn1.go b/src/encoding/asn1/asn1.go
index c2c0ee420ac..65f018d0148 100644
--- a/src/encoding/asn1/asn1.go
+++ b/src/encoding/asn1/asn1.go
@@ -22,6 +22,7 @@ package asn1
import (
"errors"
"fmt"
+ "math"
"math/big"
"reflect"
"strconv"
@@ -293,16 +294,24 @@ type Flag bool
// given byte slice. It returns the value and the new offset.
func parseBase128Int(bytes []byte, initOffset int) (ret, offset int, err error) {
offset = initOffset
+ var ret64 int64
for shifted := 0; offset < len(bytes); shifted++ {
- if shifted == 4 {
+ // 5 * 7 bits per byte == 35 bits of data
+ // Thus the representation is either non-minimal or too large for an int32
+ if shifted == 5 {
err = StructuralError{"base 128 integer too large"}
return
}
- ret <<= 7
+ ret64 <<= 7
b := bytes[offset]
- ret |= int(b & 0x7f)
+ ret64 |= int64(b & 0x7f)
offset++
if b&0x80 == 0 {
+ ret = int(ret64)
+ // Ensure that the returned value fits in an int on all platforms
+ if ret64 > math.MaxInt32 {
+ err = StructuralError{"base 128 integer too large"}
+ }
return
}
}
diff --git a/src/encoding/asn1/asn1_test.go b/src/encoding/asn1/asn1_test.go
index 9976656df89..2dd799f2362 100644
--- a/src/encoding/asn1/asn1_test.go
+++ b/src/encoding/asn1/asn1_test.go
@@ -7,6 +7,7 @@ package asn1
import (
"bytes"
"fmt"
+ "math"
"math/big"
"reflect"
"strings"
@@ -386,6 +387,8 @@ var tagAndLengthData = []tagAndLengthTest{
{[]byte{0xa0, 0x81, 0x7f}, false, tagAndLength{}},
// Tag numbers which would overflow int32 are rejected. (The value below is 2^31.)
{[]byte{0x1f, 0x88, 0x80, 0x80, 0x80, 0x00, 0x00}, false, tagAndLength{}},
+ // Tag numbers that fit in an int32 are valid. (The value below is 2^31 - 1.)
+ {[]byte{0x1f, 0x87, 0xFF, 0xFF, 0xFF, 0x7F, 0x00}, true, tagAndLength{tag: math.MaxInt32}},
// Long tag number form may not be used for tags that fit in short form.
{[]byte{0x1f, 0x1e, 0x00}, false, tagAndLength{}},
}

7
fedora.go Normal file
View File

@ -0,0 +1,7 @@
// +build rpm_crashtraceback
package runtime
func init() {
setTraceback("crash")
}

View File

@ -1,13 +0,0 @@
diff --git a/src/syscall/exec_linux_test.go b/src/syscall/exec_linux_test.go
index 60d2734..b16540f 100644
--- a/src/syscall/exec_linux_test.go
+++ b/src/syscall/exec_linux_test.go
@@ -89,7 +89,7 @@ func kernelVersion(t *testing.T) (int, int) {
return major, minor
}
-func TestCloneNEWUSERAndRemapNoRootDisableSetgroups(t *testing.T) {
+func testCloneNEWUSERAndRemapNoRootDisableSetgroups(t *testing.T) {
if os.Getuid() == 0 {
t.Skip("skipping unprivileged user only test")
}

View File

@ -1,8 +1,7 @@
Index: go/src/make.bash
===================================================================
--- go.orig/src/make.bash
+++ go/src/make.bash
@@ -153,12 +153,12 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then
diff -up go/src/make.bash.verbose go/src/make.bash
--- go/src/make.bash.verbose 2017-07-11 12:00:09.513553508 +0200
+++ go/src/make.bash 2017-07-11 12:01:25.288245720 +0200
@@ -167,7 +167,7 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOH
# CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however,
# use the host compiler, CC, from `cmd/dist/dist env` instead.
CC=$CC GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH \
@ -11,9 +10,12 @@ Index: go/src/make.bash
echo
fi
echo "##### Building packages and commands for $GOOS/$GOARCH."
@@ -175,7 +175,7 @@ echo "##### Building packages and comman
old_bin_files=$(cd $GOROOT/bin && echo *)
-CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
+CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v -x std cmd
echo
rm -f "$GOTOOLDIR"/go_bootstrap
# Check that there are no new files in $GOROOT/bin other than go and gofmt
# and $GOOS_$GOARCH (a directory used when cross-compiling).

View File

@ -1,35 +1,38 @@
diff -up go/src/cmd/dist/buildtool.go.bootstrap go/src/cmd/dist/buildtool.go
--- go/src/cmd/dist/buildtool.go.bootstrap 2016-06-06 14:26:37.638374670 +0200
+++ go/src/cmd/dist/buildtool.go 2016-06-06 14:30:33.873262307 +0200
@@ -111,15 +111,23 @@ func bootstrapBuildTools() {
--- go/src/cmd/dist/buildtool.go.bootstrap 2017-07-11 12:05:00.041373419 +0200
+++ go/src/cmd/dist/buildtool.go 2017-07-11 12:07:27.141775914 +0200
@@ -153,18 +153,26 @@ func bootstrapBuildTools() {
defer os.Setenv("GOBIN", os.Getenv("GOBIN"))
os.Setenv("GOBIN", "")
+ hostos := os.Getenv("GOHOSTOS")
+ hostarch := os.Getenv("GOHOSTARCH")
+ hostos := os.Getenv("GOHOSTOS")
+ hostarch := os.Getenv("GOHOSTARCH")
+
os.Setenv("GOOS", "")
os.Setenv("GOHOSTOS", "")
os.Setenv("GOARCH", "")
os.Setenv("GOHOSTARCH", "")
+ bingopath := pathf("%s/bin/%s_%s/go", goroot_bootstrap, hostos, hostarch)
+ if _, err := os.Stat(bingopath); os.IsNotExist(err) {
+ bingopath = pathf("%s/bin/go", goroot_bootstrap)
+ }
+ bingopath := pathf("%s/bin/%s_%s/go", goroot_bootstrap, hostos, hostarch)
+ if _, err := os.Stat(bingopath); os.IsNotExist(err) {
+ bingopath = pathf("%s/bin/go", goroot_bootstrap)
+ }
+
// Run Go 1.4 to build binaries. Use -gcflags=-l to disable inlining to
// workaround bugs in Go 1.4's compiler. See discussion thread:
// https://groups.google.com/d/msg/golang-dev/Ss7mCKsvk8w/Gsq7VYI0AwAJ
- run(workspace, ShowOutput|CheckExit, pathf("%s/bin/go", goroot_bootstrap), "install", "-gcflags=-l", "-v", "bootstrap/...")
+ run(workspace, ShowOutput|CheckExit, bingopath, "install", "-gcflags=-l", "-v", "bootstrap/...")
// Copy binaries into tool binary directory.
for _, name := range bootstrapDirs {
// Use the math_big_pure_go build tag to disable the assembly in math/big
// which may contain unsupported instructions.
cmd := []string{
- pathf("%s/bin/go", goroot_bootstrap),
+ bingopath,
"install",
"-gcflags=-l",
"-tags=math_big_pure_go",
diff -up go/src/make.bash.bootstrap go/src/make.bash
--- go/src/make.bash.bootstrap 2016-06-06 14:26:37.628374633 +0200
+++ go/src/make.bash 2016-06-06 14:26:37.638374670 +0200
@@ -118,8 +118,15 @@ echo '##### Building Go bootstrap tool.'
--- go/src/make.bash.bootstrap 2017-07-11 12:05:00.036373439 +0200
+++ go/src/make.bash 2017-07-11 12:05:00.041373419 +0200
@@ -120,8 +120,15 @@ echo '##### Building Go bootstrap tool.'
echo cmd/dist
export GOROOT="$(cd .. && pwd)"
GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4}
@ -47,7 +50,7 @@ diff -up go/src/make.bash.bootstrap go/src/make.bash
echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
exit 1
fi
@@ -128,8 +135,6 @@ if [ "$GOROOT_BOOTSTRAP" == "$GOROOT" ];
@@ -130,8 +137,6 @@ if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ];
echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
exit 1
fi

View File

@ -1,3 +1,6 @@
%bcond_with bootstrap
%bcond_with ignore_tests
# build ids are not currently generated:
# https://code.google.com/p/go/issues/detail?id=5238
#
@ -25,11 +28,56 @@
# allow turning this off
%{!?build_xemacs:%global build_xemacs 1}
# let this match the macros in macros.golang
# Golang build options.
# Build golang using external/internal(close to cgo disabled) linking.
%ifarch %{ix86} x86_64 ppc64le %{arm} aarch64 s390x
%global external_linker 1
%else
%global external_linker 0
%endif
# Build golang with cgo enabled/disabled(later equals more or less to internal linking).
%ifarch %{ix86} x86_64 ppc64le %{arm} aarch64 s390x
%global cgo_enabled 1
%else
%global cgo_enabled 0
%endif
# Use golang/gcc-go as bootstrap compiler
%if %{with bootstrap}
%global golang_bootstrap 0
%else
%global golang_bootstrap 1
%endif
# Controls what ever we fail on failed tests
%if %{with ignore_tests}
%global fail_on_tests 0
%else
%global fail_on_tests 1
%endif
# Build golang shared objects for stdlib
%ifarch %{ix86} x86_64 ppc64le %{arm} aarch64
%global shared 1
%else
%global shared 0
%endif
# Pre build std lib with -race enabled
%ifarch x86_64
%global race 1
%else
%global race 0
%endif
# Fedora GOROOT
%global goroot /usr/lib/%{name}
%global gopath %{_datadir}/gocode
%global go_arches %{ix86} x86_64 %{arm} aarch64
%global golibdir %{_libdir}/golang
%ifarch x86_64
%global gohostarch amd64
%endif
@ -43,20 +91,26 @@
%global gohostarch arm64
%endif
%global go_api 1.7
%global go_version 1.7.6
%global go_api 1.9
%global go_version 1.9.2
Name: golang
Version: 1.7.6
Release: 2%{?dist}
Version: 1.9.2
Release: 1%{?dist}
Summary: The Go Programming Language
# source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain
License: BSD and Public Domain
URL: http://golang.org/
Source0: https://storage.googleapis.com/golang/go%{go_version}.src.tar.gz
# make possible to override default traceback level at build time by setting build tag rpm_crashtraceback
Source1: fedora.go
# go1.5 bootstrapping. The compiler is written in golang.
# The compiler is written in Go. Needs go(1.4+) compiler for build.
%if !%{golang_bootstrap}
BuildRequires: gcc-go >= 5
%else
BuildRequires: golang > 1.4
%endif
BuildRequires: pcre-devel, glibc-static, perl
%if 0%{?rhel} > 6 || 0%{?fedora} > 0
BuildRequires: hostname
@ -74,22 +128,19 @@ Patch0: golang-1.2-verbose-build.patch
# use the arch dependent path in the bootstrap
Patch212: golang-1.5-bootstrap-binary-path.patch
# disable TestGdbPython
# https://github.com/golang/go/issues/11214
Patch213: go1.5beta1-disable-TestGdbPython.patch
# we had been just removing the zoneinfo.zip, but that caused tests to fail for users that
# later run `go test -a std`. This makes it only use the zoneinfo.zip where needed in tests.
Patch215: ./go1.5-zoneinfo_testing_only.patch
#PPC64X relocation overflow fix
Patch216: ppc64x-overflow-1.patch
Patch217: ppc64x-overflow-2.patch
# Proposed patch by mmunday https://golang.org/cl/35262
Patch219: s390x-expose-IfInfomsg-X__ifi_pad.patch
Patch218: tzdata-fix.patch
Patch220: s390x-ignore-L0syms.patch
Patch219: CVE-2017-15041.patch
Patch220: CVE-2017-15042.patch
# https://github.com/golang/go/commit/ca8c361d867d62bd46013c5abbaaad0b2ca6077f
Patch221: use-buildmode-pie-for-pie-testing.patch
# https://github.com/hyangah/go/commit/3502496d03bcd842fd7aac95ec0d7096d581cd26
Patch222: use-no-pie-where-needed.patch
# Having documentation separate was broken
Obsoletes: %{name}-docs < 1.1-4
@ -193,7 +244,7 @@ for _,d in pairs({"api", "doc", "include", "lib", "src"}) do
end
end
%ifarch x86_64
%if %{shared}
%package shared
Summary: Golang shared object libraries
@ -201,6 +252,16 @@ Summary: Golang shared object libraries
%{summary}.
%endif
%if %{race}
%package race
Summary: Golang std library with -race enabled
Requires: %{name} = %{version}-%{release}
%description race
%{summary}
%endif
%prep
%setup -q -n go
@ -210,55 +271,62 @@ Summary: Golang shared object libraries
# use the arch dependent path in the bootstrap
%patch212 -p1 -b .bootstrap
# disable TestGdbPython
%patch213 -p1 -b .gdb
%patch215 -p1
%patch216 -p1
%patch217 -p1
%patch218 -p1
%patch219 -p1
%patch220 -p1
%patch221 -p1 -b pie
%patch222 -p1
cp %{SOURCE1} ./src/runtime/
%build
# print out system information
uname -a
cat /proc/cpuinfo
cat /proc/meminfo
# go1.5 bootstrapping. The compiler is written in golang.
# bootstrap compiler GOROOT
%if !%{golang_bootstrap}
export GOROOT_BOOTSTRAP=/
%else
export GOROOT_BOOTSTRAP=%{goroot}
%endif
# set up final install location
export GOROOT_FINAL=%{goroot}
# TODO use the system linker to get the system link flags and build-id
# when https://code.google.com/p/go/issues/detail?id=5221 is solved
#export GO_LDFLAGS="-linkmode external -extldflags $RPM_LD_FLAGS"
export GOHOSTOS=linux
export GOHOSTARCH=%{gohostarch}
pushd src
# use our gcc options for this build, but store gcc as default for compiler
CFLAGS="$RPM_OPT_FLAGS" \
LDFLAGS="$RPM_LD_FLAGS" \
CC="gcc" \
CC_FOR_TARGET="gcc" \
GOOS=linux \
GOARCH=%{gohostarch} \
./make.bash --no-clean
export CFLAGS="$RPM_OPT_FLAGS"
export LDFLAGS="$RPM_LD_FLAGS"
export CC="gcc"
export CC_FOR_TARGET="gcc"
export GOOS=linux
export GOARCH=%{gohostarch}
%if !%{external_linker}
export GO_LDFLAGS="-linkmode internal"
%endif
%if !%{cgo_enabled}
export CGO_ENABLED=0
%endif
./make.bash --no-clean
popd
%ifarch x86_64
# TODO get linux/386 support for shared objects.
# golang shared objects for stdlib
# build shared std lib
%if %{shared}
GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -buildmode=shared std
%endif
%if %{race}
GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -race std
%endif
%install
rm -rf $RPM_BUILD_ROOT
@ -281,25 +349,26 @@ cwd=$(pwd)
src_list=$cwd/go-src.list
pkg_list=$cwd/go-pkg.list
shared_list=$cwd/go-shared.list
race_list=$cwd/go-race.list
misc_list=$cwd/go-misc.list
docs_list=$cwd/go-docs.list
tests_list=$cwd/go-tests.list
rm -f $src_list $pkg_list $docs_list $misc_list $tests_list $shared_list
touch $src_list $pkg_list $docs_list $misc_list $tests_list $shared_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}
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
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
find bin/ pkg/ -type d -a ! -path '*_dynlink/*' -printf '%%%dir %{goroot}/%p\n' >> $pkg_list
find bin/ pkg/ ! -type d -a ! -path '*_dynlink/*' -printf '%{goroot}/%p\n' >> $pkg_list
find bin/ pkg/ -type d -a ! -path '*_dynlink/*' -a ! -path '*_race/*' -printf '%%%dir %{goroot}/%p\n' >> $pkg_list
find bin/ pkg/ ! -type d -a ! -path '*_dynlink/*' -a ! -path '*_race/*' -printf '%{goroot}/%p\n' >> $pkg_list
find doc/ -type d -printf '%%%dir %{goroot}/%p\n' >> $docs_list
find doc/ ! -type d -printf '%{goroot}/%p\n' >> $docs_list
find doc/ -type d -printf '%%%dir %{goroot}/%p\n' >> $docs_list
find doc/ ! -type d -printf '%{goroot}/%p\n' >> $docs_list
find misc/ -type d -printf '%%%dir %{goroot}/%p\n' >> $misc_list
find misc/ ! -type d -printf '%{goroot}/%p\n' >> $misc_list
find misc/ -type d -printf '%%%dir %{goroot}/%p\n' >> $misc_list
find misc/ ! -type d -printf '%{goroot}/%p\n' >> $misc_list
%ifarch x86_64
%if %{shared}
mkdir -p %{buildroot}/%{_libdir}/
mkdir -p %{buildroot}/%{golibdir}/
for file in $(find . -iname "*.so" ); do
@ -316,13 +385,20 @@ pushd $RPM_BUILD_ROOT%{goroot}
find pkg/*_dynlink/ ! -type d -printf '%{goroot}/%p\n' >> $shared_list
%endif
find test/ -type d -printf '%%%dir %{goroot}/%p\n' >> $tests_list
find test/ ! -type d -printf '%{goroot}/%p\n' >> $tests_list
find src/ -type d -a \( -name testdata -o -ipath '*/testdata/*' \) -printf '%%%dir %{goroot}/%p\n' >> $tests_list
find src/ ! -type d -a \( -ipath '*/testdata/*' -o -name '*_test*.go' \) -printf '%{goroot}/%p\n' >> $tests_list
# this is only the zoneinfo.zip
find lib/ -type d -printf '%%%dir %{goroot}/%p\n' >> $tests_list
find lib/ ! -type d -printf '%{goroot}/%p\n' >> $tests_list
%if %{race}
find pkg/*_race/ -type d -printf '%%%dir %{goroot}/%p\n' >> $race_list
find pkg/*_race/ ! -type d -printf '%{goroot}/%p\n' >> $race_list
%endif
find test/ -type d -printf '%%%dir %{goroot}/%p\n' >> $tests_list
find test/ ! -type d -printf '%{goroot}/%p\n' >> $tests_list
find src/ -type d -a \( -name testdata -o -ipath '*/testdata/*' \) -printf '%%%dir %{goroot}/%p\n' >> $tests_list
find src/ ! -type d -a \( -ipath '*/testdata/*' -o -name '*_test.go' \) -printf '%{goroot}/%p\n' >> $tests_list
# this is only the zoneinfo.zip
find lib/ -type d -printf '%%%dir %{goroot}/%p\n' >> $tests_list
find lib/ ! -type d -printf '%{goroot}/%p\n' >> $tests_list
popd
# remove the doc Makefile
@ -373,22 +449,32 @@ cd src
export CC="gcc"
export CFLAGS="$RPM_OPT_FLAGS"
export LDFLAGS="$RPM_LD_FLAGS"
%if !%{external_linker}
export GO_LDFLAGS="-linkmode internal"
%endif
%if !%{cgo_enabled} || !%{external_linker}
export CGO_ENABLED=0
%endif
# make sure to not timeout
export GO_TEST_TIMEOUT_SCALE=2
%if %{fail_on_tests}
./run.bash --no-rebuild -v -v -v -k
%else
./run.bash --no-rebuild -v -v -v -k || :
%endif
cd ..
%post bin
%{_sbindir}/update-alternatives --install %{_bindir}/go \
go %{goroot}/bin/go 90 \
--slave %{_bindir}/gofmt gofmt %{goroot}/bin/gofmt
go %{goroot}/bin/go 90 \
--slave %{_bindir}/gofmt gofmt %{goroot}/bin/gofmt
%preun bin
if [ $1 = 0 ]; then
%{_sbindir}/update-alternatives --remove go %{goroot}/bin/go
%{_sbindir}/update-alternatives --remove go %{goroot}/bin/go
fi
@ -406,6 +492,7 @@ fi
%exclude %{goroot}/src/
%exclude %{goroot}/doc/
%exclude %{goroot}/misc/
%exclude %{goroot}/test/
%{goroot}/*
# ensure directory ownership, so they are cleaned up if empty
@ -449,6 +536,10 @@ fi
%endif
%changelog
* Mon Nov 27 2017 Jakub Čajka <jcajka@fedoraproject.org> - 1.9.2-1
- rebase to 1.9.2
- Resolves: BZ#1507936
* Fri Oct 13 2017 Jakub Čajka <jcajka@fedoraproject.org> - 1.7.4-2
- fix CVE-2017-15041 and CVE-2017-15042

View File

@ -0,0 +1,36 @@
From 84b8c9ceaa5257f7ff4ab059ff208246ecdfe9d9 Mon Sep 17 00:00:00 2001
From: Michael Munday <munday@ca.ibm.com>
Date: Tue, 17 Jan 2017 11:33:38 -0500
Subject: [PATCH] syscall: expose IfInfomsg.X__ifi_pad on s390x
Exposing this field on s390x improves compatibility with the other
linux architectures, all of which already expose it.
Fixes #18628 and updates #18632.
Change-Id: I08e8e1eb705f898cd8822f8bee0d61ce11d514b5
---
diff --git a/src/syscall/ztypes_linux_s390x.go b/src/syscall/ztypes_linux_s390x.go
index 63c4a83..b589425 100644
--- a/src/syscall/ztypes_linux_s390x.go
+++ b/src/syscall/ztypes_linux_s390x.go
@@ -449,12 +449,12 @@
}
type IfInfomsg struct {
- Family uint8
- _ uint8
- Type uint16
- Index int32
- Flags uint32
- Change uint32
+ Family uint8
+ X__ifi_pad uint8
+ Type uint16
+ Index int32
+ Flags uint32
+ Change uint32
}
type IfAddrmsg struct {

18
s390x-ignore-L0syms.patch Normal file
View File

@ -0,0 +1,18 @@
diff --git a/src/cmd/link/internal/ld/ldelf.go b/src/cmd/link/internal/ld/ldelf.go
index d4f9fc4..87dabaa 100644
--- a/src/cmd/link/internal/ld/ldelf.go
+++ b/src/cmd/link/internal/ld/ldelf.go
@@ -799,6 +799,13 @@ func ldelf(ctxt *Link, f *bio.Reader, pkg string, length int64, pn string) {
continue
}
+ if sect.name == ".debug_str" && sym.name == "L0" && sym.type_ == 0 {
+ // introduced by https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=49fced1206db40c71208c201165d65f92c69cebe on s390x
+ // TODO investigate from where they are actually coming from, could be possible issue with elf parsing as seeing 0x1 in name is weird
+ // See issue https://github.com/golang/go/issues/20996
+ continue
+ }
+
if strings.HasPrefix(sym.name, ".LASF") { // gcc on s390x does this
continue
}

View File

@ -1 +1 @@
SHA512 (go1.7.6.src.tar.gz) = b01846bfb17bf91a9c493c4d6c43bbe7e17270b9e8a229a2be4032b78ef9395f5512917ea9faab74a120c755bbd53bbd816b033caadcbb7679e91702b37f8c7f
SHA512 (go1.9.2.src.tar.gz) = 1034098575c317eeaf648629690a4dea0c479a69c3b80d9917f6b96c8781ce79c0f29859f667dc4e07d47a44972aa09bd0163a458f897cf45f9d09eb03e4abb5

View File

@ -0,0 +1,51 @@
diff -up go/src/cmd/dist/test.go.pie go/src/cmd/dist/test.go
--- go/src/cmd/dist/test.go.pie 2017-10-25 20:30:21.000000000 +0200
+++ go/src/cmd/dist/test.go 2017-11-03 16:47:55.290829798 +0100
@@ -852,6 +852,16 @@ func (t *tester) supportedBuildmode(mode
return true
}
return false
+ case "pie":
+ switch pair {
+ case "linux-386", "linux-amd64", "linux-arm", "linux-arm64", "linux-ppc64le", "linux-s390x",
+ "android-amd64", "android-arm", "android-arm64", "android-386":
+ return true
+ case "darwin-amd64":
+ return true
+ }
+ return false
+
default:
log.Fatalf("internal error: unknown buildmode %s", mode)
return false
@@ -953,24 +963,16 @@ func (t *tester) cgoTest(dt *distTest) e
}
}
- if pair != "freebsd-amd64" { // clang -pie fails to link misc/cgo/test
- cmd := t.dirCmd("misc/cgo/test",
- cc, "-xc", "-o", "/dev/null", "-pie", "-")
+ if t.supportedBuildmode("pie") {
+ cmd = t.addCmd(dt, "misc/cgo/test", "go", "test", "-buildmode=pie")
cmd.Env = env
- cmd.Stdin = strings.NewReader("int main() {}")
- if err := cmd.Run(); err != nil {
- fmt.Println("No support for -pie found, skip cgo PIE test.")
- } else {
- cmd = t.addCmd(dt, "misc/cgo/test", "go", "test", "-ldflags", `-linkmode=external -extldflags "-pie"`)
- cmd.Env = env
- cmd = t.addCmd(dt, "misc/cgo/testtls", "go", "test", "-ldflags", `-linkmode=external -extldflags "-pie"`)
- cmd.Env = env
+ cmd = t.addCmd(dt, "misc/cgo/testtls", "go", "test", "-buildmode=pie")
+ cmd.Env = env
- cmd = t.addCmd(dt, "misc/cgo/nocgo", "go", "test", "-ldflags", `-linkmode=external -extldflags "-pie"`)
- cmd.Env = env
+ cmd = t.addCmd(dt, "misc/cgo/nocgo", "go", "test", "-buildmode=pie")
+ cmd.Env = env
- }
}
}
}

View File

@ -0,0 +1,63 @@
From 3502496d03bcd842fd7aac95ec0d7096d581cd26 Mon Sep 17 00:00:00 2001
From: Lynn Boger <laboger@linux.vnet.ibm.com>
Date: Wed, 11 Oct 2017 16:02:59 -0400
Subject: [PATCH] misc/cgo/testcarchive: use -no-pie where needed
Starting in gcc 6, -pie is passed to the linker by default
on some platforms, including ppc64le. If the objects
being linked are not built for -pie then in some cases the
executable could be in error. To avoid that problem, -no-pie
should be used with gcc to override the default -pie option
and generate a correct executable that can be run without error.
Fixes #22126
Change-Id: I4a052bba8b9b3bd6706f5d27ca9a7cebcb504c95
Reviewed-on: https://go-review.googlesource.com/70072
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
---
misc/cgo/testcarchive/carchive_test.go | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/misc/cgo/testcarchive/carchive_test.go b/misc/cgo/testcarchive/carchive_test.go
index b5123154e79..ac637c06007 100644
--- a/misc/cgo/testcarchive/carchive_test.go
+++ b/misc/cgo/testcarchive/carchive_test.go
@@ -6,6 +6,7 @@ package carchive_test
import (
"bufio"
+ "bytes"
"debug/elf"
"fmt"
"io/ioutil"
@@ -609,9 +610,26 @@ func TestCompileWithoutShared(t *testing.T) {
}
exe := "./testnoshared" + exeSuffix
- ccArgs := append(cc, "-o", exe, "main5.c", "libgo2.a")
+
+ // In some cases, -no-pie is needed here, but not accepted everywhere. First try
+ // if -no-pie is accepted. See #22126.
+ ccArgs := append(cc, "-o", exe, "-no-pie", "main5.c", "libgo2.a")
t.Log(ccArgs)
out, err = exec.Command(ccArgs[0], ccArgs[1:]...).CombinedOutput()
+
+ // If -no-pie unrecognized, try -nopie if this is possibly clang
+ if err != nil && bytes.Contains(out, []byte("unknown")) && !strings.Contains(cc[0], "gcc") {
+ ccArgs = append(cc, "-o", exe, "-nopie", "main5.c", "libgo2.a")
+ t.Log(ccArgs)
+ out, err = exec.Command(ccArgs[0], ccArgs[1:]...).CombinedOutput()
+ }
+
+ // Don't use either -no-pie or -nopie
+ if err != nil && bytes.Contains(out, []byte("unrecognized")) {
+ ccArgs := append(cc, "-o", exe, "main5.c", "libgo2.a")
+ t.Log(ccArgs)
+ out, err = exec.Command(ccArgs[0], ccArgs[1:]...).CombinedOutput()
+ }
t.Logf("%s", out)
if err != nil {
t.Fatal(err)