]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
5 years ago[release-branch.go1.10-security] go1.10.8 go1.10.8
Julie Qiu [Wed, 23 Jan 2019 19:08:07 +0000 (14:08 -0500)]
[release-branch.go1.10-security] go1.10.8

Change-Id: Ie18399a328452f61b232a6929ecf53cb79306773
Reviewed-on: https://team-review.git.corp.google.com/c/400910
Reviewed-by: Filippo Valsorda <valsorda@google.com>
5 years ago[release-branch.go1.10-security] net: pass if at least one matching entry in TestLook...
Ian Lance Taylor [Fri, 11 Jan 2019 22:26:24 +0000 (14:26 -0800)]
[release-branch.go1.10-security] net: pass if at least one matching entry in TestLookupGmailTXT

Fixes #29698

Change-Id: I0531c0a274b120af8871aa2f5975744ff6c912a3
Reviewed-on: https://go-review.googlesource.com/c/157638
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://team-review.git.corp.google.com/c/401204
Reviewed-by: Filippo Valsorda <valsorda@google.com>
5 years ago[release-branch.go1.10-security] doc: document Go 1.10.8
Julie Qiu [Wed, 23 Jan 2019 17:39:16 +0000 (12:39 -0500)]
[release-branch.go1.10-security] doc: document Go 1.10.8

Change-Id: I97ce42e1e9a6d10bf1eeccc2763e043d8ebe5bab
Reviewed-on: https://team-review.git.corp.google.com/c/400906
Reviewed-by: Filippo Valsorda <valsorda@google.com>
(cherry picked from commit efe766c7c0918da96aa21e1ac03a9d3fa57ca156)
Reviewed-on: https://team-review.git.corp.google.com/c/400907

5 years ago[release-branch.go1.10-security] crypto/elliptic: reduce subtraction term to prevent...
Filippo Valsorda [Tue, 22 Jan 2019 21:02:41 +0000 (16:02 -0500)]
[release-branch.go1.10-security] crypto/elliptic: reduce subtraction term to prevent long busy loop

If beta8 is unusually large, the addition loop might take a very long
time to bring x3-beta8 back positive.

This would lead to a DoS vulnerability in the implementation of the
P-521 and P-384 elliptic curves that may let an attacker craft inputs
to ScalarMult that consume excessive amounts of CPU.

This fixes CVE-2019-6486.

Change-Id: Ia969e8b5bf5ac4071a00722de9d5e4d856d8071a
Reviewed-on: https://team-review.git.corp.google.com/c/399777
Reviewed-by: Adam Langley <agl@google.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
(cherry picked from commit 746d6abe2dfb9ce7609f8e1e1a8dcb7e221f423e)
Reviewed-on: https://team-review.git.corp.google.com/c/401143
Reviewed-by: Filippo Valsorda <valsorda@google.com>
5 years ago[release-branch.go1.10] go1.10.7 go1.10.7
Filippo Valsorda [Fri, 14 Dec 2018 22:44:26 +0000 (17:44 -0500)]
[release-branch.go1.10] go1.10.7

Change-Id: Ic9020b53da56c34250801e996248edbd3a4c632e
Reviewed-on: https://go-review.googlesource.com/c/154308
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years ago[release-branch.go1.10] doc: document Go 1.10.7
Filippo Valsorda [Fri, 14 Dec 2018 21:14:56 +0000 (16:14 -0500)]
[release-branch.go1.10] doc: document Go 1.10.7

Change-Id: Id71aad4cf6149e0ba15f7fec0b74517827c37866
Reviewed-on: https://go-review.googlesource.com/c/154303
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
(cherry picked from commit 84bf9ce1fbe7ae8424031550d9cf3fe6b27575e3)
Reviewed-on: https://go-review.googlesource.com/c/154305

5 years agoRevert "[release-branch.go1.10] cmd/compile/internal/gc: OMUL should be evaluated...
Filippo Valsorda [Fri, 14 Dec 2018 19:53:47 +0000 (19:53 +0000)]
Revert "[release-branch.go1.10] cmd/compile/internal/gc: OMUL should be evaluated when using soft-float"

This reverts commit d74e69c7553fcb1e057821a089dc4f2c60f42e5d.

Reason for revert: this fix has been backported to 1.11, and that makes
it ineligible for backport to 1.10, since upgrading to 1.11 is a valid
workaround according to https://github.com/golang/go/wiki/MinorReleases.

Also, this triggers a bug on Wasm that would require a backport of
CL 149965, too.

Updates #28688
Updates #28959

Change-Id: I4e56554ea27b5db83bdb1e9d2103dd24e3da8cfc
Reviewed-on: https://go-review.googlesource.com/c/154297
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>

5 years ago[release-branch.go1.10] cmd/compile/internal/gc: OMUL should be evaluated when using...
Milan Knezevic [Fri, 9 Nov 2018 17:30:46 +0000 (18:30 +0100)]
[release-branch.go1.10] cmd/compile/internal/gc: OMUL should be evaluated when using soft-float

When using soft-float, OMUL might be rewritten to function call
so we should ensure it was evaluated first.

Updates #28688
Fixes #28959

Change-Id: I30b87501782fff62d35151f394a1c22b0d490c6c
Reviewed-on: https://go-review.googlesource.com/c/148837
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
(cherry picked from commit c92e73b70253f5d88c473a7ad6c5b8d61b2debb7)
Reviewed-on: https://go-review.googlesource.com/c/151343
Reviewed-by: Filippo Valsorda <filippo@golang.org>
5 years ago[release-branch.go1.10] cmd/go/internal/get: move wildcard-trimming to before CheckIm...
Bryan C. Mills [Fri, 14 Dec 2018 02:42:33 +0000 (21:42 -0500)]
[release-branch.go1.10] cmd/go/internal/get: move wildcard-trimming to before CheckImportPath

Previously, RepoRootForImportPath trimmed certain "..." wildcards from
package patterns (even though its name suggests that the argument must
be an actual import path). It trimmed at the first path element that
was literally "..." (although wildcards in general may appear within a
larger path element), and relied on a subsequent check in
RepoRootForImportPath to catch confusing resolutions.

However, that causes 'go get' with wildcard patterns in fresh paths to
fail as of CL 154101: a wildcard pattern is not a valid import path,
and fails the path check. (The existing Test{Vendor,Go}Get* packages
in go_test.go and vendor_test.go catch the failure, but they are all
skipped when the "-short" flag is set — including in all.bash — and we
had forgotten to run them separately.)

We now trim the path before any element that contains a wildcard, and
perform the path check (and repo resolution) on only that prefix. It
is possible that the expanded path after fetching the repo will be
invalid, but a repository can contain directories that are not valid
import paths in general anyway.

Fixes #29247

Change-Id: I70fb2f7fc6603b7d339fd6c02e8cdeacfc93fc4b
Reviewed-on: https://go-review.googlesource.com/c/154108
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/154111
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
5 years ago[release-branch.go1.10] all: merge release-branch.go1.10-security into release-branch...
Dmitri Shuralyov [Thu, 13 Dec 2018 22:08:33 +0000 (17:08 -0500)]
[release-branch.go1.10] all: merge release-branch.go1.10-security into release-branch.go1.10

Change-Id: I7048387350b683030d9f3106979370b0d096ea38

5 years ago[release-branch.go1.10-security] go1.10.6 go1.10.6
Dmitri Shuralyov [Thu, 13 Dec 2018 17:07:16 +0000 (12:07 -0500)]
[release-branch.go1.10-security] go1.10.6

Change-Id: I1a05884b2df711da15d2ca3f09fcb6fc4a3264c7
Reviewed-on: https://team-review.git.corp.google.com/c/377324
Reviewed-by: Andrew Bonventre <andybons@google.com>
5 years ago[release-branch.go1.10-security] doc: document Go 1.10.6
Dmitri Shuralyov [Wed, 12 Dec 2018 18:35:19 +0000 (13:35 -0500)]
[release-branch.go1.10-security] doc: document Go 1.10.6

Change-Id: I3fe44887a84586d73be01df78a9cbb002c1fc9c5
Reviewed-on: https://team-review.git.corp.google.com/c/376467
Reviewed-by: Filippo Valsorda <valsorda@google.com>
5 years ago[release-branch.go1.10-security] cmd/go/internal/get: relax pathOK check to allow...
Bryan C. Mills [Tue, 4 Dec 2018 22:00:19 +0000 (17:00 -0500)]
[release-branch.go1.10-security] cmd/go/internal/get: relax pathOK check to allow any letter

This fixes a regression of #18660 with the new path checks.

Change-Id: I07cd248392ba8f5f9b1614b79a323cca1ad1d46d
Reviewed-on: https://team-review.git.corp.google.com/c/372708
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
5 years ago[release-branch.go1.10-security] cmd/go/internal/get: use a strings.Replacer in expand
Bryan C. Mills [Tue, 4 Dec 2018 20:42:32 +0000 (15:42 -0500)]
[release-branch.go1.10-security] cmd/go/internal/get: use a strings.Replacer in expand

This should be a no-op, but produces deterministic (and more correct)
behavior if we have accidentally failed to sanitize one of the inputs.

