Compare commits

...

10 Commits
master ... f24

Author SHA1 Message Date
Jakub Cajka e4ae6f5bef Resolves: BZ#1410784 2017-01-19 12:40:55 +01:00
Jakub Čajka 053e29d8b3 Fix NVR typo in changelog 2016-12-02 18:49:24 +01:00
Jakub Čajka 91c5353e3f Bump to 1.6.4
Resolves: BZ#1400732
2016-12-02 14:41:35 +01:00
Jakub Čajka 8e616d848b re-enable p224 curve (see BZ#1038683) 2016-11-18 14:05:20 +01:00
Jakub Čajka 4b0e287858 Commit the patch 2016-10-11 11:28:22 +02:00
Jakub Čajka 46db980f64 Fix tzdata/time tests 2016-10-11 11:11:00 +02:00
Jakub Čajka 1ffe9f2d11 Fix nanotime for macOS Sierra 2016-10-10 15:09:51 +02:00
Jakub Čajka 7e3e63c06c Resolves: BZ#1378960 - make possible to use whole address space on 32bit 2016-09-27 16:54:40 +02:00
Jakub Čajka 977ba82e04 Obsolete golang-vet and golang-cover from golang-googlecode-tools package vet/cover binaries are provided by golang-bin rpm(thanks to jchaloup) 2016-08-08 12:07:58 +02:00
Jakub Čajka b6d61b89ff rebase to 1.6.3
Resolves: bz1357602 - CVE-2016-5386
2016-07-19 14:56:45 +02:00
8 changed files with 454 additions and 1181 deletions

2
.gitignore vendored
View File

@ -31,3 +31,5 @@
/go1.6.src.tar.gz
/go1.6.1.src.tar.gz
/go1.6.2.src.tar.gz
/go1.6.3.src.tar.gz
/go1.6.4.src.tar.gz

File diff suppressed because it is too large Load Diff

View File

@ -82,11 +82,11 @@
%endif
%global go_api 1.6
%global go_version 1.6.2
%global go_version 1.6.4
Name: golang
Version: 1.6.2
Release: 1%{?dist}
Version: 1.6.4
Release: 3%{?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
@ -105,7 +105,7 @@ BuildRequires: hostname
BuildRequires: net-tools
%endif
# for tests
BuildRequires: pcre-devel, glibc-static
BuildRequires: pcre-devel, glibc-static, perl
Provides: go = %{version}-%{release}
Requires: %{name}-bin = %{version}-%{release}
@ -114,9 +114,6 @@ Requires: go-srpm-macros
Patch0: golang-1.2-verbose-build.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1038683
Patch1: golang-1.2-remove-ECC-p224.patch
# use the arch dependent path in the bootstrap
Patch212: golang-1.5-bootstrap-binary-path.patch
@ -128,6 +125,17 @@ Patch213: go1.5beta1-disable-TestGdbPython.patch
# 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
# Backport of https://go-review.googlesource.com/#/c/20471/
Patch216: runtime-use-entire-address-space-on-32-bit.patch
# Backport of https://github.com/golang/go/issues/16570
# and https://github.com/golang/go/issues/16606
Patch217: macos-01.patch
Patch218: macos-02.patch
# Fix for https://github.com/golang/go/issues/17276
Patch219: tzdata-fix.patch
# Having documentation separate was broken
Obsoletes: %{name}-docs < 1.1-4
@ -205,6 +213,9 @@ Obsoletes: %{name}-pkg-netbsd-arm < 1.4.99
Obsoletes: %{name}-pkg-openbsd-386 < 1.4.99
Obsoletes: %{name}-pkg-openbsd-amd64 < 1.4.99
Obsoletes: golang-vet < 0-12.1
Obsoletes: golang-cover < 0-12.1
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
@ -239,9 +250,6 @@ Summary: Golang shared object libraries
# increase verbosity of build
%patch0 -p1
# remove the P224 curve
%patch1 -p1
# use the arch dependent path in the bootstrap
%patch212 -p1
@ -250,6 +258,16 @@ Summary: Golang shared object libraries
%patch215 -p1
# don't apply on ppc as it increases stack size, resulting in nosplit stack overflow
%ifnarch ppc64le ppc64
%patch216 -p1
%endif
%patch217 -p1
%patch218 -p1
%patch219 -p1
%build
# print out system information
uname -a
@ -454,6 +472,33 @@ fi
%endif
%changelog
* Thu Jan 19 2017 Jakub Čajka <jcajka@redhat.com> - 1.6.4-3
- Resolves: BZ#1410784
* Fri Dec 02 2016 Jakub Čajka <jcajka@redhat.com> - 1.6.4-2
- Fix NVR typo in changelog
* Fri Dec 02 2016 Jakub Čajka <jcajka@redhat.com> - 1.6.4-1
- Bump to 1.6.4
- Resolves: BZ#1400732
* Fri Nov 18 2016 Jakub Čajka <jcajka@redhat.com> - 1.6.3-4
- re-enable p224 curve (see BZ#1038683)
* Tue Sep 27 2016 Jakub Čajka <jcajka@redhat.com> - 1.6.3-3
- Resolves: BZ#1378960 - make possible to use whole address space on 32bit
- Fix nanotime for macOS Sierra
- Fix tzdata/time tests
* Mon Aug 08 2016 Jakub Čajka <jcajka@redhat.com> - 1.6.3-2
- Obsolete golang-vet and golang-cover from golang-googlecode-tools package
vet/cover binaries are provided by golang-bin rpm(thanks to jchaloup)
- resolves: #1268206
* Tue Jul 19 2016 Jakub Čajka <jcajka@redhat.com> - 1.6.3-1
- rebase to 1.6.3
- Resolves: bz1357602 - CVE-2016-5386
* Tue Apr 26 2016 Jakub Čajka <jcajka@redhat.com> - 1.6.2-1
- rebase to 1.6.2
- Resolves: bz1329206 - golang-1.6.2.src is available

60
macos-01.patch Normal file
View File

@ -0,0 +1,60 @@
From 2da5633eb9091608047881953f75b489a3134cdc Mon Sep 17 00:00:00 2001
From: Brad Fitzpatrick <bradfitz@golang.org>
Date: Mon, 1 Aug 2016 21:54:40 -0700
Subject: [PATCH] runtime: fix nanotime for macOS Sierra, again.
macOS Sierra beta4 changed the kernel interface for getting time.
DX now optionally points to an address for additional info.
Set it to zero to avoid corrupting memory.
Fixes #16570
Change-Id: I9f537e552682045325cdbb68b7d0b4ddafade14a
Reviewed-on: https://go-review.googlesource.com/25400
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
---
src/runtime/sys_darwin_386.s | 7 ++++---
src/runtime/sys_darwin_amd64.s | 1 +
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/runtime/sys_darwin_386.s b/src/runtime/sys_darwin_386.s
index 83f4709..b5e65e6 100644
--- a/src/runtime/sys_darwin_386.s
+++ b/src/runtime/sys_darwin_386.s
@@ -196,15 +196,16 @@ timeloop:
systime:
// Fall back to system call (usually first call in this thread)
- LEAL 12(SP), AX // must be non-nil, unused
+ LEAL 16(SP), AX // must be non-nil, unused
MOVL AX, 4(SP)
MOVL $0, 8(SP) // time zone pointer
+ MOVL $0, 12(SP) // required as of Sierra; Issue 16570
MOVL $116, AX
INT $0x80
CMPL AX, $0
JNE inreg
- MOVL 12(SP), AX
- MOVL 16(SP), DX
+ MOVL 16(SP), AX
+ MOVL 20(SP), DX
inreg:
// sec is in AX, usec in DX
// convert to DX:AX nsec
diff --git a/src/runtime/sys_darwin_amd64.s b/src/runtime/sys_darwin_amd64.s
index e4837ce..ea2cc06 100644
--- a/src/runtime/sys_darwin_amd64.s
+++ b/src/runtime/sys_darwin_amd64.s
@@ -157,6 +157,7 @@ systime:
// Fall back to system call (usually first call in this thread).
MOVQ SP, DI
MOVQ $0, SI
+ MOVQ $0, DX // required as of Sierra; Issue 16570
MOVL $(0x2000000+116), AX
SYSCALL
CMPQ AX, $0

68
macos-02.patch Normal file
View File

@ -0,0 +1,68 @@
diff --git a/src/syscall/syscall_darwin_386.go b/src/syscall/syscall_darwin_386.go
index 2074e7a..286ca98 100644
--- a/src/syscall/syscall_darwin_386.go
+++ b/src/syscall/syscall_darwin_386.go
@@ -26,14 +26,22 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
}
//sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error)
-func Gettimeofday(tv *Timeval) (err error) {
- // The tv passed to gettimeofday must be non-nil
- // but is otherwise unused. The answers come back
- // in the two registers.
+func Gettimeofday(tv *Timeval) error {
+ // The tv passed to gettimeofday must be non-nil.
+ // Before macOS Sierra (10.12), tv was otherwise unused and
+ // the answers came back in the two registers.
+ // As of Sierra, gettimeofday return zeros and populates
+ // tv itself.
sec, usec, err := gettimeofday(tv)
- tv.Sec = int32(sec)
- tv.Usec = int32(usec)
- return err
+ if err != nil {
+ return err
+ }
+ if sec != 0 || usec != 0 {
+ tv.Sec = int32(sec)
+ tv.Usec = int32(usec)
+ }
+ return nil
+
}
func SetKevent(k *Kevent_t, fd, mode, flags int) {
diff --git a/src/syscall/syscall_darwin_amd64.go b/src/syscall/syscall_darwin_amd64.go
index 70b53b8..e2565ba 100644
--- a/src/syscall/syscall_darwin_amd64.go
+++ b/src/syscall/syscall_darwin_amd64.go
@@ -26,14 +26,22 @@ func NsecToTimeval(nsec int64) (tv Timeval) {
}
//sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error)
-func Gettimeofday(tv *Timeval) (err error) {
- // The tv passed to gettimeofday must be non-nil
- // but is otherwise unused. The answers come back
- // in the two registers.
+func Gettimeofday(tv *Timeval) error {
+ // The tv passed to gettimeofday must be non-nil.
+ // Before macOS Sierra (10.12), tv was otherwise unused and
+ // the answers came back in the two registers.
+ // As of Sierra, gettimeofday return zeros and populates
+ // tv itself.
sec, usec, err := gettimeofday(tv)
- tv.Sec = sec
- tv.Usec = usec
- return err
+ if err != nil {
+ return err
+ }
+ if sec != 0 || usec != 0 {
+ tv.Sec = sec
+ tv.Usec = usec
+ }
+ return nil
+
}
func SetKevent(k *Kevent_t, fd, mode, flags int) {

View File

@ -0,0 +1,234 @@
diff --git a/src/runtime/cgocall.go b/src/runtime/cgocall.go
index fef8add..30c3a67 100644
--- a/src/runtime/cgocall.go
+++ b/src/runtime/cgocall.go
@@ -568,7 +568,7 @@ func cgoIsGoPointer(p unsafe.Pointer) bool {
return false
}
- if cgoInRange(p, mheap_.arena_start, mheap_.arena_used) {
+ if inHeapOrStack(uintptr(p)) {
return true
}
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index b520c68..2055da5 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -173,7 +173,7 @@ const (
// Page number (address>>pageShift)
type pageID uintptr
-const _MaxArena32 = 2 << 30
+const _MaxArena32 = 1<<32 - 1
// OS-defined helpers:
//
@@ -230,7 +230,7 @@ func mallocinit() {
// Set up the allocation arena, a contiguous area of memory where
// allocated data will be found. The arena begins with a bitmap large
- // enough to hold 4 bits per allocated word.
+ // enough to hold 2 bits per allocated word.
if sys.PtrSize == 8 && (limit == 0 || limit > 1<<30) {
// On a 64-bit machine, allocate from a single contiguous reservation.
// 512 GB (MaxMem) should be big enough for now.
@@ -262,7 +262,7 @@ func mallocinit() {
// translation buffers, the user address space is limited to 39 bits
// On darwin/arm64, the address space is even smaller.
arenaSize := round(_MaxMem, _PageSize)
- bitmapSize = arenaSize / (sys.PtrSize * 8 / 4)
+ bitmapSize = arenaSize / (sys.PtrSize * 8 / 2)
spansSize = arenaSize / _PageSize * sys.PtrSize
spansSize = round(spansSize, _PageSize)
for i := 0; i <= 0x7f; i++ {
@@ -287,7 +287,7 @@ func mallocinit() {
// with a giant virtual address space reservation.
// Instead we map the memory information bitmap
// immediately after the data segment, large enough
- // to handle another 2GB of mappings (256 MB),
+ // to handle the entire 4GB of mappings (256 MB),
// along with a reservation for an initial arena.
// When that gets used up, we'll start asking the kernel
// for any memory anywhere and hope it's in the 2GB
@@ -304,15 +304,18 @@ func mallocinit() {
// If we fail to allocate, try again with a smaller arena.
// This is necessary on Android L where we share a process
// with ART, which reserves virtual memory aggressively.
+ // In the worst case, fall back to a 0-sized initial arena,
+ // in the hope that subsequent reservations will succeed.
arenaSizes := []uintptr{
512 << 20,
256 << 20,
128 << 20,
+ 0,
}
for _, arenaSize := range arenaSizes {
- bitmapSize = _MaxArena32 / (sys.PtrSize * 8 / 4)
- spansSize = _MaxArena32 / _PageSize * sys.PtrSize
+ bitmapSize = (_MaxArena32 + 1) / (sys.PtrSize * 8 / 2)
+ spansSize = (_MaxArena32 + 1) / _PageSize * sys.PtrSize
if limit > 0 && arenaSize+bitmapSize+spansSize > limit {
bitmapSize = (limit / 9) &^ ((1 << _PageShift) - 1)
arenaSize = bitmapSize * 8
@@ -347,10 +350,16 @@ func mallocinit() {
p1 := round(p, _PageSize)
mheap_.spans = (**mspan)(unsafe.Pointer(p1))
- mheap_.bitmap = p1 + spansSize
- mheap_.arena_start = p1 + (spansSize + bitmapSize)
- mheap_.arena_used = mheap_.arena_start
+ mheap_.bitmap = p1 + spansSize + bitmapSize
+ if sys.PtrSize == 4 {
+ // Set arena_start such that we can accept memory
+ // reservations located anywhere in the 4GB virtual space.
+ mheap_.arena_start = 0
+ } else {
+ mheap_.arena_start = p1 + (spansSize + bitmapSize)
+ }
mheap_.arena_end = p + pSize
+ mheap_.arena_used = p1 + (spansSize + bitmapSize)
mheap_.arena_reserved = reserved
if mheap_.arena_start&(_PageSize-1) != 0 {
@@ -364,36 +373,13 @@ func mallocinit() {
_g_.m.mcache = allocmcache()
}
-// sysReserveHigh reserves space somewhere high in the address space.
-// sysReserve doesn't actually reserve the full amount requested on
-// 64-bit systems, because of problems with ulimit. Instead it checks
-// that it can get the first 64 kB and assumes it can grab the rest as
-// needed. This doesn't work well with the "let the kernel pick an address"
-// mode, so don't do that. Pick a high address instead.
-func sysReserveHigh(n uintptr, reserved *bool) unsafe.Pointer {
- if sys.PtrSize == 4 {
- return sysReserve(nil, n, reserved)
- }
-
- for i := 0; i <= 0x7f; i++ {
- p := uintptr(i)<<40 | uintptrMask&(0x00c0<<32)
- *reserved = false
- p = uintptr(sysReserve(unsafe.Pointer(p), n, reserved))
- if p != 0 {
- return unsafe.Pointer(p)
- }
- }
-
- return sysReserve(nil, n, reserved)
-}
-
func (h *mheap) sysAlloc(n uintptr) unsafe.Pointer {
if n > h.arena_end-h.arena_used {
// We are in 32-bit mode, maybe we didn't use all possible address space yet.
// Reserve some more space.
p_size := round(n+_PageSize, 256<<20)
new_end := h.arena_end + p_size // Careful: can overflow
- if h.arena_end <= new_end && new_end <= h.arena_start+_MaxArena32 {
+ if h.arena_end <= new_end && new_end-h.arena_start-1 <= _MaxArena32 {
// TODO: It would be bad if part of the arena
// is reserved and part is not.
var reserved bool
@@ -404,7 +390,7 @@ func (h *mheap) sysAlloc(n uintptr) unsafe.Pointer {
if p == h.arena_end {
h.arena_end = new_end
h.arena_reserved = reserved
- } else if h.arena_start <= p && p+p_size <= h.arena_start+_MaxArena32 {
+ } else if h.arena_start <= p && p+p_size-h.arena_start-1 <= _MaxArena32 {
// Keep everything page-aligned.
// Our pages are bigger than hardware pages.
h.arena_end = p + p_size
@@ -441,23 +427,24 @@ func (h *mheap) sysAlloc(n uintptr) unsafe.Pointer {
}
// If using 64-bit, our reservation is all we have.
- if h.arena_end-h.arena_start >= _MaxArena32 {
+ if h.arena_end-h.arena_start > _MaxArena32 {
return nil
}
// On 32-bit, once the reservation is gone we can
// try to get memory at a location chosen by the OS
// and hope that it is in the range we allocated bitmap for.
+ // try to get memory at a location chosen by the OS.
p_size := round(n, _PageSize) + _PageSize
p := uintptr(sysAlloc(p_size, &memstats.heap_sys))
if p == 0 {
return nil
}
- if p < h.arena_start || uintptr(p)+p_size-h.arena_start >= _MaxArena32 {
+ if p < h.arena_start || p+p_size-h.arena_start > _MaxArena32 {
top := ^uintptr(0)
- if top-h.arena_start > _MaxArena32 {
- top = h.arena_start + _MaxArena32
+ if top-h.arena_start-1 > _MaxArena32 {
+ top = h.arena_start + _MaxArena32 + 1
}
print("runtime: memory allocated by OS (", hex(p), ") not in usable range [", hex(h.arena_start), ",", hex(top), ")\n")
sysFree(unsafe.Pointer(p), p_size, &memstats.heap_sys)
diff --git a/src/runtime/mbitmap.go b/src/runtime/mbitmap.go
index 336d4d8..9a5d83b 100644
--- a/src/runtime/mbitmap.go
+++ b/src/runtime/mbitmap.go
@@ -145,7 +145,7 @@ func (h *mheap) mapBits(arena_used uintptr) {
return
}
- sysMap(unsafe.Pointer(h.arena_start-n), n-h.bitmap_mapped, h.arena_reserved, &memstats.gc_sys)
+ sysMap(unsafe.Pointer(h.bitmap-n), n-h.bitmap_mapped, h.arena_reserved, &memstats.gc_sys)
h.bitmap_mapped = n
}
@@ -166,7 +166,7 @@ type heapBits struct {
func heapBitsForAddr(addr uintptr) heapBits {
// 2 bits per work, 4 pairs per byte, and a mask is hard coded.
off := (addr - mheap_.arena_start) / sys.PtrSize
- return heapBits{(*uint8)(unsafe.Pointer(mheap_.arena_start - off/4 - 1)), uint32(off & 3)}
+ return heapBits{(*uint8)(unsafe.Pointer(mheap_.bitmap - off/4 - 1)), uint32(off & 3)}
}
// heapBitsForSpan returns the heapBits for the span base address base.
diff --git a/src/runtime/mheap.go b/src/runtime/mheap.go
index a153df0..1db6a49 100644
--- a/src/runtime/mheap.go
+++ b/src/runtime/mheap.go
@@ -46,7 +46,7 @@ type mheap struct {
nsmallfree [_NumSizeClasses]uint64 // number of frees for small objects (<=maxsmallsize)
// range of addresses we might see in the heap
- bitmap uintptr
+ bitmap uintptr // Points to one byte past the end of the bitmap
bitmap_mapped uintptr
arena_start uintptr
arena_used uintptr // always mHeap_Map{Bits,Spans} before updating
@@ -217,6 +217,28 @@ func inheap(b uintptr) bool {
return true
}
+// inHeapOrStack is a variant of inheap that returns true for pointers into stack spans.
+//go:nowritebarrier
+//go:nosplit
+func inHeapOrStack(b uintptr) bool {
+ if b == 0 || b < mheap_.arena_start || b >= mheap_.arena_used {
+ return false
+ }
+ // Not a beginning of a block, consult span table to find the block beginning.
+ s := h_spans[(b-mheap_.arena_start)>>_PageShift]
+ if s == nil || b < s.base() {
+ return false
+ }
+ switch s.state {
+ case mSpanInUse:
+ return b < s.limit
+ case _MSpanStack:
+ return b < s.base()+s.npages<<_PageShift
+ default:
+ return false
+ }
+}
+
// TODO: spanOf and spanOfUnchecked are open-coded in a lot of places.
// Use the functions instead.

View File

@ -1 +1 @@
d1b50fa98d9a71eeee829051411e6207 go1.6.2.src.tar.gz
b023240be707b34059d2c114d3465c92 go1.6.4.src.tar.gz

34
tzdata-fix.patch Normal file
View File

@ -0,0 +1,34 @@
From c5434f2973a87acff76bac359236e690d632ce95 Mon Sep 17 00:00:00 2001
From: Alberto Donizetti <alb.donizetti@gmail.com>
Date: Thu, 29 Sep 2016 13:59:10 +0200
Subject: [PATCH] time: update test for tzdata-2016g
Fixes #17276
Change-Id: I0188cf9bc5fdb48c71ad929cc54206d03e0b96e4
Reviewed-on: https://go-review.googlesource.com/29995
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
---
src/time/time_test.go | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/time/time_test.go b/src/time/time_test.go
index 68236fd..2e47d08 100644
--- a/src/time/time_test.go
+++ b/src/time/time_test.go
@@ -943,8 +943,11 @@ func TestLoadFixed(t *testing.T) {
// but Go and most other systems use "east is positive".
// So GMT+1 corresponds to -3600 in the Go zone, not +3600.
name, offset := Now().In(loc).Zone()
- if name != "GMT+1" || offset != -1*60*60 {
- t.Errorf("Now().In(loc).Zone() = %q, %d, want %q, %d", name, offset, "GMT+1", -1*60*60)
+ // The zone abbreviation is "-01" since tzdata-2016g, and "GMT+1"
+ // on earlier versions; we accept both. (Issue #17276).
+ if !(name == "GMT+1" || name == "-01") || offset != -1*60*60 {
+ t.Errorf("Now().In(loc).Zone() = %q, %d, want %q or %q, %d",
+ name, offset, "GMT+1", "-01", -1*60*60)
}
}