From 263126ff1b1a04f81d5c145d4ad1c335d2e634d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Cajka?= Date: Mon, 22 Feb 2016 16:02:43 +0100 Subject: [PATCH] Resolves: bz1304701 - rebase to go1.6 release Resolves: bz1304591 - fix possible stack miss-alignment in callCgoMmap --- .gitignore | 1 + golang.spec | 14 +++++++++++-- mmap-cgo-stackalign.patch | 43 +++++++++++++++++++++++++++++++++++++++ sources | 2 +- 4 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 mmap-cgo-stackalign.patch diff --git a/.gitignore b/.gitignore index 5b86319..6672c7e 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ /Mark.Twain-Tom.Sawyer.txt.bz2 /go1.5.3.src.tar.gz /go1.6rc1.src.tar.gz +/go1.6.src.tar.gz diff --git a/golang.spec b/golang.spec index fb6ad1d..99b955a 100644 --- a/golang.spec +++ b/golang.spec @@ -86,12 +86,12 @@ Name: golang Version: 1.6 -Release: 0.3.rc1%{?dist} +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/go1.6rc1.src.tar.gz +Source0: https://storage.googleapis.com/golang/go%{go_version}.src.tar.gz # The compiler is written in Go. Needs go(1.4+) compiler for build. %if !%{golang_bootstrap} @@ -117,6 +117,10 @@ Patch0: golang-1.2-verbose-build.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1038683 Patch1: golang-1.2-remove-ECC-p224.patch +# Resolves RHBZ 1304591 +# https://github.com/golang/go/issues/14384 +Patch100: mmap-cgo-stackalign.patch + # use the arch dependent path in the bootstrap Patch212: golang-1.5-bootstrap-binary-path.patch @@ -243,6 +247,8 @@ Summary: Golang shared object libraries # remove the P224 curve %patch1 -p1 +%patch100 -p1 + # use the arch dependent path in the bootstrap %patch212 -p1 @@ -463,6 +469,10 @@ fi %endif %changelog +* Mon Feb 22 2016 Jakub Čajka - 1.6-1 +- Resolves: bz1304701 - rebase to go1.6 release +- Resolves: bz1304591 - fix possible stack miss-alignment in callCgoMmap + * Wed Feb 03 2016 Fedora Release Engineering - 1.6-0.3.rc1 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild diff --git a/mmap-cgo-stackalign.patch b/mmap-cgo-stackalign.patch new file mode 100644 index 0000000..78e276f --- /dev/null +++ b/mmap-cgo-stackalign.patch @@ -0,0 +1,43 @@ +From 315f4c70f123cfbf061d097543af555547acd9c7 Mon Sep 17 00:00:00 2001 +From: Shenghou Ma +Date: Thu, 18 Feb 2016 16:29:39 -0500 +Subject: [PATCH] runtime: use correct psABI SP alignment before calling libc + mmap + +Fixes #14384. + +Change-Id: Ib025cf2d20754b4c2db52f0a8a4717fd303371d6 +Reviewed-on: https://go-review.googlesource.com/19660 +Run-TryBot: Minux Ma +TryBot-Result: Gobot Gobot +Reviewed-by: Ian Lance Taylor +Reviewed-by: Austin Clements +--- + src/runtime/sys_linux_amd64.s | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s +index aed85cb..f407078 100644 +--- a/src/runtime/sys_linux_amd64.s ++++ b/src/runtime/sys_linux_amd64.s +@@ -258,7 +258,7 @@ TEXT runtime·sysMmap(SB),NOSPLIT,$0 + + // Call the function stored in _cgo_mmap using the GCC calling convention. + // This must be called on the system stack. +-TEXT runtime·callCgoMmap(SB),NOSPLIT,$0 ++TEXT runtime·callCgoMmap(SB),NOSPLIT,$16 + MOVQ addr+0(FP), DI + MOVQ n+8(FP), SI + MOVL prot+16(FP), DX +@@ -266,7 +266,11 @@ TEXT runtime·callCgoMmap(SB),NOSPLIT,$0 + MOVL fd+24(FP), R8 + MOVL off+28(FP), R9 + MOVQ _cgo_mmap(SB), AX ++ MOVQ SP, BX ++ ANDQ $~15, SP // alignment as per amd64 psABI ++ MOVQ BX, 0(SP) + CALL AX ++ MOVQ 0(SP), SP + MOVQ AX, ret+32(FP) + RET + diff --git a/sources b/sources index 9529433..b55b080 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -fa18b0a0036159902f8178513bbc6022 go1.6rc1.src.tar.gz +e67833ea37fbc002fbe38efe6c1bcd98 go1.6.src.tar.gz