Change-Id: I1271d0ffd01a691ec8c84906c4e02d9e2be19c72
Reviewed-on: https://team-review.git.corp.google.com/c/372707
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
5 years ago[release-branch.go1.10-security] cmd/go/internal/get: reject Windows shortnames as...
Bryan C. Mills [Tue, 4 Dec 2018 19:37:39 +0000 (14:37 -0500)]
[release-branch.go1.10-security] cmd/go/internal/get: reject Windows shortnames as path components

Change-Id: Ia32d8ec1fc0c4e242f50d8871c0ef3ce315f3c65
Reviewed-on: https://team-review.git.corp.google.com/c/370573
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
5 years ago[release-branch.go1.10-security] cmd/go: reject 'get' of paths containing leading...
Bryan C. Mills [Mon, 3 Dec 2018 20:12:08 +0000 (15:12 -0500)]
[release-branch.go1.10-security] cmd/go: reject 'get' of paths containing leading dots or unsupported characters

On some platforms, directories beginning with dot are treated as
hidden files, and filenames containing unusual characters can be
confusing for users to manipulate (and delete).

Change-Id: I443bdeb98e4de24b8a93a75fb923f4d41052e8f7
Reviewed-on: https://team-review.git.corp.google.com/c/368703
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
5 years ago[release-branch.go1.10-security] crypto/x509: limit number of signature checks for...
Filippo Valsorda [Wed, 5 Dec 2018 03:23:22 +0000 (22:23 -0500)]
[release-branch.go1.10-security] crypto/x509: limit number of signature checks for each verification

That number grows quadratically with the number of intermediate
certificates in certain pathological cases (for example if they all have
the same Subject) leading to a CPU DoS. Set a fixed budget that should
fit all real world chains, given we only look at intermediates provided
by the peer.

The algorithm can be improved, but that's left for follow-up CLs:

    * the cache logic should be reviewed for correctness, as it seems to
      override the entire chain with the cached one
    * the equality check should compare Subject and public key, not the
      whole certificate
    * certificates with the right SKID but the wrong Subject should not
      be considered, and in particular should not take priority over
      certificates with the right Subject

Change-Id: Ib257c12cd5563df7723f9c81231d82b882854213
Reviewed-on: https://team-review.git.corp.google.com/c/370475
Reviewed-by: Andrew Bonventre <andybons@google.com>
(cherry picked from commit 09d57361bc99cbbfb9755ee30ddcb42ff5a9d7d6)
Reviewed-on: https://team-review.git.corp.google.com/c/372923
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
5 years ago[release-branch.go1.10] go1.10.5 go1.10.5
Andrew Bonventre [Fri, 2 Nov 2018 19:55:05 +0000 (15:55 -0400)]
[release-branch.go1.10] go1.10.5

Change-Id: Ibad4471510ea8546954c4361424daadb845b2f3f
Reviewed-on: https://go-review.googlesource.com/c/147183
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years ago[release-branch.go1.10] doc: document Go 1.10.5
Andrew Bonventre [Fri, 2 Nov 2018 19:31:37 +0000 (15:31 -0400)]
[release-branch.go1.10] doc: document Go 1.10.5

Change-Id: I11adca150ab795607b832fb354a3e065655e1020
Reviewed-on: https://go-review.googlesource.com/c/147179
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 2764d5ee7b23ae1caf2a4cd4506116a1b9efbf66)
Reviewed-on: https://go-review.googlesource.com/c/147180
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years ago[release-branch.go1.10] cmd/internal/obj/arm64: fix branch-too-far with TBZ like...
Cherry Zhang [Sat, 17 Feb 2018 15:31:39 +0000 (10:31 -0500)]
[release-branch.go1.10] cmd/internal/obj/arm64: fix branch-too-far with TBZ like instructions

The compiler now emits TBZ like instructions, but the assembler's
too-far-branch patch code didn't include that case. Add it.

Updates #23889
Fixes #25794

Change-Id: Ib75f9250c660b9fb652835fbc83263a5d5073dc5
Reviewed-on: https://go-review.googlesource.com/94902
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
(cherry picked from commit 911839c1f462260db0f001f8e017f10f688d2270)
Reviewed-on: https://go-review.googlesource.com/c/147057
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>

5 years ago[release-branch.go1.10] internal/poll: advance file position in windows sendfile
Alex Brainman [Sun, 26 Aug 2018 06:45:10 +0000 (16:45 +1000)]
[release-branch.go1.10] internal/poll: advance file position in windows sendfile

Some versions of Windows (Windows 10 1803) do not set file
position after TransmitFile completes. So just use Seek
to set file position before returning from sendfile.

Updates #25722
Fixes #27419

Change-Id: I7a49be10304b5db19dda707b13ac93d338aeb190
Reviewed-on: https://go-review.googlesource.com/131976
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
(cherry picked from commit 8359b5e134052db0e5f1bc2257d496b0a81aa4fb)
Reviewed-on: https://go-review.googlesource.com/c/146779
Run-TryBot: Ian Lance Taylor <iant@golang.org>

5 years ago[release-branch.go1.10] database/sql: check for nil connRequest.conn before use
Daniel Theophanes [Sun, 25 Mar 2018 23:58:27 +0000 (16:58 -0700)]
[release-branch.go1.10] database/sql: check for nil connRequest.conn before use

The connRequest may return a nil conn value. However in a rare
case that is difficult to test for it was being passed to
DB.putConn without a nil check. This was an error as this
made no sense if the driverConn is nil. This also caused
a panic in putConn.

A test for this would be nice, but didn't find a sane
way to test for this condition.

Updates #24445
Fixes #25235

Change-Id: I827316e856788a5a3ced913f129bb5869b7bcf68
Reviewed-on: https://go-review.googlesource.com/102477
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexey Palazhchenko <alexey.palazhchenko@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit b98ffdf859f0fec2acb1765bf5b62ce1e4587c2b)
Reviewed-on: https://go-review.googlesource.com/c/146778
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
5 years ago[release-branch.go1.10] internal/poll, net: fix sendfile on Windows, add test
Ian Lance Taylor [Thu, 1 Nov 2018 21:44:06 +0000 (14:44 -0700)]
[release-branch.go1.10] internal/poll, net: fix sendfile on Windows, add test

Cherry pick of CL 130855, done manually to avoid a merge conflict on the test.

Fixes #27085

Change-Id: I7c4939cf5db23253a824c46c3f00fab4edec86b4
Reviewed-on: https://go-review.googlesource.com/c/146797
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years ago[release-branch.go1.10] cmd/go: remove test that does nothing in 1.10
Ian Lance Taylor [Thu, 1 Nov 2018 21:24:16 +0000 (14:24 -0700)]
[release-branch.go1.10] cmd/go: remove test that does nothing in 1.10

1.10 has no cmd/go/testdata/script directory.

Change-Id: I8985d457e8d6d0c8aeff9c17375f3c872593ab92
Reviewed-on: https://go-review.googlesource.com/c/146781
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years ago[release-branch.go1.10] internal/poll: specify current file position when calling...
Alex Brainman [Mon, 11 Jun 2018 02:09:18 +0000 (12:09 +1000)]
[release-branch.go1.10] internal/poll: specify current file position when calling TransmitFile

Current SendFile implementation assumes that TransmitFile starts from
the current file position. But that appears not true for Windows 10
Version 1803.

TransmitFile documentation

https://msdn.microsoft.com/en-us/library/windows/desktop/ms740565(v=vs.85).aspx

suggests, "You can use the lpOverlapped parameter to specify a 64-bit
offset within the file at which to start the file data transfer by
setting the Offset and OffsetHigh member of the OVERLAPPED structure."

Do as it advises.

Fixes #25722

Change-Id: I241d3bf76d0d5590d4df27c6f922d637068232fb
Reviewed-on: https://go-review.googlesource.com/117816
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit af4d60428f6dc5eab10b6de23235f61cceee8bc3)
Reviewed-on: https://go-review.googlesource.com/c/146780
Run-TryBot: Ian Lance Taylor <iant@golang.org>

5 years ago[release-branch.go1.10] cmd/compile: prevent overflow in walkinrange
Alberto Donizetti [Wed, 22 Aug 2018 12:01:22 +0000 (14:01 +0200)]
[release-branch.go1.10] cmd/compile: prevent overflow in walkinrange

In the compiler frontend, walkinrange indiscriminately calls Int64()
on const CTINT nodes, even though Int64's return value is undefined
for anything over 2⁶³ (in practise, it'll return a negative number).

This causes the introduction of bad constants during rewrites of
unsigned expressions, which make the compiler reject valid Go
programs.

This change introduces a preliminary check that Int64() is safe to
call on the consts on hand. If it isn't, walkinrange exits without
doing any rewrite.

Fixes #27247

Change-Id: I2017073cae65468a521ff3262d4ea8ab0d7098d9
Reviewed-on: https://go-review.googlesource.com/130735
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
(cherry picked from commit 42cc4ca30a7729a4c6d1bb0bbbc3e4a736ef91c8)
Reviewed-on: https://go-review.googlesource.com/c/131595
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years ago[release-branch.go1.10] cmd/go: add GOMIPS value to build id for mipsle
Ian Lance Taylor [Mon, 27 Aug 2018 03:38:43 +0000 (20:38 -0700)]
[release-branch.go1.10] cmd/go: add GOMIPS value to build id for mipsle

Strip a trailing "le" from the GOARCH value when calculating the GOxxx
environment variable that affects it.

Updates #27260
Fixes #27421

Change-Id: I081f30d5dc19281901551823f4f56be028b5f71a
Reviewed-on: https://go-review.googlesource.com/131379
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 61318d7ffe8a49e9dedc5aa8195a164a3821465c)
Reviewed-on: https://go-review.googlesource.com/c/146560
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years ago[release-branch.go1.10] runtime: restore r2 when restoring state from gobuf in gogo...
Lynn Boger [Fri, 8 Jun 2018 15:07:18 +0000 (11:07 -0400)]
[release-branch.go1.10] runtime: restore r2 when restoring state from gobuf in gogo on ppc64x

