change over to RHEL 8.4 config instead of ELN
This commit is contained in:
parent
75d18e02a3
commit
45d9179977
123
.gitignore
vendored
123
.gitignore
vendored
@ -1,96 +1,33 @@
|
||||
*.rpm
|
||||
/go1.1.1.src.tar.gz
|
||||
/go1.1.2.src.tar.gz
|
||||
/go1.2.1.src.tar.gz
|
||||
/go1.2.2.src.tar.gz
|
||||
/go1.2.src.tar.gz
|
||||
/go1.3.1.src.tar.gz
|
||||
/go1.3.2.src.tar.gz
|
||||
/go1.3.3.src.tar.gz
|
||||
/go1.3.src.tar.gz
|
||||
/go1.3beta2.src.tar.gz
|
||||
/go1.3rc1.src.tar.gz
|
||||
/go1.3rc2.src.tar.gz
|
||||
/go1.4.1.src.tar.gz
|
||||
/go1.4.2.src.tar.gz
|
||||
/go1.4.src.tar.gz
|
||||
/go1.4beta1.src.tar.gz
|
||||
/go1.4rc1.src.tar.gz
|
||||
/go1.4rc2.src.tar.gz
|
||||
/go1.5beta1.src.tar.gz
|
||||
/golang-19087:a15f344a9efa-xattrs.tar
|
||||
/go1.5beta2.src.tar.gz
|
||||
/go1.5beta3.src.tar.gz
|
||||
/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.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
|
||||
/go1.10beta1.src.tar.gz
|
||||
/go1.10beta2.src.tar.gz
|
||||
/go1.10rc1.src.tar.gz
|
||||
/go1.10rc2.src.tar.gz
|
||||
/go1.8.4.src.tar.gz
|
||||
/go1.8.5.src.tar.gz
|
||||
/go1.10.src.tar.gz
|
||||
/go1.10.1.src.tar.gz
|
||||
/go1.10.2.src.tar.gz
|
||||
/go1.10.3.src.tar.gz
|
||||
/go1.11beta1.src.tar.gz
|
||||
/go1.11beta2.src.tar.gz
|
||||
/go1.11beta3.src.tar.gz
|
||||
/go1.11rc1.src.tar.gz
|
||||
/go1.11rc2.src.tar.gz
|
||||
/go1.11.src.tar.gz
|
||||
/go1.11.1.src.tar.gz
|
||||
/go1.11.2.src.tar.gz
|
||||
/go1.11.4.src.tar.gz
|
||||
/go1.12beta2.src.tar.gz
|
||||
/go1.12rc1.src.tar.gz
|
||||
/go1.12.src.tar.gz
|
||||
/go1.12.1.src.tar.gz
|
||||
/go1.12.2.src.tar.gz
|
||||
/go1.12.5.src.tar.gz
|
||||
/go1.12.6.src.tar.gz
|
||||
/go1.12.7.src.tar.gz
|
||||
/go1.13beta1.src.tar.gz
|
||||
/go1.13rc1.src.tar.gz
|
||||
/go1.13rc2.src.tar.gz
|
||||
/go1.13.src.tar.gz
|
||||
/go1.13.1.src.tar.gz
|
||||
/go1.13.3.src.tar.gz
|
||||
/go1.13.4.src.tar.gz
|
||||
/go1.13.5.src.tar.gz
|
||||
/go1.13.6.src.tar.gz
|
||||
/go1.14beta1.src.tar.gz
|
||||
/go1.14rc1.src.tar.gz
|
||||
/go1.14.src.tar.gz
|
||||
/go1.14.2.src.tar.gz
|
||||
/go1.14.3.src.tar.gz
|
||||
/go1.14.4.src.tar.gz
|
||||
/go1.14.6.src.tar.gz
|
||||
/go1.15beta1.src.tar.gz
|
||||
/go1.15rc1.src.tar.gz
|
||||
/go1.15rc2.src.tar.gz
|
||||
/go1.15.src.tar.gz
|
||||
/go1.15.1.src.tar.gz
|
||||
/go1.15.2.src.tar.gz
|
||||
/go1.15.3.src.tar.gz
|
||||
/go1.15.4.src.tar.gz
|
||||
/dev.boringcrypto.go1.10.tar.gz
|
||||
/go1.9.7.linux-amd64.tar.gz
|
||||
/go1.9.7.linux-386.tar.gz
|
||||
/go1.9.7.linux-ppc64le.tar.gz
|
||||
/go1.9.7.linux-s390x.tar.gz
|
||||
/go1.9.7.linux-arm64.tar.gz
|
||||
/go1.10.3-openssl-1-1-fips.tar.gz
|
||||
/go1.11-openssl-1.1-fips.tar.gz
|
||||
/go1.11.5-openssl-1.1.tar.gz
|
||||
/go-go1.11.5-openssl-1.1.tar.gz
|
||||
/go1.12.1-openssl-fips.tar.gz
|
||||
/go1.12.1-3-openssl-fips.tar.gz
|
||||
/go1.12.1-4-openssl-fips.tar.gz
|
||||
/go1.12.1-8-openssl-fips.tar.gz
|
||||
/go1.12.1-9-openssl-fips.tar.gz
|
||||
/go1.12.5-1-openssl-fips.tar.gz
|
||||
/go1.12.6-1-openssl-fips.tar.gz
|
||||
/go-go-1.12.6-2-openssl-fips.tar.gz
|
||||
/go-go-1.12.6-3-openssl-fips.tar.gz
|
||||
/go-go-1.12.8-2-openssl-fips.tar.gz
|
||||
/go-go-1.13.4-1-openssl-fips.tar.gz
|
||||
/go-go-1.14.2-1-openssl-fips.tar.gz
|
||||
/go-go-1.14.4-1-openssl-fips.tar.gz
|
||||
/go-go-1.14.6-1-openssl-fips.tar.gz
|
||||
/go-go-1.14.7-1-openssl-fips.tar.gz
|
||||
/go-go-1.14.7-2-openssl-fips.tar.gz
|
||||
/go-go-1.15.0-2-openssl-fips.tar.gz
|
||||
/go-go-1.15.2-1-openssl-fips.tar.gz
|
||||
|
@ -1,54 +0,0 @@
|
||||
From b38cd2374c2395f5a77802ef8ea3d7ac5b8a86ad Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jakub=20=C4=8Cajka?= <jcajka@redhat.com>
|
||||
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(-)
|
||||
|
||||
diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go
|
||||
index 61dc6bdda6..e8658dc56c 100644
|
||||
--- a/src/cmd/go/internal/cfg/cfg.go
|
||||
+++ b/src/cmd/go/internal/cfg/cfg.go
|
||||
@@ -245,11 +245,11 @@ var (
|
||||
GOPPC64 = envOr("GOPPC64", fmt.Sprintf("%s%d", "power", objabi.GOPPC64))
|
||||
GOWASM = envOr("GOWASM", fmt.Sprint(objabi.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")
|
||||
)
|
||||
|
||||
diff --git a/src/cmd/go/testdata/script/mod_sumdb_golang.txt b/src/cmd/go/testdata/script/mod_sumdb_golang.txt
|
||||
index 40a07fc7e9..50436e32d7 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 @@
|
||||
env GOPROXY=
|
||||
env GOSUMDB=
|
||||
go env GOPROXY
|
||||
-stdout '^https://proxy.golang.org,direct$'
|
||||
+stdout '^direct$'
|
||||
go env GOSUMDB
|
||||
-stdout '^sum.golang.org$'
|
||||
+stdout '^off$'
|
||||
env GOPROXY=https://proxy.golang.org
|
||||
go env GOSUMDB
|
||||
-stdout '^sum.golang.org$'
|
||||
+stdout '^off$'
|
||||
|
||||
# download direct from github
|
||||
[!net] skip
|
||||
--
|
||||
2.21.0
|
||||
|
83
31bit-OID-asn1.patch
Normal file
83
31bit-OID-asn1.patch
Normal 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{}},
|
||||
}
|
65
README.md
Normal file
65
README.md
Normal file
@ -0,0 +1,65 @@
|
||||
# Golang
|
||||
|
||||
## Introduction
|
||||
|
||||
This package holds the spec file and related patches for the Golang package.
|
||||
The golang package is part of the larger go-toolset meta package.
|
||||
|
||||
## Sources
|
||||
|
||||
This particular branch provides Go 1.12.x. The sources for this branch can be
|
||||
found at https://pagure.io/go/tree/go1.12-openssl-fips. The reason the source is
|
||||
coming from a pagure fork as opposed to an upstream tarball is due to certain
|
||||
patches we have written and currently maintain in order to claim FIPS compliance
|
||||
by calling into OpenSSL. Shipping a forked version of the toolchain is not the
|
||||
ideal scenario, and there is work in progress with upstream to enable us to
|
||||
instead ship a pure upstream toolchain and include a crypto module in go-toolset
|
||||
which will satisfy our FIPS requirements.
|
||||
|
||||
The current fork is based on an upstream branch[[0]] which uses
|
||||
boringcrypto[[1]] instead of OpenSSL.
|
||||
|
||||
If you need to make changes to the source for a rebase or bug fix, check out the
|
||||
pagure repo and switch to the branch listed above. Once you have made your
|
||||
changes you can test them locally with `./all.bash`. You may want to export
|
||||
`GOLANG_FIPS=1` before running that if you want to verify the FIPS codepaths are
|
||||
correct. Please note however that the test suite does not fully expect FIPS
|
||||
compliance, and will attempt to test non FIPS compliant code paths. The easiest
|
||||
way to test your changes correctly is to create a tarball locally and execute a
|
||||
mockbuild using this packge, which knows how to correctly run the testsuite in
|
||||
both FIPS and non-FIPS modes.
|
||||
|
||||
NOTE: The way pagure previously handled uploaded releases has changed, and
|
||||
releases must be tagged in the appropriate branch, from which pagure will
|
||||
generate source tarballs.
|
||||
|
||||
## Testing & building changes
|
||||
|
||||
The first test you should run is a local mockbuild. This can be done with the
|
||||
rhpkg command:
|
||||
|
||||
```
|
||||
rhpkg mockbuild
|
||||
```
|
||||
|
||||
Once everything builds and passes locally you'll likely want to perform a
|
||||
scratch build. This will ensure that the changes you made build and run
|
||||
correctly on all architectures that this package supports. The best way to do
|
||||
this is to run a scratch build from your local sources without first having to
|
||||
push them. This ensures your changes are correct before commiting them to the
|
||||
repo. This can also be done via the following rhpkg command:
|
||||
|
||||
```
|
||||
rhpkg scratch-build --srpm
|
||||
```
|
||||
|
||||
Once your scratch build has passed you can execute a real build:
|
||||
|
||||
```
|
||||
rhpkg build
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
[0] https://github.com/golang/go/tree/dev.boringcrypto
|
||||
[1] https://opensource.google.com/projects/boringssl
|
20
dlink-aarch64-test-fail.patch
Normal file
20
dlink-aarch64-test-fail.patch
Normal file
@ -0,0 +1,20 @@
|
||||
diff -Nrup go1/misc/cgo/testshared/shared_test.go go/misc/cgo/testshared/shared_test.go
|
||||
--- go1/misc/cgo/testshared/shared_test.go 2018-02-16 09:12:19.000000000 -0800
|
||||
+++ go/misc/cgo/testshared/shared_test.go 2018-04-05 12:21:37.129927630 -0700
|
||||
@@ -169,11 +169,11 @@ func TestMain(m *testing.M) {
|
||||
// That won't work if GOBIN is set.
|
||||
os.Unsetenv("GOBIN")
|
||||
|
||||
- exitCode, err := testMain(m)
|
||||
- if err != nil {
|
||||
- log.Fatal(err)
|
||||
- }
|
||||
- os.Exit(exitCode)
|
||||
+ // exitCode, err := testMain(m)
|
||||
+ // if err != nil {
|
||||
+ // log.Fatal(err)
|
||||
+ // }
|
||||
+ os.Exit(0)
|
||||
}
|
||||
|
||||
// The shared library was built at the expected location.
|
13
fix_TestScript_list_std.patch
Normal file
13
fix_TestScript_list_std.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/src/cmd/go/testdata/script/list_std.txt b/src/cmd/go/testdata/script/list_std.txt
|
||||
index 6ab1bd1674..4a00e436fd 100644
|
||||
--- a/src/cmd/go/testdata/script/list_std.txt
|
||||
+++ b/src/cmd/go/testdata/script/list_std.txt
|
||||
@@ -6,7 +6,7 @@ env GO111MODULE=off
|
||||
# Listing GOROOT should only find standard packages.
|
||||
cd $GOROOT/src
|
||||
go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' ./...
|
||||
-! stdout .
|
||||
+stdout _$GOROOT
|
||||
|
||||
# Standard packages should include cmd, but not cmd/vendor.
|
||||
go list ./...
|
@ -1,19 +1,6 @@
|
||||
From edce31a2904846ae74e3c011f2cf5fddc963459e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jakub=20=C4=8Cajka?= <jcajka@redhat.com>
|
||||
Date: Thu, 22 Mar 2018 12:07:32 +0100
|
||||
Subject: [PATCH 1/3] Don't use the bundled tzdata at runtime, except for the
|
||||
internal test suite
|
||||
|
||||
---
|
||||
src/time/internal_test.go | 7 +++++--
|
||||
src/time/zoneinfo_test.go | 3 ++-
|
||||
src/time/zoneinfo_unix.go | 2 --
|
||||
3 files changed, 7 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/time/internal_test.go b/src/time/internal_test.go
|
||||
index 76d5524124..e81ace5f64 100644
|
||||
--- a/src/time/internal_test.go
|
||||
+++ b/src/time/internal_test.go
|
||||
diff -up go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/internal_test.go.time go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/internal_test.go
|
||||
--- go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/internal_test.go.time 2017-12-05 01:10:10.000000000 +0100
|
||||
+++ go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/internal_test.go 2017-12-05 14:55:10.574637475 +0100
|
||||
@@ -4,13 +4,15 @@
|
||||
|
||||
package time
|
||||
@ -42,10 +29,9 @@ index 76d5524124..e81ace5f64 100644
|
||||
if zipOnly {
|
||||
zoneSources = zoneSources[len(zoneSources)-1:]
|
||||
}
|
||||
diff --git a/src/time/zoneinfo_test.go b/src/time/zoneinfo_test.go
|
||||
index 7a55d4f618..6063ca1195 100644
|
||||
--- a/src/time/zoneinfo_test.go
|
||||
+++ b/src/time/zoneinfo_test.go
|
||||
diff -up go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_test.go.time go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_test.go
|
||||
--- go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_test.go.time 2017-12-05 01:10:10.000000000 +0100
|
||||
+++ go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_test.go 2017-12-05 14:58:09.823109248 +0100
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
@ -54,7 +40,7 @@ index 7a55d4f618..6063ca1195 100644
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
@@ -128,7 +129,7 @@ func TestLoadLocationFromTZData(t *testing.T) {
|
||||
@@ -128,7 +129,7 @@ func TestLoadLocationFromTZData(t *testi
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@ -63,10 +49,9 @@ index 7a55d4f618..6063ca1195 100644
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go
|
||||
index 88313aa0ed..d9596115ef 100644
|
||||
--- a/src/time/zoneinfo_unix.go
|
||||
+++ b/src/time/zoneinfo_unix.go
|
||||
diff -up go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_unix.go.time go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_unix.go
|
||||
--- go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_unix.go.time 2017-12-05 01:10:10.000000000 +0100
|
||||
+++ go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_unix.go 2017-12-05 14:55:10.574637475 +0100
|
||||
@@ -12,7 +12,6 @@
|
||||
package time
|
||||
|
||||
@ -83,6 +68,3 @@ index 88313aa0ed..d9596115ef 100644
|
||||
}
|
||||
|
||||
func initLocal() {
|
||||
--
|
||||
2.14.3
|
||||
|
177
golang-1.10-pkgconfig-fix.patch
Normal file
177
golang-1.10-pkgconfig-fix.patch
Normal file
@ -0,0 +1,177 @@
|
||||
From 09581ca4826b6d67b1c3a3c8597038b28a37f52d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jakub=20=C4=8Cajka?= <jcajka@redhat.com>
|
||||
Date: Fri, 5 Jan 2018 13:38:55 +0100
|
||||
Subject: [PATCH] cmd/go/internal/work : improve pkgconfig support to work with
|
||||
latest(1.4+) pkgconf
|
||||
|
||||
Fixes #23373
|
||||
|
||||
Fix interfacing with latest(1.4+) pkgconf versions, as they have change the output format, by extending parsing function splitPkgConfigOutput to accommodate more possible fragment escaping formats. Function is based on pkgconfigs own implementation at https://github.com/pkgconf/pkgconf/blob/master/libpkgconf/argvsplit.c. Along with this change test case TestSplitPkgConfigOutput have been expanded. Thanks to ignatenko for help on test cases and insights in to the pkgconfig.
|
||||
|
||||
Change-Id: I55301bb564b07128d5564ec1454dd247f84a95c3
|
||||
---
|
||||
src/cmd/go/internal/work/build_test.go | 44 +++++++++++++++++---
|
||||
src/cmd/go/internal/work/exec.go | 75 +++++++++++++++++++++++-----------
|
||||
2 files changed, 90 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/src/cmd/go/internal/work/build_test.go b/src/cmd/go/internal/work/build_test.go
|
||||
index 3f5ba37c64..c3c63a97a4 100644
|
||||
--- a/src/cmd/go/internal/work/build_test.go
|
||||
+++ b/src/cmd/go/internal/work/build_test.go
|
||||
@@ -39,14 +39,46 @@ func TestSplitPkgConfigOutput(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
in []byte
|
||||
want []string
|
||||
+ pass bool
|
||||
}{
|
||||
- {[]byte(`-r:foo -L/usr/white\ space/lib -lfoo\ bar -lbar\ baz`), []string{"-r:foo", "-L/usr/white space/lib", "-lfoo bar", "-lbar baz"}},
|
||||
- {[]byte(`-lextra\ fun\ arg\\`), []string{`-lextra fun arg\`}},
|
||||
- {[]byte(`broken flag\`), []string{"broken", "flag"}},
|
||||
- {[]byte("\textra whitespace\r\n"), []string{"extra", "whitespace"}},
|
||||
- {[]byte(" \r\n "), nil},
|
||||
+ {[]byte(`-r:foo -L/usr/white\ space/lib -lfoo\ bar -lbar\ baz`), []string{"-r:foo", "-L/usr/white space/lib", "-lfoo bar", "-lbar baz"}, true},
|
||||
+ {[]byte(`-lextra\ fun\ arg\\`), []string{`-lextra fun arg\`}, true},
|
||||
+ {[]byte(`broken flag\`), []string{"broken", "flag"}, true},
|
||||
+ {[]byte(`extra broken flag \`), []string{"extra", "broken", "flag"}, true},
|
||||
+ {[]byte(`\`), nil, true},
|
||||
+ {[]byte("\textra whitespace\r\n"), []string{"extra", "whitespace"}, true},
|
||||
+ {[]byte(" \r\n "), nil, true},
|
||||
+ {[]byte(`"-r:foo" "-L/usr/white space/lib" "-lfoo bar" "-lbar baz"`), []string{"-r:foo", "-L/usr/white space/lib", "-lfoo bar", "-lbar baz"}, true},
|
||||
+ {[]byte(`"-lextra fun arg\\"`), []string{`-lextra fun arg\`}, true},
|
||||
+ {[]byte(`" \r\n\ "`), []string{` \r\n\ `}, true},
|
||||
+ {[]byte(`""`), nil, true},
|
||||
+ {[]byte(``), nil, true},
|
||||
+ {[]byte(`"\\"`), []string{`\`}, true},
|
||||
+ {[]byte(`"\x"`), []string{`\x`}, true},
|
||||
+ {[]byte(`"\\x"`), []string{`\x`}, true},
|
||||
+ {[]byte(`'\\'`), []string{`\`}, true},
|
||||
+ {[]byte(`'\x'`), []string{`\x`}, true},
|
||||
+ {[]byte(`"\\x"`), []string{`\x`}, true},
|
||||
+ {[]byte(`-fPIC -I/test/include/foo -DQUOTED='"/test/share/doc"'`), []string{"-fPIC", "-I/test/include/foo", `-DQUOTED="/test/share/doc"`}, true},
|
||||
+ {[]byte(`-fPIC -I/test/include/foo -DQUOTED="/test/share/doc"`), []string{"-fPIC", "-I/test/include/foo", "-DQUOTED=/test/share/doc"}, true},
|
||||
+ {[]byte(`-fPIC -I/test/include/foo -DQUOTED=\"/test/share/doc\"`), []string{"-fPIC", "-I/test/include/foo", `-DQUOTED="/test/share/doc"`}, true},
|
||||
+ {[]byte(`-fPIC -I/test/include/foo -DQUOTED='/test/share/doc'`), []string{"-fPIC", "-I/test/include/foo", "-DQUOTED=/test/share/doc"}, true},
|
||||
+ {[]byte(`-DQUOTED='/te\st/share/d\oc'`), []string{`-DQUOTED=/te\st/share/d\oc`}, true},
|
||||
+ {[]byte(`-Dhello=10 -Dworld=+32 -DDEFINED_FROM_PKG_CONFIG=hello\ world`), []string{"-Dhello=10", "-Dworld=+32", "-DDEFINED_FROM_PKG_CONFIG=hello world"}, true},
|
||||
+ {[]byte(`" \r\n `), nil, false},
|
||||
+ {[]byte(`"-r:foo" "-L/usr/white space/lib "-lfoo bar" "-lbar baz"`), nil, false},
|
||||
+ {[]byte(`"-lextra fun arg\\`), nil, false},
|
||||
} {
|
||||
- got := splitPkgConfigOutput(test.in)
|
||||
+ got, err := splitPkgConfigOutput(test.in)
|
||||
+ if err != nil {
|
||||
+ if test.pass {
|
||||
+ t.Errorf("splitPkgConfigOutput(%v) = %v; function returned error %v", test.in, got, err)
|
||||
+ }
|
||||
+ if got != nil {
|
||||
+ t.Errorf("splitPkgConfigOutput failed with error %v and output has been non nil %v", err, got)
|
||||
+ }
|
||||
+ continue
|
||||
+ }
|
||||
if !reflect.DeepEqual(got, test.want) {
|
||||
t.Errorf("splitPkgConfigOutput(%v) = %v; want %v", test.in, got, test.want)
|
||||
}
|
||||
diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
|
||||
index a5ab75f6a8..8774be1385 100644
|
||||
--- a/src/cmd/go/internal/work/exec.go
|
||||
+++ b/src/cmd/go/internal/work/exec.go
|
||||
@@ -900,36 +900,62 @@ func (b *Builder) PkgconfigCmd() string {
|
||||
}
|
||||
|
||||
// splitPkgConfigOutput parses the pkg-config output into a slice of
|
||||
-// flags. pkg-config always uses \ to escape special characters.
|
||||
-func splitPkgConfigOutput(out []byte) []string {
|
||||
+// flags. This implements the algorithm from pkgconf/libpkgconf/argvsplit.c
|
||||
+func splitPkgConfigOutput(out []byte) ([]string, error) {
|
||||
if len(out) == 0 {
|
||||
- return nil
|
||||
+ return nil, nil
|
||||
}
|
||||
var flags []string
|
||||
- flag := make([]byte, len(out))
|
||||
- r, w := 0, 0
|
||||
- for r < len(out) {
|
||||
- switch out[r] {
|
||||
- case ' ', '\t', '\r', '\n':
|
||||
- if w > 0 {
|
||||
- flags = append(flags, string(flag[:w]))
|
||||
+ flag := make([]byte, 0, len(out))
|
||||
+ escaped := false
|
||||
+ quote := byte(0)
|
||||
+
|
||||
+ for _, c := range out {
|
||||
+ if escaped {
|
||||
+ if quote == '"' || quote == '\'' {
|
||||
+ switch c {
|
||||
+ case '$', '`', '"', '\\':
|
||||
+ default:
|
||||
+ flag = append(flag, '\\')
|
||||
+ }
|
||||
+ flag = append(flag, c)
|
||||
+ } else {
|
||||
+ flag = append(flag, c)
|
||||
}
|
||||
- w = 0
|
||||
- case '\\':
|
||||
- r++
|
||||
- fallthrough
|
||||
- default:
|
||||
- if r < len(out) {
|
||||
- flag[w] = out[r]
|
||||
- w++
|
||||
+ escaped = false
|
||||
+ } else if quote != 0 {
|
||||
+ if c == quote {
|
||||
+ quote = 0
|
||||
+ } else {
|
||||
+ switch c {
|
||||
+ case '\\':
|
||||
+ escaped = true
|
||||
+ default:
|
||||
+ flag = append(flag, c)
|
||||
+ }
|
||||
}
|
||||
+ } else if strings.IndexByte(" \t\n\v\f\r", c) < 0 {
|
||||
+ switch c {
|
||||
+ case '\\':
|
||||
+ escaped = true
|
||||
+ case '\'', '"':
|
||||
+ quote = c
|
||||
+ default:
|
||||
+ flag = append(flag, c)
|
||||
+ }
|
||||
+ } else if len(flag) != 0 {
|
||||
+ flags = append(flags, string(flag))
|
||||
+ flag = flag[:0]
|
||||
}
|
||||
- r++
|
||||
}
|
||||
- if w > 0 {
|
||||
- flags = append(flags, string(flag[:w]))
|
||||
+
|
||||
+ if quote != 0 {
|
||||
+ return nil, errors.New("unterminated quoted string in pkgconf output ")
|
||||
+ } else if len(flag) != 0 {
|
||||
+ flags = append(flags, string(flag))
|
||||
}
|
||||
- return flags
|
||||
+
|
||||
+ return flags, nil
|
||||
}
|
||||
|
||||
// Calls pkg-config if needed and returns the cflags/ldflags needed to build the package.
|
||||
@@ -948,7 +974,10 @@ func (b *Builder) getPkgConfigFlags(p *load.Package) (cflags, ldflags []string,
|
||||
return nil, nil, errPrintedOutput
|
||||
}
|
||||
if len(out) > 0 {
|
||||
- cflags = splitPkgConfigOutput(out)
|
||||
+ cflags, err = splitPkgConfigOutput(out)
|
||||
+ if err != nil {
|
||||
+ return nil, nil, err
|
||||
+ }
|
||||
if err := checkCompilerFlags("CFLAGS", "pkg-config --cflags", cflags); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
--
|
||||
2.14.3
|
||||
|
25
golang-1.15-warnCN.patch
Normal file
25
golang-1.15-warnCN.patch
Normal file
@ -0,0 +1,25 @@
|
||||
diff --git a/src/crypto/x509/verify.go b/src/crypto/x509/verify.go
|
||||
index 50f4d4a..121fd1b 100644
|
||||
--- a/src/crypto/x509/verify.go
|
||||
+++ b/src/crypto/x509/verify.go
|
||||
@@ -20,6 +20,9 @@ import (
|
||||
|
||||
// ignoreCN disables interpreting Common Name as a hostname. See issue 24151.
|
||||
var ignoreCN = !strings.Contains(os.Getenv("GODEBUG"), "x509ignoreCN=0")
|
||||
+// if using Common Name as a hostname is enabled via x509ignoreCN=0,
|
||||
+// warnCN enables a warning whenever Common Name is interpreted as a hostname.
|
||||
+var warnCN = strings.Contains(os.Getenv("GODEBUG"), "x509warnCN=1")
|
||||
|
||||
type InvalidReason int
|
||||
|
||||
@@ -1078,6 +1081,10 @@ func (c *Certificate) VerifyHostname(h string) error {
|
||||
names := c.DNSNames
|
||||
if c.commonNameAsHostname() {
|
||||
names = []string{c.Subject.CommonName}
|
||||
+ if warnCN {
|
||||
+ fmt.Fprintf(os.Stderr, "x509: Warning - certificate relies on legacy Common Name field. " +
|
||||
+ "Using CN without SAN is deprecated and will not work in future versions.\n")
|
||||
+ }
|
||||
}
|
||||
|
||||
candidateName := toLowerCaseASCII(h) // Save allocations inside the loop.
|
61
golang-1.5-bootstrap-binary-path.patch
Normal file
61
golang-1.5-bootstrap-binary-path.patch
Normal file
@ -0,0 +1,61 @@
|
||||
diff -up go/src/cmd/dist/buildtool.go.bootstrap go/src/cmd/dist/buildtool.go
|
||||
--- 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")
|
||||
+
|
||||
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)
|
||||
+ }
|
||||
+
|
||||
// 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
|
||||
// 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 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}
|
||||
-if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
|
||||
- echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/go." >&2
|
||||
+if [ -x "$GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go" ]; then
|
||||
+ rm -f cmd/dist/dist
|
||||
+ GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go" build -o cmd/dist/dist ./cmd/dist
|
||||
+elif [ -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
|
||||
+ rm -f cmd/dist/dist
|
||||
+ GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
|
||||
+else
|
||||
+ echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go." >&2
|
||||
+ echo "ERROR: or $GOROOT_BOOTSTRAP/bin/${GOHOSTOS}_${GOHOSTARCH}/go." >&2
|
||||
echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -130,8 +137,6 @@ if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ];
|
||||
echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2
|
||||
exit 1
|
||||
fi
|
||||
-rm -f cmd/dist/dist
|
||||
-GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
|
||||
|
||||
# -e doesn't propagate out of eval, so check success by hand.
|
||||
eval $(./cmd/dist/dist env -p || echo FAIL=true)
|
@ -1 +1 @@
|
||||
add-auto-load-safe-path /usr/lib/golang/src/runtime/runtime-gdb.py
|
||||
add-auto-load-safe-path /usr/lib/golang/src/pkg/runtime/runtime-gdb.py
|
||||
|
3
golang-prelink.conf
Normal file
3
golang-prelink.conf
Normal file
@ -0,0 +1,3 @@
|
||||
# there are ELF files in src which are testdata and shouldn't be modified
|
||||
-b /usr/lib/golang/src
|
||||
-b /usr/lib64/golang/src
|
758
golang.spec
758
golang.spec
File diff suppressed because it is too large
Load Diff
157
net-http-graceful-shutdown.patch
Normal file
157
net-http-graceful-shutdown.patch
Normal file
@ -0,0 +1,157 @@
|
||||
diff --git a/src/net/http/export_test.go b/src/net/http/export_test.go
|
||||
index 657ff9d..67a74ae 100644
|
||||
--- a/src/net/http/export_test.go
|
||||
+++ b/src/net/http/export_test.go
|
||||
@@ -274,6 +274,17 @@ func (s *Server) ExportAllConnsIdle() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
+func (s *Server) ExportAllConnsByState() map[ConnState]int {
|
||||
+ states := map[ConnState]int{}
|
||||
+ s.mu.Lock()
|
||||
+ defer s.mu.Unlock()
|
||||
+ for c := range s.activeConn {
|
||||
+ st, _ := c.getState()
|
||||
+ states[st] += 1
|
||||
+ }
|
||||
+ return states
|
||||
+}
|
||||
+
|
||||
func (r *Request) WithT(t *testing.T) *Request {
|
||||
return r.WithContext(context.WithValue(r.Context(), tLogKey{}, t.Logf))
|
||||
}
|
||||
diff --git a/src/net/http/serve_test.go b/src/net/http/serve_test.go
|
||||
index 5f56932..806272b 100644
|
||||
--- a/src/net/http/serve_test.go
|
||||
+++ b/src/net/http/serve_test.go
|
||||
@@ -5519,16 +5519,23 @@ func TestServerSetKeepAlivesEnabledClosesConns(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
-func TestServerShutdown_h1(t *testing.T) { testServerShutdown(t, h1Mode) }
|
||||
-func TestServerShutdown_h2(t *testing.T) { testServerShutdown(t, h2Mode) }
|
||||
+func TestServerShutdown_h1(t *testing.T) {
|
||||
+ testServerShutdown(t, h1Mode)
|
||||
+}
|
||||
+func TestServerShutdown_h2(t *testing.T) {
|
||||
+ testServerShutdown(t, h2Mode)
|
||||
+}
|
||||
|
||||
func testServerShutdown(t *testing.T, h2 bool) {
|
||||
setParallel(t)
|
||||
defer afterTest(t)
|
||||
var doShutdown func() // set later
|
||||
+ var doStateCount func()
|
||||
var shutdownRes = make(chan error, 1)
|
||||
+ var statesRes = make(chan map[ConnState]int, 1)
|
||||
var gotOnShutdown = make(chan struct{}, 1)
|
||||
handler := HandlerFunc(func(w ResponseWriter, r *Request) {
|
||||
+ doStateCount()
|
||||
go doShutdown()
|
||||
// Shutdown is graceful, so it should not interrupt
|
||||
// this in-flight response. Add a tiny sleep here to
|
||||
@@ -5545,6 +5552,9 @@ func testServerShutdown(t *testing.T, h2 bool) {
|
||||
doShutdown = func() {
|
||||
shutdownRes <- cst.ts.Config.Shutdown(context.Background())
|
||||
}
|
||||
+ doStateCount = func() {
|
||||
+ statesRes <- cst.ts.Config.ExportAllConnsByState()
|
||||
+ }
|
||||
get(t, cst.c, cst.ts.URL) // calls t.Fail on failure
|
||||
|
||||
if err := <-shutdownRes; err != nil {
|
||||
@@ -5556,6 +5566,10 @@ func testServerShutdown(t *testing.T, h2 bool) {
|
||||
t.Errorf("onShutdown callback not called, RegisterOnShutdown broken?")
|
||||
}
|
||||
|
||||
+ if states := <-statesRes; states[StateActive] != 1 {
|
||||
+ t.Errorf("connection in wrong state, %v", states)
|
||||
+ }
|
||||
+
|
||||
res, err := cst.c.Get(cst.ts.URL)
|
||||
if err == nil {
|
||||
res.Body.Close()
|
||||
diff --git a/src/net/http/server.go b/src/net/http/server.go
|
||||
index d41b5f6..14a6336 100644
|
||||
--- a/src/net/http/server.go
|
||||
+++ b/src/net/http/server.go
|
||||
@@ -324,7 +324,7 @@ func (c *conn) hijackLocked() (rwc net.Conn, buf *bufio.ReadWriter, err error) {
|
||||
return nil, nil, fmt.Errorf("unexpected Peek failure reading buffered byte: %v", err)
|
||||
}
|
||||
}
|
||||
- c.setState(rwc, StateHijacked)
|
||||
+ c.setState(rwc, StateHijacked, runHooks)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1737,7 +1737,12 @@ func validNextProto(proto string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
-func (c *conn) setState(nc net.Conn, state ConnState) {
|
||||
+const (
|
||||
+ runHooks = true
|
||||
+ skipHooks = false
|
||||
+)
|
||||
+
|
||||
+func (c *conn) setState(nc net.Conn, state ConnState, runHook bool) {
|
||||
srv := c.server
|
||||
switch state {
|
||||
case StateNew:
|
||||
@@ -1750,6 +1755,9 @@ func (c *conn) setState(nc net.Conn, state ConnState) {
|
||||
}
|
||||
packedState := uint64(time.Now().Unix()<<8) | uint64(state)
|
||||
atomic.StoreUint64(&c.curState.atomic, packedState)
|
||||
+ if !runHook {
|
||||
+ return
|
||||
+ }
|
||||
if hook := srv.ConnState; hook != nil {
|
||||
hook(nc, state)
|
||||
}
|
||||
@@ -1803,7 +1811,7 @@ func (c *conn) serve(ctx context.Context) {
|
||||
}
|
||||
if !c.hijacked() {
|
||||
c.close()
|
||||
- c.setState(c.rwc, StateClosed)
|
||||
+ c.setState(c.rwc, StateClosed, runHooks)
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -1831,6 +1839,10 @@ func (c *conn) serve(ctx context.Context) {
|
||||
if proto := c.tlsState.NegotiatedProtocol; validNextProto(proto) {
|
||||
if fn := c.server.TLSNextProto[proto]; fn != nil {
|
||||
h := initALPNRequest{ctx, tlsConn, serverHandler{c.server}}
|
||||
+ // Mark freshly created HTTP/2 as active and prevent any server state hooks
|
||||
+ // from being run on these connections. This prevents closeIdleConns from
|
||||
+ // closing such connections. See issue https://golang.org/issue/39776.
|
||||
+ c.setState(c.rwc, StateActive, skipHooks)
|
||||
fn(c.server, tlsConn, h)
|
||||
}
|
||||
return
|
||||
@@ -1851,7 +1863,7 @@ func (c *conn) serve(ctx context.Context) {
|
||||
w, err := c.readRequest(ctx)
|
||||
if c.r.remain != c.server.initialReadLimitSize() {
|
||||
// If we read any bytes off the wire, we're active.
|
||||
- c.setState(c.rwc, StateActive)
|
||||
+ c.setState(c.rwc, StateActive, runHooks)
|
||||
}
|
||||
if err != nil {
|
||||
const errorHeaders = "\r\nContent-Type: text/plain; charset=utf-8\r\nConnection: close\r\n\r\n"
|
||||
@@ -1934,7 +1946,7 @@ func (c *conn) serve(ctx context.Context) {
|
||||
}
|
||||
return
|
||||
}
|
||||
- c.setState(c.rwc, StateIdle)
|
||||
+ c.setState(c.rwc, StateIdle, runHooks)
|
||||
c.curReq.Store((*response)(nil))
|
||||
|
||||
if !w.conn.server.doKeepAlives() {
|
||||
@@ -2965,7 +2977,7 @@ func (srv *Server) Serve(l net.Listener) error {
|
||||
}
|
||||
tempDelay = 0
|
||||
c := srv.newConn(rw)
|
||||
- c.setState(c.rwc, StateNew) // before Serve can return
|
||||
+ c.setState(c.rwc, StateNew, runHooks) // before Serve can return
|
||||
go c.serve(connCtx)
|
||||
}
|
||||
}
|
178
ppc64le_fix_missing_deferreturn.patch
Normal file
178
ppc64le_fix_missing_deferreturn.patch
Normal file
@ -0,0 +1,178 @@
|
||||
From 457c3cea934db4b8883c9b932912367e02170a61 Mon Sep 17 00:00:00 2001
|
||||
From: Cherry Zhang <cherryyz@google.com>
|
||||
Date: Fri, 03 Jul 2020 14:28:15 -0400
|
||||
Subject: [PATCH] [release-branch.go1.14] cmd/link: detect trampoline of deferreturn call
|
||||
|
||||
This is a backport of CL 234105. This is not a clean cherry-pick,
|
||||
as CL 234105 is for the new linker, whereas we still use the old
|
||||
linker here. This CL backports the logic.
|
||||
|
||||
The runtime needs to find the PC of the deferreturn call in a few
|
||||
places. So for functions that have defer, we record the PC of
|
||||
deferreturn call in its funcdata.
|
||||
|
||||
For very large binaries, the deferreturn call could be made
|
||||
through a trampoline. The current code of finding deferreturn PC
|
||||
fails in this case. This CL handles the trampoline as well.
|
||||
|
||||
Fixes #39991.
|
||||
Updates #39049.
|
||||
|
||||
Change-Id: I929be54d6ae436f5294013793217dc2a35f080d4
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/234105
|
||||
Run-TryBot: Cherry Zhang <cherryyz@google.com>
|
||||
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
||||
Reviewed-by: Jeremy Faller <jeremy@golang.org>
|
||||
Reviewed-by: Than McIntosh <thanm@google.com>
|
||||
---
|
||||
|
||||
diff --git a/src/cmd/link/internal/arm/asm.go b/src/cmd/link/internal/arm/asm.go
|
||||
index f2fb654..c4f529a 100644
|
||||
--- a/src/cmd/link/internal/arm/asm.go
|
||||
+++ b/src/cmd/link/internal/arm/asm.go
|
||||
@@ -470,8 +470,12 @@
|
||||
offset := (signext24(r.Add&0xffffff) + 2) * 4
|
||||
var tramp *sym.Symbol
|
||||
for i := 0; ; i++ {
|
||||
- name := r.Sym.Name + fmt.Sprintf("%+d-tramp%d", offset, i)
|
||||
+ oName := r.Sym.Name
|
||||
+ name := oName + fmt.Sprintf("%+d-tramp%d", offset, i)
|
||||
tramp = ctxt.Syms.Lookup(name, int(r.Sym.Version))
|
||||
+ if oName == "runtime.deferreturn" {
|
||||
+ tramp.Attr.Set(sym.AttrDeferReturnTramp, true)
|
||||
+ }
|
||||
if tramp.Type == sym.SDYNIMPORT {
|
||||
// don't reuse trampoline defined in other module
|
||||
continue
|
||||
diff --git a/src/cmd/link/internal/ld/pcln.go b/src/cmd/link/internal/ld/pcln.go
|
||||
index 3e8135c..43e1661 100644
|
||||
--- a/src/cmd/link/internal/ld/pcln.go
|
||||
+++ b/src/cmd/link/internal/ld/pcln.go
|
||||
@@ -276,7 +276,7 @@
|
||||
// set the resumption point to PC_B.
|
||||
lastWasmAddr = uint32(r.Add)
|
||||
}
|
||||
- if r.Type.IsDirectCall() && r.Sym != nil && r.Sym.Name == "runtime.deferreturn" {
|
||||
+ if r.Type.IsDirectCall() && r.Sym != nil && (r.Sym.Name == "runtime.deferreturn" || r.Sym.Attr.DeferReturnTramp()) {
|
||||
if ctxt.Arch.Family == sys.Wasm {
|
||||
deferreturn = lastWasmAddr - 1
|
||||
} else {
|
||||
diff --git a/src/cmd/link/internal/ppc64/asm.go b/src/cmd/link/internal/ppc64/asm.go
|
||||
index 9fbcff5..e84689d 100644
|
||||
--- a/src/cmd/link/internal/ppc64/asm.go
|
||||
+++ b/src/cmd/link/internal/ppc64/asm.go
|
||||
@@ -667,7 +667,8 @@
|
||||
// target is at some offset within the function. Calls to duff+8 and duff+256 must appear as
|
||||
// distinct trampolines.
|
||||
|
||||
- name := r.Sym.Name
|
||||
+ oName := r.Sym.Name
|
||||
+ name := oName
|
||||
if r.Add == 0 {
|
||||
name = name + fmt.Sprintf("-tramp%d", i)
|
||||
} else {
|
||||
@@ -677,6 +678,9 @@
|
||||
// Look up the trampoline in case it already exists
|
||||
|
||||
tramp = ctxt.Syms.Lookup(name, int(r.Sym.Version))
|
||||
+ if oName == "runtime.deferreturn" {
|
||||
+ tramp.Attr.Set(sym.AttrDeferReturnTramp, true)
|
||||
+ }
|
||||
if tramp.Value == 0 {
|
||||
break
|
||||
}
|
||||
diff --git a/src/cmd/link/internal/sym/attribute.go b/src/cmd/link/internal/sym/attribute.go
|
||||
index 4b69bf3..773b6a4 100644
|
||||
--- a/src/cmd/link/internal/sym/attribute.go
|
||||
+++ b/src/cmd/link/internal/sym/attribute.go
|
||||
@@ -81,7 +81,10 @@
|
||||
// AttrReadOnly indicates whether the symbol's content (Symbol.P) is backed by
|
||||
// read-only memory.
|
||||
AttrReadOnly
|
||||
- // 19 attributes defined so far.
|
||||
+ // AttrDeferReturnTramp indicates the symbol is a trampoline of a deferreturn
|
||||
+ // call.
|
||||
+ AttrDeferReturnTramp
|
||||
+ // 20 attributes defined so far.
|
||||
)
|
||||
|
||||
func (a Attribute) DuplicateOK() bool { return a&AttrDuplicateOK != 0 }
|
||||
@@ -103,6 +106,7 @@
|
||||
func (a Attribute) Container() bool { return a&AttrContainer != 0 }
|
||||
func (a Attribute) TopFrame() bool { return a&AttrTopFrame != 0 }
|
||||
func (a Attribute) ReadOnly() bool { return a&AttrReadOnly != 0 }
|
||||
+func (a Attribute) DeferReturnTramp() bool { return a&AttrDeferReturnTramp != 0 }
|
||||
|
||||
func (a Attribute) CgoExport() bool {
|
||||
return a.CgoExportDynamic() || a.CgoExportStatic()
|
||||
diff --git a/src/cmd/link/link_test.go b/src/cmd/link/link_test.go
|
||||
index 4f792bd..f5efb51 100644
|
||||
--- a/src/cmd/link/link_test.go
|
||||
+++ b/src/cmd/link/link_test.go
|
||||
@@ -447,3 +447,66 @@
|
||||
t.Errorf("unexpected output:\n%s", out)
|
||||
}
|
||||
}
|
||||
+
|
||||
+const testTrampSrc = `
|
||||
+package main
|
||||
+import "fmt"
|
||||
+func main() {
|
||||
+ fmt.Println("hello")
|
||||
+
|
||||
+ defer func(){
|
||||
+ if e := recover(); e == nil {
|
||||
+ panic("did not panic")
|
||||
+ }
|
||||
+ }()
|
||||
+ f1()
|
||||
+}
|
||||
+
|
||||
+// Test deferreturn trampolines. See issue #39049.
|
||||
+func f1() { defer f2() }
|
||||
+func f2() { panic("XXX") }
|
||||
+`
|
||||
+
|
||||
+func TestTrampoline(t *testing.T) {
|
||||
+ // Test that trampoline insertion works as expected.
|
||||
+ // For stress test, we set -debugtramp=2 flag, which sets a very low
|
||||
+ // threshold for trampoline generation, and essentially all cross-package
|
||||
+ // calls will use trampolines.
|
||||
+ switch runtime.GOARCH {
|
||||
+ case "arm", "ppc64", "ppc64le":
|
||||
+ default:
|
||||
+ t.Skipf("trampoline insertion is not implemented on %s", runtime.GOARCH)
|
||||
+ }
|
||||
+ if runtime.GOOS == "aix" {
|
||||
+ t.Skip("trampolines on AIX doesn't work in Go 1.14") // fixed in Go 1.15
|
||||
+ }
|
||||
+
|
||||
+ testenv.MustHaveGoBuild(t)
|
||||
+
|
||||
+ tmpdir, err := ioutil.TempDir("", "TestTrampoline")
|
||||
+ if err != nil {
|
||||
+ t.Fatal(err)
|
||||
+ }
|
||||
+ defer os.RemoveAll(tmpdir)
|
||||
+
|
||||
+ src := filepath.Join(tmpdir, "hello.go")
|
||||
+ err = ioutil.WriteFile(src, []byte(testTrampSrc), 0666)
|
||||
+ if err != nil {
|
||||
+ t.Fatal(err)
|
||||
+ }
|
||||
+ exe := filepath.Join(tmpdir, "hello.exe")
|
||||
+
|
||||
+ cmd := exec.Command(testenv.GoToolPath(t), "build", "-ldflags=-debugtramp=2", "-o", exe, src)
|
||||
+ out, err := cmd.CombinedOutput()
|
||||
+ if err != nil {
|
||||
+ t.Fatalf("build failed: %v\n%s", err, out)
|
||||
+ }
|
||||
+ cmd = exec.Command(exe)
|
||||
+ out, err = cmd.CombinedOutput()
|
||||
+ if err != nil {
|
||||
+ t.Errorf("executable failed to run: %v\n%s", err, out)
|
||||
+ }
|
||||
+ if string(out) != "hello\n" {
|
||||
+ t.Errorf("unexpected output:\n%s", out)
|
||||
+ }
|
||||
+}
|
@ -1,7 +1,7 @@
|
||||
From 817407fc2d6a861e65086388766f58082d38bc0b Mon Sep 17 00:00:00 2001
|
||||
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 2/3] syscall: expose IfInfomsg.X__ifi_pad on s390x
|
||||
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.
|
||||
@ -10,14 +10,12 @@ Fixes #18628 and updates #18632.
|
||||
|
||||
Change-Id: I08e8e1eb705f898cd8822f8bee0d61ce11d514b5
|
||||
---
|
||||
src/syscall/ztypes_linux_s390x.go | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/syscall/ztypes_linux_s390x.go b/src/syscall/ztypes_linux_s390x.go
|
||||
index 63c4a83b19..b5894255df 100644
|
||||
index 63c4a83..b589425 100644
|
||||
--- a/src/syscall/ztypes_linux_s390x.go
|
||||
+++ b/src/syscall/ztypes_linux_s390x.go
|
||||
@@ -449,12 +449,12 @@ type RtAttr struct {
|
||||
@@ -449,12 +449,12 @@
|
||||
}
|
||||
|
||||
type IfInfomsg struct {
|
||||
@ -36,6 +34,3 @@ index 63c4a83b19..b5894255df 100644
|
||||
}
|
||||
|
||||
type IfAddrmsg struct {
|
||||
--
|
||||
2.14.3
|
||||
|
Loading…
Reference in New Issue
Block a user