Hello community, here is the log from the commit of package go1.6 for openSUSE:Factory checked in at 2017-10-17 01:53:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/go1.6 (Old) and /work/SRC/openSUSE:Factory/.go1.6.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "go1.6" Tue Oct 17 01:53:59 2017 rev:3 rq:534232 version:1.6.4 Changes: -------- --- /work/SRC/openSUSE:Factory/go1.6/go1.6.changes 2017-10-09 19:48:54.537770131 +0200 +++ /work/SRC/openSUSE:Factory/.go1.6.new/go1.6.changes 2017-10-17 01:53:59.802278936 +0200 @@ -1,0 +2,16 @@ +Fri Oct 13 15:42:59 UTC 2017 - [email protected] + +- Build with gcc7-go in openSUSE:Factory +- Added path: + * gcc7-go.patch + + execute %{_bindir}/go-7 instead of %{_bindir}/go + +------------------------------------------------------------------- +Tue Oct 10 13:40:30 UTC 2017 - [email protected] + +- Add patch to fix arbitrary code execution during “go get” or “go get -d” + (CVE-2017-15041). + bsc#1062085 + + cmd-go-reject-update-of-VCS-inside-VCS.patch + +------------------------------------------------------------------- New: ---- cmd-go-reject-update-of-VCS-inside-VCS.patch gcc7-go.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ go1.6.spec ++++++ --- /var/tmp/diff_new_pack.YKibBw/_old 2017-10-17 01:54:01.534197820 +0200 +++ /var/tmp/diff_new_pack.YKibBw/_new 2017-10-17 01:54:01.534197820 +0200 @@ -89,7 +89,9 @@ # PATCH-FIX-OPENSUSE fix_certificates_lookup.patch [email protected] -- this patch forces Go to look for certificates only in the openSUSE/SLE locations. It also fixes certificate loading on SLE11, see https://github.com/golang/go/issues/6391 # PATCH-FIX-SUSE fix_certificates_lookup.patch [email protected] -- this patch forces Go to look for certificates only in the openSUSE/SLE locations. It also fixes certificate loading on SLE11, see https://github.com/golang/go/issues/6391 Patch7: fix_certificates_lookup.patch -# PATCH-FIX-UPSTREAM [email protected] - find /usr/bin/go-5 when bootstrapping with gcc5-go +# PATCH-FIX-UPSTREAM [email protected] - find /usr/bin/go-7 when bootstrapping with gcc7-go +Patch8: gcc7-go.patch +# PATCH-FIX-UPSTREAM [email protected] - find /usr/bin/go-6 when bootstrapping with gcc6-go Patch9: gcc6-go.patch # PATCH-FIX-OPENSUSE: Bump _MaxGomaxprocs to a larger number for NUMA machines. Patch10: runtime-bump-MaxGomaxprocs.patch @@ -100,10 +102,16 @@ Patch12: fix-race-condition-bsc-1048899.diff # PATCH-FIX-UPSTREAM net/smtp: fix PlainAuth to refuse to send passwords to non-TLS servers Patch13: net-smtp-fix-PlainAuth-to-refuse-to-send-passwords-to-non-TLS-servers.patch +# PATCH-FIX-UPSTREAM cmd/go: reject update of VCS inside VCS +Patch14: cmd-go-reject-update-of-VCS-inside-VCS.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build # boostrap %if %{with_gccgo} +%if 0%{?suse_version} >= 1330 +BuildRequires: gcc7-go +%else BuildRequires: gcc6-go +%endif %else BuildRequires: go1.4 %endif @@ -162,12 +170,17 @@ %endif %patch7 -p1 %if %{with_gccgo} +%if 0%{?suse_version} >= 1330 +%patch8 -p1 +%else %patch9 -p1 %endif +%endif %patch10 -p1 %patch11 -p1 %patch12 -p1 %patch13 -p1 +%patch14 -p1 cp %{SOURCE4} . # setup go_arch (BSD-like scheme) ++++++ cmd-go-reject-update-of-VCS-inside-VCS.patch ++++++ >From a4544a0f8af001d1fb6df0e70750f570ec49ccf9 Mon Sep 17 00:00:00 2001 From: Russ Cox <[email protected]> Date: Fri, 22 Sep 2017 12:17:21 -0400 Subject: [PATCH] [release-branch.go1.8] cmd/go: reject update of VCS inside VCS Cherry-pick of CL 68110. Change-Id: Iae84c6404ab5eeb6950faa2364f97a017c67c506 Reviewed-on: https://go-review.googlesource.com/68190 Run-TryBot: Russ Cox <[email protected]> Reviewed-by: Chris Broadfoot <[email protected]> --- src/cmd/go/get.go | 5 +++++ src/cmd/go/go_test.go | 19 +++++++++++++++++ src/cmd/go/vcs.go | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 81 insertions(+), 1 deletion(-) Index: go/src/cmd/go/get.go =================================================================== --- go.orig/src/cmd/go/get.go +++ go/src/cmd/go/get.go @@ -45,7 +45,7 @@ missing packages but does not use it to Get also accepts build flags to control the installation. See 'go help build'. -When checking out a new package, get creates the target directory +When checking out a new package, get creates the target directory GOPATH/src/<import-path>. If the GOPATH contains multiple entries, get uses the first one. See 'go help gopath'. @@ -412,6 +412,11 @@ func downloadPackage(p *Package) error { p.build.PkgRoot = filepath.Join(list[0], "pkg") } root := filepath.Join(p.build.SrcRoot, rootPath) + + if err := checkNestedVCS(vcs, root, p.build.SrcRoot); err != nil { + return err + } + // If we've considered this repository already, don't do it again. if downloadRootCache[root] { return nil Index: go/src/cmd/go/go_test.go =================================================================== --- go.orig/src/cmd/go/go_test.go +++ go/src/cmd/go/go_test.go @@ -1226,6 +1226,25 @@ func TestGetGitDefaultBranch(t *testing. tg.grepStdout(`\* another-branch`, "not on correct default branch") } +func TestAccidentalGitCheckout(t *testing.T) { + testenv.MustHaveExternalNetwork(t) + if _, err := exec.LookPath("git"); err != nil { + t.Skip("skipping because git binary not found") + } + + tg := testgo(t) + defer tg.cleanup() + tg.parallel() + tg.tempDir("src") + tg.setenv("GOPATH", tg.path(".")) + + tg.runFail("get", "-u", "vcs-test.golang.org/go/test1-svn-git") + tg.grepStderr("src[\\\\/]vcs-test.* uses git, but parent .*src[\\\\/]vcs-test.* uses svn", "get did not fail for right reason") + + tg.runFail("get", "-u", "vcs-test.golang.org/go/test2-svn-git/test2main") + tg.grepStderr("src[\\\\/]vcs-test.* uses git, but parent .*src[\\\\/]vcs-test.* uses svn", "get did not fail for right reason") +} + func TestDisallowedCSourceFiles(t *testing.T) { tg := testgo(t) defer tg.cleanup() Index: go/src/cmd/go/vcs.go =================================================================== --- go.orig/src/cmd/go/vcs.go +++ go/src/cmd/go/vcs.go @@ -492,11 +492,28 @@ func vcsForDir(p *Package) (vcs *vcsCmd, return nil, "", fmt.Errorf("directory %q is outside source root %q", dir, srcRoot) } + var vcsRet *vcsCmd + var rootRet string + origDir := dir for len(dir) > len(srcRoot) { for _, vcs := range vcsList { if fi, err := os.Stat(filepath.Join(dir, "."+vcs.cmd)); err == nil && fi.IsDir() { - return vcs, dir[len(srcRoot)+1:], nil + root := filepath.ToSlash(dir[len(srcRoot)+1:]) + // Record first VCS we find, but keep looking, + // to detect mistakes like one kind of VCS inside another. + if vcsRet == nil { + vcsRet = vcs + rootRet = root + continue + } + // Allow .git inside .git, which can arise due to submodules. + if vcsRet == vcs && vcs.cmd == "git" { + continue + } + // Otherwise, we have one VCS inside a different VCS. + return nil, "", fmt.Errorf("directory %q uses %s, but parent %q uses %s", + filepath.Join(srcRoot, rootRet), vcsRet.cmd, filepath.Join(srcRoot, root), vcs.cmd) } } @@ -509,9 +526,48 @@ func vcsForDir(p *Package) (vcs *vcsCmd, dir = ndir } + if vcsRet != nil { + return vcsRet, rootRet, nil + } + return nil, "", fmt.Errorf("directory %q is not using a known version control system", origDir) } +// checkNestedVCS checks for an incorrectly-nested VCS-inside-VCS +// situation for dir, checking parents up until srcRoot. +func checkNestedVCS(vcs *vcsCmd, dir, srcRoot string) error { + if len(dir) <= len(srcRoot) || dir[len(srcRoot)] != filepath.Separator { + return fmt.Errorf("directory %q is outside source root %q", dir, srcRoot) + } + + otherDir := dir + for len(otherDir) > len(srcRoot) { + for _, otherVCS := range vcsList { + if _, err := os.Stat(filepath.Join(dir, "."+otherVCS.cmd)); err == nil { + // Allow expected vcs in original dir. + if otherDir == dir && otherVCS == vcs { + continue + } + // Allow .git inside .git, which can arise due to submodules. + if otherVCS == vcs && vcs.cmd == "git" { + continue + } + // Otherwise, we have one VCS inside a different VCS. + return fmt.Errorf("directory %q uses %s, but parent %q uses %s", dir, vcs.cmd, otherDir, otherVCS.cmd) + } + } + // Move to parent. + newDir := filepath.Dir(otherDir) + if len(newDir) >= len(otherDir) { + // Shouldn't happen, but just in case, stop. + break + } + otherDir = newDir + } + + return nil +} + // repoRoot represents a version control system, a repo, and a root of // where to put it on disk. type repoRoot struct { ++++++ gcc7-go.patch ++++++ diff --git a/src/make.bash b/src/make.bash index 2531ca4..12f1aa1 100755 --- a/src/make.bash +++ b/src/make.bash @@ -112,8 +112,8 @@ 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/go-7" ]; then + echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/go-7." >&2 echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4." >&2 exit 1 fi @@ -123,7 +123,7 @@ if [ "$GOROOT_BOOTSTRAP" == "$GOROOT" ]; then exit 1 fi rm -f cmd/dist/dist -GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist +GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" "$GOROOT_BOOTSTRAP/bin/go-7" 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) diff --git a/src/make.rc b/src/make.rc index 6016204..2223092 100755 --- a/src/make.rc +++ b/src/make.rc @@ -46,13 +46,13 @@ echo cmd/dist GOROOT = `{cd .. && pwd} if(! ~ $#GOROOT_BOOTSTRAP 1) GOROOT_BOOTSTRAP = $home/go1.4 -if(! test -x $GOROOT_BOOTSTRAP/bin/go){ - echo 'ERROR: Cannot find '$GOROOT_BOOTSTRAP'/bin/go.' >[1=2] +if(! test -x $GOROOT_BOOTSTRAP/bin/go-7){ + echo 'ERROR: Cannot find '$GOROOT_BOOTSTRAP'/bin/go-7.' >[1=2] echo 'Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.' >[1=2] exit bootstrap } rm -f cmd/dist/dist -GOROOT=$GOROOT_BOOTSTRAP GOOS='' GOARCH='' $GOROOT_BOOTSTRAP/bin/go build -o cmd/dist/dist ./cmd/dist +GOROOT=$GOROOT_BOOTSTRAP GOOS='' GOARCH='' $GOROOT_BOOTSTRAP/bin/go-7 build -o cmd/dist/dist ./cmd/dist eval `{./cmd/dist/dist env -9} echo diff --git a/src/cmd/dist/buildtool.go b/src/cmd/dist/buildtool.go index 20d9535..26cfb20 100644 --- a/src/cmd/dist/buildtool.go +++ b/src/cmd/dist/buildtool.go @@ -111,7 +111,7 @@ func bootstrapBuildTools() { os.Setenv("GOHOSTARCH", "") // Run Go 1.4 to build binaries. - run(workspace, ShowOutput|CheckExit, pathf("%s/bin/go", goroot_bootstrap), "install", "-v", "bootstrap/...") + run(workspace, ShowOutput|CheckExit, pathf("%s/bin/go-7", goroot_bootstrap), "install", "-v", "bootstrap/...") // Copy binaries into tool binary directory. for _, name := range bootstrapDirs {