When using plugins with goroutines calling cgo, we hit a case where
an intermittent SIGSEGV occurs when referencing an address that is based
on r2 (TOC address). When the failure can be generated in gdb, the
contents of r2 is wrong even though the value in the current stack's
slot for r2 is correct. So that means it somehow switched to start
running the code in this function without passing through the beginning
of the function which had the correct value of r2 and stored it there.

It was noted that in runtime.gogo when the state is restored from
gobuf, r2 is not restored from its slot on the stack. Adding the
instruction to restore r2 prevents the SIGSEGV.

Fixes #25800

Change-Id: I6028b6f1f8775d5c23f4ebb57ae273330a28eb8f
Reviewed-on: https://go-review.googlesource.com/117515
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
(cherry picked from commit 30a63ecee351c029ea99dce388a5953a150b4e02)
Reviewed-on: https://go-review.googlesource.com/c/117915
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years ago[release-branch.go1.10] cmd/link: put runtime.framepointer_enabled in DATA instead...
Cherry Zhang [Wed, 4 Apr 2018 16:12:10 +0000 (12:12 -0400)]
[release-branch.go1.10] cmd/link: put runtime.framepointer_enabled in DATA instead of RODATA

On darwin, only writable symbol is exported
(cmd/link/internal/ld/macho.go:/machoShouldExport).
For plugin to work correctly, global variables, including
runtime.framepointer_enabled which is set by the linker, need
to be exported when dynamic linking. Put it in DATA so it is
exported. Also in Go it is defined as a var, which is not
read-only.

While here, do the same for runtime.goarm.

Fixes #25038.

Change-Id: I9d1b7d5a648be17103d20b97be65a901cb69f5a2
Reviewed-on: https://go-review.googlesource.com/104715
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/122116
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years ago[release-branch.go1.10] cmd/go: add -Wl,--export-dynamic to linker flag whitelist
Ian Lance Taylor [Fri, 7 Sep 2018 11:12:42 +0000 (04:12 -0700)]
[release-branch.go1.10] cmd/go: add -Wl,--export-dynamic to linker flag whitelist

Fixes #27496

Change-Id: I53538c7697729294a9e50ace26a6a7183131e837
Reviewed-on: https://go-review.googlesource.com/134016
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
(cherry picked from commit ceb7745cc846f798531ef019162dd9f1dabfea12)
Reviewed-on: https://go-review.googlesource.com/134135

5 years ago[release-branch.go1.10] go1.10.4 go1.10.4
Andrew Bonventre [Fri, 24 Aug 2018 19:24:34 +0000 (15:24 -0400)]
[release-branch.go1.10] go1.10.4

Change-Id: Idef60b8ac0411bacc09e98b0a79a7df7279d76bc
Reviewed-on: https://go-review.googlesource.com/131337
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years ago[release-branch.go1.10] doc: document Go 1.10.4
Andrew Bonventre [Fri, 24 Aug 2018 19:20:33 +0000 (15:20 -0400)]
[release-branch.go1.10] doc: document Go 1.10.4

Change-Id: I7383e7d37a71defcad79fc662c4b4d1ca02189d1
Reviewed-on: https://go-review.googlesource.com/131336
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 74ac46d5a4f33f5da9c5a16b070ec2331ec4e7c9)
Reviewed-on: https://go-review.googlesource.com/131355
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years ago[release-branch.go1.10] cmd/compile: fix zero extend after float->int conversion
Keith Randall [Thu, 10 May 2018 17:15:52 +0000 (10:15 -0700)]
[release-branch.go1.10] cmd/compile: fix zero extend after float->int conversion

Don't do direct loads from argument slots if the sizes don't match.
This prevents us from loading from a float32 using a uint64 load
during expressions like uint64(math.float32Bits(f)) where f is a float32 arg.

Fixes #25335

Change-Id: I3887d76f78c844ba546243e7721d811c3d4a9700
Reviewed-on: https://go-review.googlesource.com/112637
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/131276
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years ago[release-branch.go1.10] net/http: lock the read-only mutex in shouldRedirect
Damien Mathieu [Thu, 22 Feb 2018 08:17:15 +0000 (08:17 +0000)]
[release-branch.go1.10] net/http: lock the read-only mutex in shouldRedirect

Since that method uses `mux.m`, we need to lock the mutex to avoid data races.

Fixes #27129

Change-Id: I998448a6e482b5d6a1b24f3354bb824906e23172
Reviewed-on: https://go-review.googlesource.com/95775
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years ago[release-branch.go1.10] cmd/link: treat cgo exported symbols as C symbols
Ian Lance Taylor [Mon, 11 Jun 2018 23:46:23 +0000 (16:46 -0700)]
[release-branch.go1.10] cmd/link: treat cgo exported symbols as C symbols

Fixes #25827

Change-Id: I6736c3ac061ca32aac2eb68b01ba53a179d68cf4
Reviewed-on: https://go-review.googlesource.com/118076
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
(cherry picked from commit f861f66d1db9f1abcdf91fc54d0d84bd3f9e9310)
Reviewed-on: https://go-review.googlesource.com/126455
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years ago[release-branch.go1.10] cmd/compile: reset branch prediction when deleting a branch
Keith Randall [Mon, 22 Jan 2018 17:43:27 +0000 (09:43 -0800)]
[release-branch.go1.10] cmd/compile: reset branch prediction when deleting a branch

When we go from a branch block to a plain block, reset the
branch prediction bit. Downstream passes asssume that if the
branch prediction is set, then the block has 2 successors.

Fixes #23504
Fixes #26851

Change-Id: I2898ec002228b2e34fe80ce420c6939201c0a5aa
Reviewed-on: https://go-review.googlesource.com/88955
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
(cherry picked from commit 4313d7767d830e863e8f8b53a2b48ca8d0bf0a79)
Reviewed-on: https://go-review.googlesource.com/128855
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years ago[release-branch.go1.10] cmd/cgo: don't give inconsistent typedef error for cgo-define...
Ian Lance Taylor [Wed, 1 Aug 2018 19:51:19 +0000 (12:51 -0700)]
[release-branch.go1.10] cmd/cgo: don't give inconsistent typedef error for cgo-defined types

The cgo tool predefines some C types such as C.uint. Don't give an
error if the type that cgo defines does not match the type in a header file.

Fixes #26743

Change-Id: I9ed3b4c482b558d8ffa8bf61eb3209415b7a9e3c
Reviewed-on: https://go-review.googlesource.com/127356
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
(cherry picked from commit c29370c98ecfc7aa59f32c7a7897e50a0f6eb86b)
Reviewed-on: https://go-review.googlesource.com/128396
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years ago[release-branch.go1.10] cmd/cgo: don't resolve typedefs in -godefs mode
Ian Lance Taylor [Wed, 25 Jul 2018 22:24:27 +0000 (15:24 -0700)]
[release-branch.go1.10] cmd/cgo: don't resolve typedefs in -godefs mode

In -godefs mode any typedefs that appear in struct fields and the like
will presumably be defined in the input file. If we resolve to the
base type, those cross-references will not work. So for -godefs mode,
keep the Go 1.10 behavior and don't resolve the typedefs in a loop.

Fixes #26644

Change-Id: I48cf72d9eb5016353c43074e6aff6495af326f35
Reviewed-on: https://go-review.googlesource.com/125995
Reviewed-by: Keith Randall <khr@golang.org>
(cherry picked from commit ead59f4bf368f13bbabea3f8a59f9f29ccdd3900)
Reviewed-on: https://go-review.googlesource.com/128395
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years ago[release-branch.go1.10] cmd/cgo: stop expanding typedefs once we reach __builtin...
Keith Randall [Wed, 1 Aug 2018 04:31:19 +0000 (21:31 -0700)]
[release-branch.go1.10] cmd/cgo: stop expanding typedefs once we reach __builtin types

Expanding __builtin types (__builtin_va_list, particularly) leads
to problems because they are expanded by the compiler itself - the
expansions are not generated by anything in a .h file. The types
a __builtin type expand to are thus very confusing to cgo.

See CL 126275.

Fixes #25036.

Change-Id: I66eb6a4f27f652f1b934ba702f580f6daa62a566
Reviewed-on: https://go-review.googlesource.com/127156
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-on: https://go-review.googlesource.com/128096

5 years ago[release-branch.go1.10] cmd/cgo: make sure we FinishType everything
Keith Randall [Thu, 26 Jul 2018 23:33:27 +0000 (16:33 -0700)]
[release-branch.go1.10] cmd/cgo: make sure we FinishType everything

Ensure that we call FinishType on all the types added to the ptrs map.
We only add a key to ptrKeys once. Once we FinishType for that key,
we'll never look at that key again. But we can add a new type under that
key later, and we'll never finish it.

Make sure we add the key to the ptrKeys list every time we make the list
of types for that key non-empty.

This makes sure we FinishType each pointer type exactly once.

Update #25036

Change-Id: Iad86150d516fcfac167591daf5a26c38bec7d143
Reviewed-on: https://go-review.googlesource.com/126275
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-on: https://go-review.googlesource.com/128095

5 years ago[release-branch.go1.10] misc/cgo: fix darwin test, again
Keith Randall [Mon, 16 Jul 2018 17:45:25 +0000 (10:45 -0700)]
[release-branch.go1.10] misc/cgo: fix darwin test, again

TARGET_OS_OSX is the right macro, but it also was only introduced
in 1.12.  For 1.11 and earlier a reasonable substitution is
TARGET_OS_IPHONE == 0.

Update #25036

Change-Id: I5f43c463d14fada9ed1d83cc684c7ea05d94c5f3
Reviewed-on: https://go-review.googlesource.com/124075
Run-TryBot: Keith Randall <khr@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/124218

5 years ago[release-branch.go1.10] misc/cgo: fix test on iOS
Keith Randall [Sun, 15 Jul 2018 00:18:45 +0000 (17:18 -0700)]
[release-branch.go1.10] misc/cgo: fix test on iOS

The test in CL 123715 doesn't work on iOS, it needs to use a different
version scheme to determine whether SecKeyAlgorithm and friends exist.
Restrict the old version test to OSX only.

The same problem occurs on iOS: the functions tested don't exist before
iOS 10.  But we don't have builders below iOS 10, so it isn't a big issue.
If we ever get older builders, or someone wants to run all.bash on an
old iOS, they'll need to figure out the right incantation.

Update #25036

Change-Id: Ia3ace86b00486dc172ed00c0c6d668a95565bff7
Reviewed-on: https://go-review.googlesource.com/123959
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/124217
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years ago[release-branch.go1.10] misc/cgo/test: fix issue 24161 test for 1.11 and earlier
Keith Randall [Thu, 12 Jul 2018 23:51:27 +0000 (16:51 -0700)]
[release-branch.go1.10] misc/cgo/test: fix issue 24161 test for 1.11 and earlier

The test uses functions from C that were introduced in OSX 1.12.
Include stubs for those functions when compiling for 1.11 and earlier.
This test really a compile-time test, it doesn't matter much what the
executed code actually does.
Use a nasty #define hack to work around the fact that cgo doesn't
support static global variables.

Update #25036

Change-Id: Icf6f7bc9b6b36cacc81d5d0e033a2ebaff7e0298
Reviewed-on: https://go-review.googlesource.com/123715
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/124216

5 years ago[release-branch.go1.10] cmd/cgo: fix cgo bad typedefs
Keith Randall [Tue, 10 Jul 2018 20:47:15 +0000 (13:47 -0700)]
[release-branch.go1.10] cmd/cgo: fix cgo bad typedefs

Two fixes:

1) Typedefs of the bad typedefs should also not be rewritten to the
   underlying type.  They shouldn't just be uintptr, though, they should
   retain the C naming structure.  For example, in C:

   typedef const __CFString * CFStringRef;
   typedef CFStringRef SecKeyAlgorithm;

   we want the Go:

   type _Ctype_CFStringRef uintptr
   type _Ctype_SecKeyAlgorithm = _Ctype_CFStringRef

2) We need more types than just function arguments/return values.
   At least we need types of global variables, so when we see a reference to:

   extern const SecKeyAlgorithm kSecKeyAlgorithmECDSASignatureDigestX962SHA1;

   we know that we need to investigate the type SecKeyAlgorithm.
   Might as well just find every typedef and check the badness of all of them.
   This requires looping until a fixed point of known types is reached.
   Usually it takes just 2 iterations, sometimes 3.

Update #25036

Change-Id: I32ca7e48eb4d4133c6242e91d1879636f5224ea9
Reviewed-on: https://go-review.googlesource.com/123177
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-on: https://go-review.googlesource.com/124215

5 years ago[release-branch.go1.10] cmd/cgo: check function argument/return types for bad C point...
Keith Randall [Sat, 7 Jul 2018 04:38:31 +0000 (21:38 -0700)]
[release-branch.go1.10] cmd/cgo: check function argument/return types for bad C pointer types

We need to determine whether arguments to and return values from C
functions are "bad" typedef'd pointer types which need to be uintptr
on the Go side.

The type of those arguments are not specified explicitly. As a result,
we never look through the C declarations for the GetTypeID functions
associated with that type, and never realize that they are bad.
However, in another function in the same package there might be an
explicit reference. Then we end up with the declaration being uintptr
in one file and *struct{...} in another file. Badness ensues.

Fix this by doing a 2-pass algorithm. In the first pass, we run as
normal, but record all the argument and result types we see. In the
second pass, we include those argument types also when reading the C
types.

Update #25036

Change-Id: I8d727e73a2fbc88cb9d9899f8719ae405f59f753
Reviewed-on: https://go-review.googlesource.com/122575
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit 20803e0f52809fa6088285c1c87246642df2b62d)
Reviewed-on: https://go-review.googlesource.com/122818

5 years ago[release-branch.go1.10] cmd/cgo: don't report inconsistency error for incomplete...
Ian Lance Taylor [Wed, 18 Jul 2018 00:36:15 +0000 (17:36 -0700)]
[release-branch.go1.10] cmd/cgo: don't report inconsistency error for incomplete typedef

In CLs 122575 and 123177 the cgo tool started explicitly looking up
typedefs. When there are two Go files using import "C", and the first
one has an incomplete typedef and the second one has a complete
version of the same typedef, then we will now record a version of the
first typedef which will not match the recorded version of the second
typedef, producing an "inconsistent definitions" error. Fix this by
silently merging incomplete typedefs with complete ones.

Fixes #26430

Change-Id: I9e629228783b866dd29b5c3a31acd48f6e410a2d
Reviewed-on: https://go-review.googlesource.com/124575
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
(cherry picked from commit a371bc2dfdf1fe4166c83be1177fbecb03d8da53)
Reviewed-on: https://go-review.googlesource.com/128155

5 years ago[release-branch.go1.10] strings: do much less redundant testing in TestCompareStrings
Ian Lance Taylor [Sun, 1 Jul 2018 22:01:09 +0000 (15:01 -0700)]
[release-branch.go1.10] strings: do much less redundant testing in TestCompareStrings

On the OpenBSD builder this reduces the test time from 213 seconds to
60 seconds, without loss of testing.

Not sure why the test is so much slower on OpenBSD, so not closing the
issues.

Updates #26155
Updates #26174

Change-Id: I13b58bbe3b209e591c308765077d2342943a3d2a
Reviewed-on: https://go-review.googlesource.com/121820
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ralph Corderoy <ralph@inputplus.co.uk>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 869884daead156d0e5a4093d91968ed172d4d2d0)
Reviewed-on: https://go-review.googlesource.com/124115
Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
5 years ago[release-branch.go1.10] bytes, strings: fix comparison of long byte slices on s390x
bill_ofarrell [Thu, 28 Jun 2018 22:39:37 +0000 (18:39 -0400)]
[release-branch.go1.10] bytes, strings: fix comparison of long byte slices on s390x

The existing implementation of bytes.Compare on s390x doesn't work properly for slices longer
than 256 elements. This change fixes that. Added tests for long strings and slices of bytes.

Fixes #26117

Change-Id: If6d8b68ee6dbcf99a24f867a1d3438b1f208954f
Reviewed-on: https://go-review.googlesource.com/121495
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/124016
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years ago[release-branch.go1.10] mime/multipart: restore 1.9 handling of missing/empty form...
Ian Lance Taylor [Tue, 26 Jun 2018 23:21:56 +0000 (16:21 -0700)]
[release-branch.go1.10] mime/multipart: restore 1.9 handling of missing/empty form-data file name

Revert the code change of CL 70931, but keep the test, appropriately
modified for the code changes. Also add a new test. This restores the
1.9 handling of form-data entries with missing or empty file names.

Changing the handling of this simply confused existing programs for no
useful benefit. Go back to the old behavior.

Updates #19183
Fixes #24041

Change-Id: Ie7a0309a061218ceda3bbc2a7da85e6fb3dd016d
Reviewed-on: https://go-review.googlesource.com/121075
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years ago[release-branch.go1.10] ld/macho: add all missing load commands
Misty De Meo [Fri, 15 Jun 2018 18:15:50 +0000 (18:15 +0000)]
[release-branch.go1.10] ld/macho: add all missing load commands

The ld/macho code currently understands a subset of the mach-o load
commands. I've encountered one of these in the wild in a Go-produced
binary, which tripped up the Go linker because its switch statement
expects its list of load commands to be exhaustive; the rest I've
added for the sake of completion.

The ruby-macho library is a good non-Darwin header resource for these:
https://github.com/homebrew/ruby-macho

Fixes #25912

Change-Id: Ib54c065d27e87d8726a9870df05a2bae24828b98
GitHub-Last-Rev: 655e3f488a4c1a89896a40edb0e1f715a5d3f734
GitHub-Pull-Request: golang/go#25906
Reviewed-on: https://go-review.googlesource.com/119115
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit 1a92cdbfc10e0c66f2e015264a39159c055a5c15)
Reviewed-on: https://go-review.googlesource.com/119215
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years ago[release-branch.go1.10] go1.10.3 go1.10.3
Filippo Valsorda [Wed, 6 Jun 2018 22:35:19 +0000 (18:35 -0400)]
[release-branch.go1.10] go1.10.3

Change-Id: If2abf35c922737d48ec72881428dc3353b016f7f
Reviewed-on: https://go-review.googlesource.com/116763
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
5 years ago[release-branch.go1.10] doc: document Go 1.10.3
Filippo Valsorda [Tue, 5 Jun 2018 21:12:29 +0000 (17:12 -0400)]
[release-branch.go1.10] doc: document Go 1.10.3

Change-Id: Ifc774bb9267baa773e91c617204329d3e04bd4b7
Reviewed-on: https://go-review.googlesource.com/116363
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
(cherry picked from commit b0951aff8f6a004fc2e73fdb98350125daea6c05)
Reviewed-on: https://go-review.googlesource.com/116477
Reviewed-by: Filippo Valsorda <filippo@golang.org>
5 years ago[release-branch.go1.10] doc: document Go 1.9.7
Filippo Valsorda [Tue, 5 Jun 2018 21:10:29 +0000 (17:10 -0400)]
[release-branch.go1.10] doc: document Go 1.9.7

Change-Id: I10dededb41162a99dbc42792a9d314c6dabddcca
Reviewed-on: https://go-review.googlesource.com/116362
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
(cherry picked from commit bbf4a3024b1001ef2f01a8d12b5d7469915e4a8d)
Reviewed-on: https://go-review.googlesource.com/116476
Reviewed-by: Filippo Valsorda <filippo@golang.org>
5 years ago[release-branch.go1.10] cmd/go: fix 'go get' compatibility for direct download of...
Russ Cox [Fri, 1 Jun 2018 19:47:29 +0000 (15:47 -0400)]
[release-branch.go1.10] cmd/go: fix 'go get' compatibility for direct download of vgo-aware module

CL 109340 added “minimal module-awareness for legacy operation.”
One part of that is reinterpreting imports inside code trees with go.mod files
as using semantic import versioning, and converting them back to
legacy import paths by stripping the major version element
(for example, interpreting import "x.com/foo/v2/bar" as import "x.com/foo/bar").
This rewrite was not being applied during "go get", with the effect that once
you had the target code downloaded already, everything was fine,
but it didn't download and build successfully the first time.

Fixes #25687.
Cherry-pick fixes #25690.

Change-Id: I3e122efdc8fd9a0a4e66f5aa3e6a99f90c7df779
Reviewed-on: https://go-review.googlesource.com/115797
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-on: https://go-review.googlesource.com/116176

6 years ago[release-branch.go1.10] cmd/go: accept more safe CFLAGS/LDFLAGS
Ian Lance Taylor [Wed, 30 May 2018 22:07:04 +0000 (15:07 -0700)]
[release-branch.go1.10] cmd/go: accept more safe CFLAGS/LDFLAGS

Fixes #23749
Fixes #24703
Fixes #24858

Change-Id: Ib32d8efee294004c70fdd602087df2da0867f099
Reviewed-on: https://go-review.googlesource.com/115415
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 886d5601a63bef0271e705cfa6b6ac6f5134ee60)
Reviewed-on: https://go-review.googlesource.com/115435
Reviewed-by: Andrew Bonventre <andybons@golang.org>
6 years ago[release-branch.go1.10] cmd/go: add minimal module-awareness for legacy operation
Russ Cox [Wed, 25 Apr 2018 15:06:41 +0000 (11:06 -0400)]
[release-branch.go1.10] cmd/go: add minimal module-awareness for legacy operation

We want authors to be able to publish code that works with both
the current standard go command and the planned new go command
support for modules. If authors have tagged their code v2 or later,
semantic import versioning means the import paths must include a
v2 path element after the path prefix naming the module.
One option for making this convention compatible with original go get
is to move code into a v2 subdirectory of the root.
That makes sense for some authors, but many authors would prefer
not to move all the code into a v2 subdirectory for a transition and
then move it back up once we everyone has a module-aware go command.

Instead, this CL teaches the old (non-module-aware) go command
a tiny amount about modules and their import paths, to expand
the options for authors who want to publish compatible packages.
If an author has a v2 of a package, say my/thing/v2/sub/pkg,
in the my/thing repo's sub/pkg subdirectory (no v2 in the file system path),
then old go get continues to import that package as my/thing/sub/pkg.
But when go get is processing code in any module (code in a tree with
a go.mod file) and encounters a path like my/thing/v2/sub/pkg,
it will check to see if my/thing/go.mod says "module my/thing/v2".
If so, the go command will read the import my/thing/v2/sub/pkg
as if it said my/thing/sub/pkg, which is the correct "old" import path
for the package in question.

This CL will be back-ported to Go 1.10 and Go 1.9 as well.

Once users have updated to the latest Go point releases containing
this new logic, authors will be able to update to using modules
within their own repos, including using semantic import paths
with vN path elements, and old go get will still be able to consume
those repositories.

This CL also makes "go get" ignore meta go-import lines using
the new "mod" VCS type. This allows a package to specify both
a "mod" type and a "git" type, to present more efficient module
access to module-aware go but still present a Git repo to the old
"go get".

Fixes #24751.
Fixes #25069.

Backport fixes #25139.

Change-Id: I378955613a0d63834d4f50f121f4db7e4d87dc0a
Reviewed-on: https://go-review.googlesource.com/114500
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years ago[release-branch.go1.10] cmd/go: remove import path debugging hooks
Russ Cox [Wed, 25 Apr 2018 13:38:56 +0000 (09:38 -0400)]
[release-branch.go1.10] cmd/go: remove import path debugging hooks

These are no longer needed.

Change-Id: Ie42a84f2bd24d2f59324bb66551c46e6af60c302
Reviewed-on: https://go-review.googlesource.com/109339
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-on: https://go-review.googlesource.com/114499
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years ago[release-branch.go1.10] strings: fix encoding of \u0080 in map
Martin Möhrmann [Fri, 4 May 2018 04:54:18 +0000 (06:54 +0200)]
[release-branch.go1.10] strings: fix encoding of \u0080 in map

Fix encoding of PAD (U+0080) which has the same value as utf8.RuneSelf
being incorrectly encoded as \x80 in strings.Map due to using <= instead
of a < comparison operator to check one byte encodings for utf8.

Fixes golang/go#25479

Change-Id: Ib6c7d1f425a7ba81e431b6d64009e713d94ea3bc
Reviewed-on: https://go-review.googlesource.com/111286
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 8c62fc0ca3c96ecbd3a6e81546aa8c53e32ff500)
Reviewed-on: https://go-review.googlesource.com/114635
Run-TryBot: Andrew Bonventre <andybons@golang.org>

6 years ago[release-branch.go1.10] doc: sync with master
Filippo Valsorda [Fri, 25 May 2018 19:07:15 +0000 (15:07 -0400)]
[release-branch.go1.10] doc: sync with master

A number of changes were applied to documentation in master, including
a wide rewrite of the contribution guide. Backport them all to get them
deployed on golang.org.

$ git ch master -- doc
$ git show-ref master
88756931d0a6e23aeaf61caa6a7363ac04be2063 refs/heads/master

Change-Id: Ib45ff191f3b60723aa4421113992289c37d144aa
Reviewed-on: https://go-review.googlesource.com/114503
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years ago[release-branch.go1.10] crypto/x509: check EKUs like 1.9.
Adam Langley [Wed, 16 May 2018 21:35:23 +0000 (14:35 -0700)]
[release-branch.go1.10] crypto/x509: check EKUs like 1.9.

This change brings back the EKU checking from 1.9. In 1.10, we checked
EKU nesting independent of the requested EKUs so that, after verifying a
certifciate, one could inspect the EKUs in the leaf and trust them.

That, however, was too optimistic. I had misunderstood that the PKI was
/currently/ clean enough to require that, rather than it being
desirable. Go generally does not push the envelope on these sorts of
things and lets the browsers clear the path first.

Fixes #25258

Change-Id: I18c070478e3bbb6468800ae461c207af9e954949
Reviewed-on: https://go-review.googlesource.com/113475
Reviewed-by: Filippo Valsorda <filippo@golang.org>
(cherry picked from commit 180e0f8a1b149bd1d15df29b6527748266cacad9)
Reviewed-on: https://go-review.googlesource.com/114035
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
6 years ago[release-branch.go1.10] doc: update Code of Conduct
Andrew Bonventre [Wed, 23 May 2018 15:37:59 +0000 (11:37 -0400)]
[release-branch.go1.10] doc: update Code of Conduct

Change-Id: I82c03dd026bb797a49b7361389373924acf6366c
Reviewed-on: https://go-review.googlesource.com/114085
Reviewed-by: Russ Cox <rsc@golang.org>
(cherry picked from commit 571d78267ff48f3a1220bfe7d342aa635008e35f)
Reviewed-on: https://go-review.googlesource.com/114275
Run-TryBot: Andrew Bonventre <andybons@golang.org>

6 years ago[release-branch.go1.10] misc/cgo/testcshared: use file descriptor 30 for TestUnexport...
Ian Lance Taylor [Fri, 20 Apr 2018 21:43:17 +0000 (14:43 -0700)]
[release-branch.go1.10] misc/cgo/testcshared: use file descriptor 30 for TestUnexportedSymbols

Backport of CL 108537 to 1.10 release branch.

We were using file descriptor 100, which requires the Linux kernel to
grow the fdtable size. That step may sometimes require a long time,
causing the test to fail. Switch to file descriptor 30, which should
not require growing the fdtable.

Updates #23784
Fixes #25277

Change-Id: I9d25986f3b59bdeb04aa52407b24aa94712aedff
Reviewed-on: https://go-review.googlesource.com/111995
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years ago[release-branch.go1.10] crypto/tls: copy and use adjusted syscall.CertChainPolicyPara
Alex Brainman [Sat, 5 May 2018 05:28:56 +0000 (15:28 +1000)]
[release-branch.go1.10] crypto/tls: copy and use adjusted syscall.CertChainPolicyPara

As discussed in issue #21376, it is unsafe to have
syscall.CertChainPolicyPara.ExtraPolicyPara uintptr -
it has to be a pointer type. So copy syscall.CertChainPolicyPara
into crypto/tls package, make ExtraPolicyPara unsafe.Pointer,
and use new struct instead of syscall.CertChainPolicyPara.

Fixes #25033

Change-Id: If914af056cbbb0c4d93ffaa915b3d2cb5ecad0cd
Reviewed-on: https://go-review.googlesource.com/111715
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>

6 years ago[release-branch.go1.10] go1.10.2 go1.10.2
Andrew Bonventre [Mon, 30 Apr 2018 18:24:19 +0000 (14:24 -0400)]
[release-branch.go1.10] go1.10.2

Change-Id: I3d88ab55277e4386177cda06e2eb5a9b0e26cf93
Reviewed-on: https://go-review.googlesource.com/110338
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years ago[release-branch.go1.10] doc: document Go 1.10.2
Andrew Bonventre [Mon, 30 Apr 2018 17:54:35 +0000 (13:54 -0400)]
[release-branch.go1.10] doc: document Go 1.10.2

Change-Id: I84334dfd02ad9a27b3fb6d46a6b1c015a3f03511
Reviewed-on: https://go-review.googlesource.com/110335
Reviewed-by: Filippo Valsorda <filippo@golang.org>
(cherry picked from commit 4bced5e9461429ae90245b0048c6fa5ff39a3947)
Reviewed-on: https://go-review.googlesource.com/110377
Reviewed-by: Andrew Bonventre <andybons@golang.org>
6 years ago[release-branch.go1.10] doc: document Go 1.9.6
Andrew Bonventre [Mon, 30 Apr 2018 17:49:16 +0000 (13:49 -0400)]
[release-branch.go1.10] doc: document Go 1.9.6

Change-Id: I9699b22d3a308cda685aa684b32dcde99333df46
Reviewed-on: https://go-review.googlesource.com/110315
Reviewed-by: Filippo Valsorda <filippo@golang.org>
(cherry picked from commit 587416c1617c4d5c970ca382dead63f9576c0de5)
Reviewed-on: https://go-review.googlesource.com/110376
Reviewed-by: Andrew Bonventre <andybons@golang.org>
6 years ago[release-branch.go1.10] cmd/internal/obj/mips: load/store even float registers first
James Cowgill [Wed, 28 Feb 2018 16:10:14 +0000 (16:10 +0000)]
[release-branch.go1.10] cmd/internal/obj/mips: load/store even float registers first

There is a bug in Octeon III processors where storing an odd floating
point register after it has recently been written to by a double
floating point operation will store the old value from before the double
operation (there are some extra details - the operation and store
must be a certain number of cycles apart). However, this bug does not
occur if the even register is stored first. Currently the bug only
happens on big endian because go always loads the even register first on
little endian.

Workaround the bug by always loading / storing the even floating point
register first. Since this is just an instruction reordering, it should
have no performance penalty. This follows other compilers like GCC which
will always store the even register first (although you do have to set
the ISA level to MIPS I to prevent it from using SDC1).

Fixes golang/go#24995

Change-Id: I5e73daa4d724ca1df7bf5228aab19f53f26a4976
Reviewed-on: https://go-review.googlesource.com/97735
Reviewed-by: Keith Randall <khr@golang.org>
(cherry picked from commit 423111081b87c6c4e61c4d94c94bfdf1853fa01f)
Reviewed-on: https://go-review.googlesource.com/110078
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years ago[release-branch.go1.10] cmd/internal/test2json: support subtests containing colons
Daniel Martí [Sat, 3 Mar 2018 19:53:53 +0000 (19:53 +0000)]
[release-branch.go1.10] cmd/internal/test2json: support subtests containing colons

The "updates" lines, such as RUN, do not contain a colon. However,
test2json looked for one anyway, meaning that it would be thrown off if
it encountered a line like:

=== RUN   TestWithColons/[::1]

In that case, it must not use the first colon it encounters to separate
the action from the test name.

Fixes golang/go#25027

Change-Id: I82eff23e24b83dae183c0cf9f85fc5f409f51c25
Reviewed-on: https://go-review.googlesource.com/98445
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit 0c5cfec84424bb453ccd270f4b5c439f21ccf617)
Reviewed-on: https://go-review.googlesource.com/110075
Run-TryBot: Andrew Bonventre <andybons@golang.org>

6 years ago[release-branch.go1.10] cmd/compile: fix evaluation of "" < s
Josh Bleecher Snyder [Thu, 12 Apr 2018 15:23:00 +0000 (08:23 -0700)]
[release-branch.go1.10] cmd/compile: fix evaluation of "" < s

Fixes #24935

Change-Id: Ifa79ab3dfe69297eeef85f7193cd5f85e5982bc5
Reviewed-on: https://go-review.googlesource.com/106655
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-on: https://go-review.googlesource.com/108944
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>

6 years ago[release-branch.go1.10] cmd/go: fix go list .Stale computation
Russ Cox [Wed, 18 Apr 2018 20:34:45 +0000 (16:34 -0400)]
[release-branch.go1.10] cmd/go: fix go list .Stale computation

If X depends on Y and X was installed but Y is only present in the cache
(as happens when you "go install X") then we should report X as up-to-date,
not as stale.

This applies whether X is a package or a main binary.

Fixes golang/go#25026
Fixes golang/go#25032

Change-Id: I26a0b375b1f7f7ac909cc0db68e92f4e04529208
Reviewed-on: https://go-review.googlesource.com/107957
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
(cherry picked from commit 9e0e6981fc536c9e51ce24c425141a3d09b39e3a)
Reviewed-on: https://go-review.googlesource.com/110076
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years ago[release-branch.go1.10] cmd/link: do not pass -no-pie to host linker when -linkshared...
Michael Hudson-Doyle [Wed, 4 Apr 2018 22:07:41 +0000 (10:07 +1200)]
[release-branch.go1.10] cmd/link: do not pass -no-pie to host linker when -linkshared is passed

As the comment above the code I'm changing says, when building with
-buildmode=exe, the default compiler flags produce code incompatible with PIE.
But when -linkshared is passed, the default compiler flags are not used so this
does not apply. And now I've found a system (linux/arm64 with glibc 2.27) where
this combination of flags causes a problem, albeit for reasons I don't really
understand, so stop passing -no-pie when -linkshared is passed.

Fixes golang/go#24873

Change-Id: I412ec7941dc0cb89e6d1b171fc29288aadcb9f20
Reviewed-on: https://go-review.googlesource.com/104815
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit 2d26a65f8f1a6fcb0948803589061d99b94fa993)
Reviewed-on: https://go-review.googlesource.com/110035
Run-TryBot: Andrew Bonventre <andybons@golang.org>

6 years ago[release-branch.go1.10] cmd/go: skip TestVetWithOnlyCgoFiles when cgo is disabled
David du Colombier [Wed, 7 Mar 2018 22:03:24 +0000 (23:03 +0100)]
[release-branch.go1.10] cmd/go: skip TestVetWithOnlyCgoFiles when cgo is disabled

CL 99175 added TestVetWithOnlyCgoFiles. However, this
test is failing on platforms where cgo is disabled,
because no file can be built.

This change fixes TestVetWithOnlyCgoFiles by skipping
this test when cgo is disabled.

Fixes #24304.

Change-Id: Ibb38fcd3e0ed1a791782145d3f2866f12117c6fe
Reviewed-on: https://go-review.googlesource.com/99275
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit b1335037fad4c81ce296f652372aa631a29dcb48)
Reviewed-on: https://go-review.googlesource.com/103223
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years ago[release-branch.go1.10] go1.10.1 go1.10.1
Andrew Bonventre [Thu, 29 Mar 2018 03:44:19 +0000 (23:44 -0400)]
[release-branch.go1.10] go1.10.1

Change-Id: I0636f60e705f8182d6fba4ce6199c67f94c04e36
Reviewed-on: https://go-review.googlesource.com/103168
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years ago[release-branch.go1.10] runtime: identify special functions by flag instead of address
Keith Randall [Wed, 14 Mar 2018 22:21:37 +0000 (15:21 -0700)]
[release-branch.go1.10] runtime: identify special functions by flag instead of address

When there are plugins, there may not be a unique copy of runtime
functions like goexit, mcall, etc.  So identifying them by entry
address is problematic.  Instead, keep track of each special function
using a field in the symbol table.  That way, multiple copies of
the same runtime function will be treated identically.

Fixes #24351
Fixes #23133

Change-Id: Iea3232df8a6af68509769d9ca618f530cc0f84fd
Reviewed-on: https://go-review.googlesource.com/100739
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-on: https://go-review.googlesource.com/102793
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years ago[release-branch.go1.10] doc: update 1.9.5 release notes to include net/http/pprof
Andrew Bonventre [Thu, 29 Mar 2018 01:25:09 +0000 (21:25 -0400)]
[release-branch.go1.10] doc: update 1.9.5 release notes to include net/http/pprof

Change-Id: I7c0716711a2cadd347fdf242c792b109539f7355
Reviewed-on: https://go-review.googlesource.com/103163
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-on: https://go-review.googlesource.com/103166
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years ago[release-branch.go1.10] doc: update release notes for Go 1.9.5
Andrew Bonventre [Thu, 29 Mar 2018 01:11:05 +0000 (21:11 -0400)]
[release-branch.go1.10] doc: update release notes for Go 1.9.5

Change-Id: Idf88d289bac9603d852a9d19eb4b764f8589f8d9
Reviewed-on: https://go-review.googlesource.com/103159
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-on: https://go-review.googlesource.com/103162
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years ago[release-branch.go1.10] doc: document Go 1.10.1
Andrew Bonventre [Wed, 28 Mar 2018 21:51:05 +0000 (17:51 -0400)]
[release-branch.go1.10] doc: document Go 1.10.1

Change-Id: Ibba5d4fd8124db9b1e4e50b8f37366f8dd23f47e
Reviewed-on: https://go-review.googlesource.com/103217
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-on: https://go-review.googlesource.com/103222
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years ago[release-branch.go1.10] doc: document Go 1.9.5
Andrew Bonventre [Wed, 28 Mar 2018 21:42:01 +0000 (17:42 -0400)]
[release-branch.go1.10] doc: document Go 1.9.5

Change-Id: I8f12b188d2e13555e1d7634b9cc0319fc737cb1d
Reviewed-on: https://go-review.googlesource.com/103216
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-on: https://go-review.googlesource.com/103221
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years ago[release-branch.go1.10] net/http/pprof: harden handler responses
Andrew Bonventre [Fri, 23 Mar 2018 20:40:15 +0000 (16:40 -0400)]
[release-branch.go1.10] net/http/pprof: harden handler responses

A very small number of old browsers consider content as HTML
even when it is explicitly stated in the Content-Type header
that it is not. If content served is based on user-supplied
input, then an XSS is possible. Introduce three mitigations:

+ Don't reflect user input in error strings
+ Set a Content-Disposition header when requesting a resource
  that should never be displayed in a browser window
+ Set X-Content-Type-Options: nosniff on all responses

Change-Id: I81c9d6736e0439ebd1db99cd7fb701cc56d24805
Reviewed-on: https://go-review.googlesource.com/102318
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/103218
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years ago[release-branch.go1.10] cmd/go: add more C compiler/linker options to whitelist
Ian Lance Taylor [Wed, 28 Mar 2018 00:06:53 +0000 (17:06 -0700)]
[release-branch.go1.10] cmd/go: add more C compiler/linker options to whitelist

Fixes #23937

Change-Id: Ie63d91355d1a724d0012d99d457d939deeeb8d3e
Reviewed-on: https://go-review.googlesource.com/102818
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-on: https://go-review.googlesource.com/103015
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years ago[release-branch.go1.10] cmd/go: if -race, don't run coverage on runtime packages
Ian Lance Taylor [Sat, 17 Feb 2018 03:08:59 +0000 (19:08 -0800)]
[release-branch.go1.10] cmd/go: if -race, don't run coverage on runtime packages

Don't compile the runtime packages with coverage when using the race
detector. The user can, perhaps accidentally, request coverage for the
runtime by using -coverpkg=all. If using the race detector, the
runtime package coverage will call into the race detector before it
has been initialized. This will cause the program to crash
mysteriously on startup.

Fixes #23882

Change-Id: I9a63867a9138797d8b8afb0856ae21079accdb27
Reviewed-on: https://go-review.googlesource.com/94898
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-on: https://go-review.googlesource.com/103095
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years ago[release-branch.go1.10] crypto/x509: matching any requested EKU should be sufficient.
Adam Langley [Wed, 28 Feb 2018 19:35:54 +0000 (11:35 -0800)]
[release-branch.go1.10] crypto/x509: matching any requested EKU should be sufficient.

The documentation was unclear here and I misremembered the behaviour and
changed it in 1.10: it used to be that matching any EKU was enough but
1.10 requires that all EKUs match.

Restore 1.9 behaviour and clarify the documentation to make it official.

Fixes #24162.

Change-Id: Ic9466cd0799cb27ec3a3a7e6c96f10c2aacc7020
Reviewed-on: https://go-review.googlesource.com/97720
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-on: https://go-review.googlesource.com/102790
Run-TryBot: Andrew Bonventre <andybons@golang.org>

6 years ago[release-branch.go1.10] go/internal/srcimporter: simplify and fix package file lookup
Hiroshi Ioka [Mon, 11 Dec 2017 23:59:01 +0000 (08:59 +0900)]
[release-branch.go1.10] go/internal/srcimporter: simplify and fix package file lookup

The old code was a blend of (copied) code that existed before go/build,
and incorrect adjustments made when go/build was introduced. This change
leaves package path determination entirely to go/build and in the process
fixes issues with relative import paths.

Fixes #23092
Fixes #24392

Change-Id: I9e900538b365398751bace56964495c5440ac4ae
Reviewed-on: https://go-review.googlesource.com/83415
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-on: https://go-review.googlesource.com/102789
Run-TryBot: Andrew Bonventre <andybons@golang.org>

6 years ago[release-branch.go1.10] cmd/compile: mark LAA and LAAG as clobbering flags on s390x
Michael Munday [Mon, 19 Mar 2018 17:11:16 +0000 (13:11 -0400)]
[release-branch.go1.10] cmd/compile: mark LAA and LAAG as clobbering flags on s390x

The atomic add instructions modify the condition code and so need to
be marked as clobbering flags.

Fixes #24449.

Change-Id: Ic69c8d775fbdbfb2a56c5e0cfca7a49c0d7f6897
Reviewed-on: https://go-review.googlesource.com/101455
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/102788
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Michael Munday <mike.munday@ibm.com>
6 years ago[release-branch.go1.10] net: don't let cancelation of a DNS lookup affect another...
Ian Lance Taylor [Thu, 15 Mar 2018 18:55:30 +0000 (11:55 -0700)]
[release-branch.go1.10] net: don't let cancelation of a DNS lookup affect another lookup

Updates #8602
Updates #20703
Fixes #22724

Change-Id: I27b72311b2c66148c59977361bd3f5101e47b51d
Reviewed-on: https://go-review.googlesource.com/100840
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/102787
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years ago[release-branch.go1.10] syscall: use Android O friendly fstatat syscall to implement...
Tobias Klauser [Thu, 15 Mar 2018 09:45:51 +0000 (10:45 +0100)]
[release-branch.go1.10] syscall: use Android O friendly fstatat syscall to implement Stat on linux/amd64

The Android O seccomp policy disallows the stat syscall on amd64, see
https://android.googlesource.com/platform/bionic/+/android-4.2.2_r1.2/libc/SYSCALLS.TXT

Use the fstatat syscall with AT_FDCWD and zero flags instead to achieve
the same behavior.

Fixes #24403

Change-Id: I36fc9ec9bc938cd8e9de30f66c0eb9d2e24debf6
Reviewed-on: https://go-review.googlesource.com/100878
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/102976
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years ago[release-branch.go1.10] runtime: use Android O friendly faccessat syscall on linux...
Tobias Klauser [Thu, 15 Mar 2018 09:21:57 +0000 (10:21 +0100)]
[release-branch.go1.10] runtime: use Android O friendly faccessat syscall on linux/amd64

The Android O seccomp policy disallows the access syscall on amd64, see
https://android.googlesource.com/platform/bionic/+/android-4.2.2_r1.2/libc/SYSCALLS.TXT

Use the faccessat syscall with AT_FDCWD instead to achieve the same
behavior.

Updates #24403

Change-Id: I9db847c1c0f33987a3479b3f96e721fb9588cde2
Reviewed-on: https://go-review.googlesource.com/100877
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/102995
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years ago[release-branch.go1.10] runtime: add symbol for AT_FDCWD on Linux amd64 and mips64x
Tobias Klauser [Tue, 13 Feb 2018 16:07:54 +0000 (17:07 +0100)]
[release-branch.go1.10] runtime: add symbol for AT_FDCWD on Linux amd64 and mips64x

Also order the syscall number list by numerically for mips64x.

Follow-up for CL 92895.

Change-Id: I5f01f8c626132a06160997fce8a2aef0c486bb1c
Reviewed-on: https://go-review.googlesource.com/93616
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/103035
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years ago[release-branch.go1.10] runtime: use Android O friendly syscalls on 64-bit machines
Jason A. Donenfeld [Thu, 8 Feb 2018 15:59:17 +0000 (16:59 +0100)]
[release-branch.go1.10] runtime: use Android O friendly syscalls on 64-bit machines

Android O disallows open on 64-bit, so let's use openat with AT_FDCWD to
achieve the same behavior.

Android O disallows epoll_wait on 64-bit, so let's use epoll_pwait with
the last argument as NULL to achieve the same behavior.

See here:
https://android.googlesource.com/platform/bionic/+/master/libc/seccomp/arm64_app_policy.cpp
https://android.googlesource.com/platform/bionic/+/master/libc/seccomp/mips64_app_policy.cpp
https://android.googlesource.com/platform/bionic/+/master/libc/seccomp/x86_64_app_policy.cpp

Fixes #23750

Change-Id: If8d5a663357471e5d2c1f516151344a9d05b188a
Reviewed-on: https://go-review.googlesource.com/92895
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/102792
Run-TryBot: Andrew Bonventre <andybons@golang.org>

6 years ago[release-branch.go1.10] cmd/cover: don't crash on non-gofmt'ed input
Ian Lance Taylor [Tue, 6 Mar 2018 15:57:19 +0000 (07:57 -0800)]
[release-branch.go1.10] cmd/cover: don't crash on non-gofmt'ed input

Without the change to cover.go, the new test fails with

panic: overlapping edits: [4946,4950)->"", [4947,4947)->"thisNameMustBeVeryLongToCauseOverflowOfCounterIncrementStatementOntoNextLineForTest.Count[112]++;"

The original code inserts "else{", deletes "else", and then positions
a new block just after the "}" that must come before the "else".
That works on gofmt'ed code, but fails if the code looks like "}else".
When there is no space between the "{" and the "else", the new block
is inserted into a location that we are deleting, leading to the
"overlapping edits" mentioned above.

This CL fixes this case by not deleting the "else" but just using the
one that is already there. That requires adjust the block offset to
come after the "{" that we insert.

Fixes #23927

Change-Id: I40ef592490878765bbce6550ddb439e43ac525b2
Reviewed-on: https://go-review.googlesource.com/98935
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-on: https://go-review.googlesource.com/102786
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years ago[release-branch.go1.10] cmd/go: run vet on packages with only cgo files
Ian Lance Taylor [Wed, 7 Mar 2018 15:03:46 +0000 (07:03 -0800)]
[release-branch.go1.10] cmd/go: run vet on packages with only cgo files

CgoFiles is not included in GoFiles, so we need to check both.

Fixes #24193

Change-Id: I6a67bd912e3d9a4be0eae8fa8db6fa8a07fb5df3
Reviewed-on: https://go-review.googlesource.com/99175
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/102785
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years ago[release-branch.go1.10] encoding/json: avoid assuming side-effect free reflect.Value...
Joe Tsai [Wed, 28 Feb 2018 21:45:06 +0000 (13:45 -0800)]
[release-branch.go1.10] encoding/json: avoid assuming side-effect free reflect.Value.Addr().Elem()

Consider the following:
type child struct{ Field string }
type parent struct{ child }

p := new(parent)
v := reflect.ValueOf(p).Elem().Field(0)
v.Field(0).SetString("hello")           // v.Field = "hello"
v = v.Addr().Elem()                     // v = *(&v)
v.Field(0).SetString("goodbye")         // v.Field = "goodbye"

It would appear that v.Addr().Elem() should have the same value, and
that it would be safe to set "goodbye".
However, after CL 66331, any interspersed calls between Field calls
causes the RO flag to be set.
Thus, setting to "goodbye" actually causes a panic.

That CL affects decodeState.indirect which assumes that back-to-back
Value.Addr().Elem() is side-effect free. We fix that logic to keep
track of the Addr() and Elem() calls and set v back to the original
after a full round-trip has occured.

Fixes #24152
Updates #24153

Change-Id: Ie50f8fe963f00cef8515d89d1d5cbc43b76d9f9c
Reviewed-on: https://go-review.googlesource.com/97796
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/102784
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years ago[release-branch.go1.10] crypto/x509: parse invalid DNS names and email addresses.
Adam Langley [Thu, 22 Feb 2018 20:05:29 +0000 (12:05 -0800)]
[release-branch.go1.10] crypto/x509: parse invalid DNS names and email addresses.

Go 1.10 requires that SANs in certificates are valid. However, a
non-trivial number of (generally non-WebPKI) certificates have invalid
strings in dnsName fields and some have even put those dnsName SANs in
CA certificates.

This change defers validity checking until name constraints are checked.

Fixes #23995, #23711.

Change-Id: I2e0ebb0898c047874a3547226b71e3029333b7f1
Reviewed-on: https://go-review.googlesource.com/96378
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/102783
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
6 years ago[release-branch.go1.10] archive/zip: fix handling of Info-ZIP Unix extended timestamps
Joe Tsai [Fri, 23 Feb 2018 23:08:11 +0000 (15:08 -0800)]
[release-branch.go1.10] archive/zip: fix handling of Info-ZIP Unix extended timestamps

The Info-ZIP Unix1 extra field is specified as such:
>>>
Value    Size   Description
-----    ----   -----------
0x5855   Short  tag for this extra block type ("UX")
TSize    Short  total data size for this block
AcTime   Long   time of last access (GMT/UTC)
ModTime  Long   time of last modification (GMT/UTC)
<<<

The previous handling was incorrect in that it read the AcTime field
instead of the ModTime field.

The test-osx.zip test unfortunately locked in the wrong behavior.
Manually parsing that ZIP file shows that the encoded MS-DOS
date and time are 0x4b5f and 0xa97d, which corresponds with a
date of 2017-10-31 21:11:58, which matches the correct mod time
(off by 1 second due to MS-DOS timestamp resolution).

Fixes #23901

Change-Id: I567824c66e8316b9acd103dbecde366874a4b7ef
Reviewed-on: https://go-review.googlesource.com/96895
Run-TryBot: Joe Tsai <joetsai@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-on: https://go-review.googlesource.com/102782
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years ago[release-branch.go1.10] runtime: don't check for String/Error methods in printany
Ian Lance Taylor [Fri, 23 Feb 2018 18:34:01 +0000 (10:34 -0800)]
[release-branch.go1.10] runtime: don't check for String/Error methods in printany

They have either already been called by preprintpanics, or they can
not be called safely because of the various conditions checked at the
start of gopanic.

Fixes #24059

Change-Id: I4a6233d12c9f7aaaee72f343257ea108bae79241
Reviewed-on: https://go-review.googlesource.com/96755
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-on: https://go-review.googlesource.com/102781
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years ago[release-branch.go1.10] crypto/x509: tighten EKU checking for requested EKUs.
Adam Langley [Thu, 22 Feb 2018 20:30:44 +0000 (12:30 -0800)]
[release-branch.go1.10] crypto/x509: tighten EKU checking for requested EKUs.

There are, sadly, many exceptions to EKU checking to reflect mistakes
that CAs have made in practice. However, the requirements for checking
requested EKUs against the leaf should be tighter than for checking leaf
EKUs against a CA.

Fixes #23884

Change-Id: I05ea874c4ada0696d8bb18cac4377c0b398fcb5e
Reviewed-on: https://go-review.googlesource.com/96379
Reviewed-by: Jonathan Rudenberg <jonathan@titanous.com>
Reviewed-by: Filippo Valsorda <hi@filippo.io>
Run-TryBot: Filippo Valsorda <hi@filippo.io>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/102780
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
6 years ago[release-branch.go1.10] cmd/go: permit pkg-config flags in any argument position
Ian Lance Taylor [Sat, 17 Feb 2018 00:17:44 +0000 (16:17 -0800)]
[release-branch.go1.10] cmd/go: permit pkg-config flags in any argument position

Fixes #23875

Change-Id: I503af71f44d11cd6b787fef100246b55735614a0
Reviewed-on: https://go-review.googlesource.com/94896
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/102779
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years ago[release-branch.go1.10] cmd/go: restrict meta imports to valid schemes
Ian Lance Taylor [Thu, 15 Feb 2018 23:57:13 +0000 (15:57 -0800)]
[release-branch.go1.10] cmd/go: restrict meta imports to valid schemes

Before this change, when using -insecure, we permitted any meta import
repo root as long as it contained "://". When not using -insecure, we
restrict meta import repo roots to be valid URLs. People may depend on
that somehow, so permit meta import repo roots to be invalid URLs, but
require them to have valid schemes per RFC 3986.

Fixes #23867

Change-Id: Iac666dfc75ac321bf8639dda5b0dba7c8840922d
Reviewed-on: https://go-review.googlesource.com/94603
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/102778
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years ago[release-branch.go1.10] doc: update devel/release.html to add Go 1.10
Andrew Bonventre [Sat, 17 Feb 2018 04:26:02 +0000 (23:26 -0500)]
[release-branch.go1.10] doc: update devel/release.html to add Go 1.10

Change-Id: I869f1607b0209ad190bc02999879f0682965fdf7
Reviewed-on: https://go-review.googlesource.com/94915
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 27be37a4038e0c5e11510e7b0b6ec4f2c4cfc879)
Reviewed-on: https://go-review.googlesource.com/94916
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years ago[release-branch.go1.10] go1.10 go1.10
Andrew Bonventre [Fri, 16 Feb 2018 04:20:11 +0000 (23:20 -0500)]
[release-branch.go1.10] go1.10

Change-Id: I3663c2156d093efa09343512a69f040ecc8331e0
Reviewed-on: https://go-review.googlesource.com/94696
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>