]> Cypherpunks repositories - gostls13.git/log
gostls13.git
7 years agonet/http: document internal error errServerClosedIdle more
Brad Fitzpatrick [Fri, 5 Jan 2018 17:03:51 +0000 (17:03 +0000)]
net/http: document internal error errServerClosedIdle more

Updates #19943

Change-Id: Iea249be51a7af3264bee9ee2b28dbd91043275fc
Reviewed-on: https://go-review.googlesource.com/86375
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agonet/http: don't validate WriteHeader code if header's already been sent
Brad Fitzpatrick [Thu, 4 Jan 2018 22:26:20 +0000 (22:26 +0000)]
net/http: don't validate WriteHeader code if header's already been sent

Also vendors x/net/http git rev 42fe2e1c for:

    http2: don't check WriteHeader status if we've already sent the header
    https://golang.org/cl/86255

Fixes #23010

Change-Id: I4f3dd63acb52d5a34a0350aaf847a7a376d6968f
Reviewed-on: https://go-review.googlesource.com/86275
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agonet/http: document CONNECT more
Brad Fitzpatrick [Thu, 4 Jan 2018 23:36:16 +0000 (23:36 +0000)]
net/http: document CONNECT more

Fixes #22554

Change-Id: I624f2883489a46d7162c11f489c2f0a0ec5a836f
Reviewed-on: https://go-review.googlesource.com/86277
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agonet/http: soften wording around when the Transport reuses connections
Brad Fitzpatrick [Thu, 4 Jan 2018 23:06:31 +0000 (23:06 +0000)]
net/http: soften wording around when the Transport reuses connections

The docs were too specific. Make it vaguer. There are conditions for
which the Transport will try to reuse a connection anyway, even if the
Response Body isn't read to EOF or closed, but we don't need to get
into all the details in the docs.

Fixes #22954

Change-Id: I3b8ae32aeb1a61b396d0026e129552afbfecceec
Reviewed-on: https://go-review.googlesource.com/86276
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/go: fix build failure in -x test
Russ Cox [Thu, 4 Jan 2018 20:09:21 +0000 (15:09 -0500)]
cmd/go: fix build failure in -x test

CL 84735 strengthened the -x test to make sure commands succeed,
using set -e, but the gcc flag tests can fail. Change them to say || true.

Fixes #23337.

Change-Id: I01e4017cb36ceb147b56935c2636de52ce7bdfdb
Reviewed-on: https://go-review.googlesource.com/86239
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocrypto/tls: optional "certificate_status" with OCSP
Brad Burch [Thu, 4 Jan 2018 06:42:10 +0000 (00:42 -0600)]
crypto/tls: optional "certificate_status" with OCSP

Follows the wording in RFC4366 more precisely which allows a server
to optionally return a "certificate_status" when responding to a
client hello containing "status_request" extension.

fixes #8549

Change-Id: Ib02dc9f972da185b25554568fe6f8bc411d9c0b7
Reviewed-on: https://go-review.googlesource.com/86115
Reviewed-by: Adam Langley <agl@golang.org>
7 years agomath/rand: typo fixed in documentation of seedPos
Paul PISCUC [Thu, 4 Jan 2018 20:25:04 +0000 (21:25 +0100)]
math/rand: typo fixed in documentation of seedPos

In the comment of seedPost, the word: condiiton was changed to: condition

Change-Id: I8967cc0e9f5d37776bada96cc1443c8bf46e1117
Reviewed-on: https://go-review.googlesource.com/86156
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agospec: consistently use "element" rather than "value" for map entry values
Robert Griesemer [Wed, 3 Jan 2018 18:33:11 +0000 (10:33 -0800)]
spec: consistently use "element" rather than "value" for map entry values

The spec refers to a map's key and element types; thus the respective
values are "keys" and "elements". Also, a map value is the value of
the entire map.

Similar fix for channels, where appropriate.

Fixes #23254.

Change-Id: I6f03ea6d86586c7b0b3e84f0c2e9446b8109fa53
Reviewed-on: https://go-review.googlesource.com/85999
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
7 years agosync: document when and when not to use Map
Russ Cox [Wed, 13 Dec 2017 16:49:26 +0000 (11:49 -0500)]
sync: document when and when not to use Map

Fixes #21587.

Change-Id: I47eb181d65da67a3b530c7f8acac9c0c619ea474
Reviewed-on: https://go-review.googlesource.com/83796
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/test2json: fix test log output containing test output
Russ Cox [Thu, 4 Jan 2018 18:25:31 +0000 (13:25 -0500)]
cmd/test2json: fix test log output containing test output

If test case framing appears in ordinary test output,
then test2json can get confused. If the fake framing is being
saved with t.Logf/t.Errorf/etc then we can already
distinguish it from real framing, and the code did.
It just forgot to write that framing as output (1-line fix).

If the fake framing is being generated by printing directly
to stdout/stderr, then test2json will simply get confused.
There's not a lot to do at that point (maybe it's even a feature).

Fixes #23036.

Change-Id: I29449c7ace304172b89d8babe23de507c0500455
Reviewed-on: https://go-review.googlesource.com/86238
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/go: fix caching of test -json outputs
Russ Cox [Thu, 14 Dec 2017 19:53:40 +0000 (14:53 -0500)]
cmd/go: fix caching of test -json outputs

go test -json was inadvertently disabling caching. Fix that.

Fixes #22984.

Change-Id: Ic933a8c8ac00ce8253e934766954b1ccc6ac0cec
Reviewed-on: https://go-review.googlesource.com/84075
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/go: fix coverage rebuild corner case
Russ Cox [Thu, 4 Jan 2018 18:07:44 +0000 (13:07 -0500)]
cmd/go: fix coverage rebuild corner case

If you have a package p1 with an xtest (package p1_test)
that imports p2, where p2 itself imports p1, then when
trying to do coverage for p1 we need to make sure to
recompile p2. The problem was that the overall package
import graph looked like:

    main -> p1_test -> p2 -> p1

Since we were recompiling p1 with coverage, we correctly
figured out that because p2 depends on a package being
recompiled due to coverage, p2 also needs to be split (forked) to
insert the dependency on the modified p1. But then we used
the same logic to split p1_test and main, with the effect that
the changes to p2 and p1_test and main were lost, since the
caller was still holding on to the original main, not the split version.

Change the code to treat main and p1_test as "already split"
and just update them in place.

Fixes #23314.

Change-Id: If7edeca6e39cdaeb5b9380d00b0c7d8c5891f086
Reviewed-on: https://go-review.googlesource.com/86237
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/go: fix compile -p flag for building test of main package
Russ Cox [Thu, 4 Jan 2018 17:27:32 +0000 (12:27 -0500)]
cmd/go: fix compile -p flag for building test of main package

Fixes #23180.

Change-Id: I52404ee98dcc60b96972d4242c13db0ec4340d0d
Reviewed-on: https://go-review.googlesource.com/86235
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agoruntime: avoid race on allp in findrunnable
Austin Clements [Thu, 4 Jan 2018 15:43:29 +0000 (10:43 -0500)]
runtime: avoid race on allp in findrunnable

findrunnable loops over allp to check run queues *after* it has
dropped its own P. This is unsafe because allp can change when nothing
is blocking safe-points. Hence, procresize could change allp
concurrently with findrunnable's loop. Beyond generally violating Go's
memory model, in the best case this could findrunnable to observe a
nil P pointer if allp has been grown but the new slots not yet
initialized. In the worst case, the reads of allp could tear, causing
findrunnable to read a word that isn't even a valid *P pointer.

Fix this by taking a snapshot of the allp slice header (but not the
backing store) before findrunnable drops its P and iterating over this
snapshot. The actual contents of allp are immutable up to len(allp),
so this fixes the race.

Updates #23098 (may fix).

Change-Id: I556ae2dbfffe9fe4a1bf43126e930b9e5c240ea8
Reviewed-on: https://go-review.googlesource.com/86215
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/go: add -v option in the usage section for get
Agniva De Sarker [Thu, 4 Jan 2018 09:37:03 +0000 (15:07 +0530)]
cmd/go: add -v option in the usage section for get

Updates #23332

Change-Id: I964d36ed751ef1844ab6c40f61047297ff1443a3
Reviewed-on: https://go-review.googlesource.com/85797
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/buildid: fix rewrite algorithm
Hiroshi Ioka [Tue, 19 Dec 2017 14:59:56 +0000 (23:59 +0900)]
cmd/buildid: fix rewrite algorithm

Update rewrite algorithm by coping code from
go/internal/work/buildid:updateBuildID.

Probably, this is not the best option. We could provide high-level API
in cmd/internal/buildid in the future.

Fixes #23181

Change-Id: I336a7c50426ab39bc9998b55c372af61a4fb21a7
Reviewed-on: https://go-review.googlesource.com/84735
Reviewed-by: Russ Cox <rsc@golang.org>
7 years agodoc/diagnostics: update gc flags recommended for debugging
Hana Kim [Tue, 19 Dec 2017 20:06:57 +0000 (15:06 -0500)]
doc/diagnostics: update gc flags recommended for debugging

After 1.10, gcflags apply to only the immediate target.

Change-Id: I3bf331c76041e7b533076cb2f3274e44aafff58a
Reviewed-on: https://go-review.googlesource.com/84775
Reviewed-by: Heschi Kreinick <heschi@google.com>
7 years agoencoding/gob: avoid race on idToType
Ian Lance Taylor [Thu, 4 Jan 2018 01:50:47 +0000 (17:50 -0800)]
encoding/gob: avoid race on idToType

Fixes #23328

Change-Id: Ie4864d7f388d363860318fe41431d8a9719e9a75
Reviewed-on: https://go-review.googlesource.com/86075
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agocmd/go, testing: test names don't have to be alphanumeric
Ian Lance Taylor [Wed, 3 Jan 2018 19:27:26 +0000 (11:27 -0800)]
cmd/go, testing: test names don't have to be alphanumeric

In func TestXxxx(*testing.T) the Xxxx can be anything that can appear
in an identifier, but can't start with a lowercase letter. Clarify the docs.

Fixes #23322

Change-Id: I5c297916981f7e3890ee955d12bc7422a75488e2
Reviewed-on: https://go-review.googlesource.com/86001
Reviewed-by: Rob Pike <r@golang.org>
7 years agonet: set CLOEXEC on sockets used for capability probes
Ian Lance Taylor [Wed, 3 Jan 2018 20:59:09 +0000 (12:59 -0800)]
net: set CLOEXEC on sockets used for capability probes

Fixes #22349

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

7 years agotime: revert CL 78735 (was: space padding using underscore)
Ian Lance Taylor [Wed, 3 Jan 2018 18:24:29 +0000 (10:24 -0800)]
time: revert CL 78735 (was: space padding using underscore)

CL 78735 description:

    time: add space padding layout strings(using underscore) for not only day but others

    As mentioned in #22802, only day component of layout string has space
    padding(represented by one underscore before its placeholder). This
    commit expands the rule for month, hour, minute and second.

    Updates #22802 (maybe fixes it)

Revert this CL because it breaks currently working formats that happen
to use underscores.

Fixes #23259

Change-Id: I64acaaca9b5b74785ee0f0be7910574e87daa649
Reviewed-on: https://go-review.googlesource.com/85998
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
7 years agonet: ignore TestDialerLocalAddr timeout failures on Darwin
Ian Lance Taylor [Wed, 3 Jan 2018 18:57:36 +0000 (10:57 -0800)]
net: ignore TestDialerLocalAddr timeout failures on Darwin

I don't know why these errors occur. Ignore them to avoid breaking the
build.

Updates #22019

Change-Id: Ia048e6d9b928e8e237b311ff3a364e7a23af4aa4
Reviewed-on: https://go-review.googlesource.com/86000
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agonet: report connect error as coming from "connect"
Ian Lance Taylor [Wed, 3 Jan 2018 18:09:35 +0000 (10:09 -0800)]
net: report connect error as coming from "connect"

We retrieve an error using getsockopt with SO_ERROR. We were reporting
the error as coming from "getsockopt", but really it is coming from
"connect". It is not getsockopt that failed.

Fixes #19302

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

7 years agocmd/go: on Windows, disable cache if LocalAppData is not set
Ian Lance Taylor [Wed, 3 Jan 2018 17:55:02 +0000 (09:55 -0800)]
cmd/go: on Windows, disable cache if LocalAppData is not set

Fixes #23146

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

7 years agoruntime: always use 1MB stacks on 32-bit Windows
Austin Clements [Tue, 18 Jul 2017 14:42:45 +0000 (10:42 -0400)]
runtime: always use 1MB stacks on 32-bit Windows

Commit c2c07c7989 (CL 49331) changed the linker and runtime to always
use 2MB stacks on 64-bit Windows. This is the corresponding change to
make 32-bit Windows always use large (1MB) stacks because it's
difficult to detect when Windows applications will call into arbitrary
C code that may expect a large stack.

This is done as a separate change because it's possible this will
cause too much address space pressure for a 32-bit address space. On
the other hand, cgo binaries on Windows already use 1MB stacks and
there haven't been complaints.

Updates #20975.

Change-Id: I8ce583f07cb52254fb4bd47250f1ef2b789bc490
Reviewed-on: https://go-review.googlesource.com/49610
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
7 years agodatabase/sql: fix nil pointer use within withLock
Daniel Theophanes [Thu, 21 Dec 2017 17:31:39 +0000 (09:31 -0800)]
database/sql: fix nil pointer use within withLock

During the refactor in 1126d1483f0397648905fcd4590ae45352cabd69 I
introduced a logical error within one withLock function that used
the result of the call before checking for the error. Change
the order so that the error is checked before the result is used.

None of the other withLock uses have similar issues.

Fixes #23208

Change-Id: I6c5dcf262e36bad4369c850f1e0131066360a82e
Reviewed-on: https://go-review.googlesource.com/85175
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Caleb Spare <cespare@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agodoc/go1.10: mention new os.IsTimeout function
Ian Lance Taylor [Wed, 3 Jan 2018 00:37:48 +0000 (16:37 -0800)]
doc/go1.10: mention new os.IsTimeout function

Change-Id: I84fd3912163ca262df5d7d4690c0dd7e136e79ca
Reviewed-on: https://go-review.googlesource.com/85938
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/compile: disable "redundant zeroextensions" optimization for Select on AMD64
Cherry Zhang [Tue, 2 Jan 2018 20:20:19 +0000 (15:20 -0500)]
cmd/compile: disable "redundant zeroextensions" optimization for Select on AMD64

A Select Op could produce a value with upper 32 bits NOT zeroed,
for example, Div32 is lowered to (Select0 (DIVL x y)).

In theory, we could look into the argument of a Select to decide
whether the upper bits are zeroed. As it is late in release cycle,
just disable this optimization for Select for now.

Fixes #23305.

Change-Id: Icf665a2af9ccb0a7ba0ae00c683c9e349638bf85
Reviewed-on: https://go-review.googlesource.com/85736
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
7 years agonet/http: relax the matching of strace output in test
Caio Marcelo de Oliveira Filho [Tue, 2 Jan 2018 01:17:14 +0000 (17:17 -0800)]
net/http: relax the matching of strace output in test

Modify the regex in TestLinuxSendfile to not match the parameters of
the syscall, just its name and the opening parenthesis. This is enough
to recognize that the syscall was invoked.

This fixes the TestLinuxSendfile test when running in Clear Linux,
where strace always execute with -yy implied, having output with extra
information in the parameters:

    [pid  5336] sendfile(6<TCP:[127.0.0.1:35007->127.0.0.1:55170]>, 8</home/c/src/go/src/net/http/testdata/index.html>, NULL, 22) = 22

Change-Id: If7639b785d5fdf65fae8e6149a97a57b06ea981c
Reviewed-on: https://go-review.googlesource.com/85657
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agomath: correct result for Pow(x, ±.5)
Brian Kessler [Sat, 30 Dec 2017 08:27:28 +0000 (01:27 -0700)]
math: correct result for Pow(x, ±.5)

Fixes #23224

The previous Pow code had an optimization for
powers equal to ±0.5 that used Sqrt for
increased accuracy/speed.  This caused special
cases involving powers of ±0.5 to disagree with
the Pow spec.  This change places the Sqrt optimization
after all of the special case handling.

Change-Id: I6bf757f6248256b29cc21725a84e27705d855369
Reviewed-on: https://go-review.googlesource.com/85660
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agoreflect: explicitly state that Type values can be used as map keys
Tim Cooper [Mon, 1 Jan 2018 16:11:58 +0000 (12:11 -0400)]
reflect: explicitly state that Type values can be used as map keys

Fixes #6535

Change-Id: I34974c0050424c96d19ad69bf4522bb69cde2fd5
Reviewed-on: https://go-review.googlesource.com/85815
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agodoc: 2018 is the Year of the Gopher
Brad Fitzpatrick [Mon, 1 Jan 2018 02:04:51 +0000 (02:04 +0000)]
doc: 2018 is the Year of the Gopher

Change-Id: Ie167512e000f3a8be0ff8a6a9edd52bd74f45115
Reviewed-on: https://go-review.googlesource.com/85775
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
7 years agocrypto/tls: document VerifyPeerCertificate behavior in relation to ClientAuth
Filippo Valsorda [Sat, 16 Dec 2017 13:35:52 +0000 (09:35 -0400)]
crypto/tls: document VerifyPeerCertificate behavior in relation to ClientAuth

Change-Id: I3ff478912a5a178492d544d2f4ee9cc7570d9acc
Reviewed-on: https://go-review.googlesource.com/84475
Reviewed-by: Filippo Valsorda <hi@filippo.io>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoencoding/xml: remove duplicate test of element presence
Igor Vashyst [Sat, 30 Dec 2017 21:13:28 +0000 (23:13 +0200)]
encoding/xml: remove duplicate test of element presence

Change-Id: If0d9ff107fc6bbdf0231cd48abc23a44816bfe77
Reviewed-on: https://go-review.googlesource.com/85755
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agoos: document that StartProcess's argv starts with the binary name
Brad Fitzpatrick [Fri, 29 Dec 2017 01:15:23 +0000 (01:15 +0000)]
os: document that StartProcess's argv starts with the binary name

Fixes #23277

Change-Id: Idbe09913c95dc951b9b195eb7ff1e75d2bb4d63d
Reviewed-on: https://go-review.googlesource.com/85675
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/vendor/golang.org/x/arch: revendor at commit 98fd8d9
Cherry Zhang [Wed, 27 Dec 2017 13:33:45 +0000 (08:33 -0500)]
cmd/vendor/golang.org/x/arch: revendor at commit 98fd8d9

Pick up CL 85476 to fix #23237.

Updates #23237.

Change-Id: I31a48ef39ce90bc1424334762452281ae706d273
Reviewed-on: https://go-review.googlesource.com/85495
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agonet: revert CL 82975
Jeff Johnson [Fri, 22 Dec 2017 16:30:39 +0000 (08:30 -0800)]
net: revert CL 82975

this solution as it stands doesn't work with
non-english device names (golang/go#23191 (which has a fix))
and names some devices differently (golang/go#23153) probably due to the
fact that this test previously only ran on Server 2008.

Re-opens golang/go#20073

Change-Id: I5c36774ddd85ac07620b4015372d564acbb169ad
Reviewed-on: https://go-review.googlesource.com/85315
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
7 years agospec: provide some (minimal) intuition for the notion of "terminating statement"
Robert Griesemer [Thu, 21 Dec 2017 23:17:35 +0000 (15:17 -0800)]
spec: provide some (minimal) intuition for the notion of "terminating statement"

Fixes #23215.

Change-Id: Ib20825bf08915b4daaabbfd91f168e24973c512d
Reviewed-on: https://go-review.googlesource.com/85215
Reviewed-by: Rob Pike <r@golang.org>
7 years agocmd/compile: additional test cleanup
David Chase [Wed, 20 Dec 2017 20:27:44 +0000 (15:27 -0500)]
cmd/compile: additional test cleanup

Refactoring to make it slightly easier to add tests,
easier to add variable-printing-support for Delve,
and made naming and tagging more consistent.

No changes to the content of the test itself or when it is
run.

Change-Id: I374815b65a203bd43b27edebd90b859466d1c33b
Reviewed-on: https://go-review.googlesource.com/84979
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
7 years agocmd/internal/obj/arm: fix wrong encoding of NMULAF/NMULAD/NMULSF/NMULSD
Ben Shi [Thu, 21 Dec 2017 11:29:24 +0000 (11:29 +0000)]
cmd/internal/obj/arm: fix wrong encoding of NMULAF/NMULAD/NMULSF/NMULSD

NMULAF/NMULAD/NMULSF/NMULSD are incorrectly encoded by the arm
assembler.

Instruction            Right binary      Current wrong binary
"NMULAF F5, F6, F7"    0xee167a45        0xee167a05
"NMULAD F5, F6, F7"    0xee167b45        0xee167b05
"NMULSF F5, F6, F7"    0xee167a05        0xee167a45
"NMULSD F5, F6, F7"    0xee167b05        0xee167b45

This patch fixes this issue.

fixes issue #23212

Change-Id: Ic9c203f92c34b90d6eef492a694c0e95b4d479c5
Reviewed-on: https://go-review.googlesource.com/85116
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agogo/types: document Typ slice
Robert Griesemer [Wed, 20 Dec 2017 23:14:05 +0000 (15:14 -0800)]
go/types: document Typ slice

Fixes #22628.

Change-Id: Ib7aff8043e477af18c448d6b778f159b23fb5a92
Reviewed-on: https://go-review.googlesource.com/85075
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/trace: init goroutine info entries with GoCreate event
Hana Kim [Tue, 12 Dec 2017 23:20:06 +0000 (18:20 -0500)]
cmd/trace: init goroutine info entries with GoCreate event

golang.org/cl/81315 attempted to distinguish system goroutines
by examining the function name in the goroutine stack. It assumes that
the information would be available when GoSysBlock or GoInSyscall
events are processed, but it turned out the stack information is
set too late (when the goroutine gets a chance to run).

This change initializes the goroutine information entry when
processing GoCreate event which should be one of the very first
events for the every goroutine in trace.

Fixes #22574

Change-Id: I1ed37087ce2e78ed27c9b419b7d942eb4140cc69
Reviewed-on: https://go-review.googlesource.com/83595
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agocmd/compile: second attempt at fix for issue 23179
Than McIntosh [Wed, 20 Dec 2017 14:54:13 +0000 (09:54 -0500)]
cmd/compile: second attempt at fix for issue 23179

My previous fix for issue 23179 was incomplete; it turns out that if
an unnamed parameter is below a specific size threshold, it gets
register-promoted away by the compiler (hence not encountered during
some parts of DWARF inline info processing), but if it is sufficiently
large, it is allocated to the stack as a named variable and treated as
a regular parameter by DWARF generation. Interestingly, something in
the ppc64le build of k8s causes an unnamed parameter to be retained
(where on amd64 it is deleted), meaning that this wasn't caught in my
amd64 testing.

The fix is to insure that "_" params are treated in the same way that
"~r%d" return temps are when matching up post-optimization inlined
routine params with pre-inlining declarations. I've also updated the
test case to include a "_" parameter with a very large size, which
also triggers the bug on amd64.

Fixes #23179.

Change-Id: I961c84cc7a873ad3f8f91db098a5e13896c4856e
Reviewed-on: https://go-review.googlesource.com/84975
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
7 years agocmd/doc: suppress the error message for *package.ident embedded in struct type
elpinal [Sat, 16 Dec 2017 06:04:05 +0000 (15:04 +0900)]
cmd/doc: suppress the error message for *package.ident embedded in struct type

The current implementation prints a log, "invalid program: unexpected
type for embedded field", when the form *package.ident is embedded in
a struct declaration.

Note that since valid qualified identifiers must be exported, the result
for a valid program does not change.

Change-Id: If8b9d7056c56b6a6c5482eb749168a63c65ef685
Reviewed-on: https://go-review.googlesource.com/84436
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agocmd/compile: fix spelling error
Kevin Burke [Tue, 19 Dec 2017 20:31:14 +0000 (12:31 -0800)]
cmd/compile: fix spelling error

Change-Id: Ifc533ee98a7684060d20340087c1b29f722ae46b
Reviewed-on: https://go-review.googlesource.com/84835
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/compile: fix corner case in DWARF inline info generation
Than McIntosh [Tue, 19 Dec 2017 17:08:32 +0000 (12:08 -0500)]
cmd/compile: fix corner case in DWARF inline info generation

The helper routine for returning pre-inlining parameter declarations
wasn't properly handling the case where you have more than one
parameter named "_" in a function signature; this triggered a map
collision later on when the function was inlined and DWARF was
generated for the inlined routine instance.

Fixes #23179.

Change-Id: I12e5d6556ec5ce08e982a6b53666a4dcc1d22201
Reviewed-on: https://go-review.googlesource.com/84755
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
7 years agodatabase/sql/driver: update Value doc, can be driver supported type
Daniel Theophanes [Mon, 18 Dec 2017 20:13:17 +0000 (12:13 -0800)]
database/sql/driver: update Value doc, can be driver supported type

The driver.Value type may be more then the documented 6 types if the
database driver supports it. Document that fact.

Updates #23077

Change-Id: If7e2112fa61a8cc4e155bb31e94e89b20c607242
Reviewed-on: https://go-review.googlesource.com/84636
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/internal/link: disable selected DWARF tests on Solaris
Than McIntosh [Mon, 18 Dec 2017 18:58:41 +0000 (13:58 -0500)]
cmd/internal/link: disable selected DWARF tests on Solaris

Disable the three linker DWARF tests that invoke the compiler in
non-debug mode on Solaris, since this seems to trigger a split stack
overflow. These can be turned back on once the issue in question is
resolved.

Updates #23168.

Change-Id: I5be1b098e33e8bad3bc234a0964eab1dee7e7954
Reviewed-on: https://go-review.googlesource.com/84655
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>

7 years agogo/types: rename (historic) flag "-list" used for go/types testing
Robert Griesemer [Sat, 16 Dec 2017 01:06:43 +0000 (17:06 -0800)]
go/types: rename (historic) flag "-list" used for go/types testing

Rename -list flag to -errlist to avoid confusion with the go
test flag -list (introduced later).

This flag is only needed to get an error list when running the
go/types test harness manually on select files, e.g., as in:

go test -run=Check -files=x.go -errlist

Change-Id: I67febcf968d2d8f4ff00c81eea7b2df723560eac
Reviewed-on: https://go-review.googlesource.com/84378
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/compile: clean up debug_test.go
David Chase [Thu, 14 Dec 2017 18:41:13 +0000 (13:41 -0500)]
cmd/compile: clean up debug_test.go

Exercise of preparing a how-to document motivated me to
clean up some of the stupider wonkier bits.  Since this
does not run for test -short, expect no change for trybots,
did pass testing with OSX gdb and a refreshed copy of Delve.

Change-Id: I58edd10599b172c4787ff5f110db078f6c2c81c5
Reviewed-on: https://go-review.googlesource.com/83957
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
7 years agocmd/link: make inlining+locationlist test depend on GOARCH
David Chase [Fri, 15 Dec 2017 20:56:51 +0000 (15:56 -0500)]
cmd/link: make inlining+locationlist test depend on GOARCH

Location lists are only supported on x86 and amd64, so the
test expecting them failed everywhere else. Make that test
skip unless GOARCH is x86 or amd64.

Change-Id: Id86b34d30c6a0b97e6fa0cd5aca31f51ed84f556
Reviewed-on: https://go-review.googlesource.com/84395
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoos: mention the influence of umask in docs
Matthijs Kooijman [Wed, 13 Dec 2017 15:45:09 +0000 (16:45 +0100)]
os: mention the influence of umask in docs

Change-Id: Ia05fac3298334d6b44267ce02bffcd7bf8a54c72
Reviewed-on: https://go-review.googlesource.com/83775
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/dist: let misc/cgo/testshared test timeout be scaled by slow builder
Brad Fitzpatrick [Fri, 15 Dec 2017 16:34:39 +0000 (16:34 +0000)]
cmd/dist: let misc/cgo/testshared test timeout be scaled by slow builder

The default test timeout is 10 minutes if unspecified.

The misc/cgo/testshared test didn't use t.timeout(sec), which respects
GO_TEST_TIMEOUT_SCALE, so all builders got the default 10 minute
timeout. arm5 needs more, though, so specify 10 minutes explicitly,
which will then get scaled accordingly on slower builders.

Change-Id: I19ecfdcd9c865f2b69524484415b8fbd2852718e
Reviewed-on: https://go-review.googlesource.com/84315
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
7 years agocmd/compile: fixes for bad DWARF abstract origin references
Than McIntosh [Mon, 11 Dec 2017 20:53:31 +0000 (15:53 -0500)]
cmd/compile: fixes for bad DWARF abstract origin references

Change the compiler's DWARF inline info generation to be more careful
about producing consistent instances of abstract function DIEs. The
new strategy is to insure that the only params/variables created in an
abstract subprogram DIE are those corresponding to declarations in the
original pre-inlining version of the code. If a concrete subprogram
winds up with other vars as part of the compilation process (return
temps, for example, or scalars generated by splitting a structure into
pieces) these are emitted as regular param/variable DIEs instead of
concrete DIEs.

The linker dwarf test now has a couple of new testpoints that include
checks to make sure that all abstract DIE references are
sane/resolvable; this will help catch similar problems in the future.

Fixes #23046.

Change-Id: I9b0030da8673fbb80b7ad50461fcf8c6ac823a37
Reviewed-on: https://go-review.googlesource.com/83675
Run-TryBot: Than McIntosh <thanm@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agoruntime: symbolize morestack caller in throwsplit panic
Austin Clements [Thu, 14 Dec 2017 20:32:12 +0000 (15:32 -0500)]
runtime: symbolize morestack caller in throwsplit panic

This attempts to symbolize the PC of morestack's caller when there's a
stack split at a bad time. The stack trace starts at the *caller* of
the function that attempted to grow the stack, so this is useful if it
isn't obvious what's being called at that point, such as in #21431.

Change-Id: I5dee305d87c8069611de2d14e7a3083d76264f8f
Reviewed-on: https://go-review.googlesource.com/84115
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agodoc/debugging_with_gdb: update -gcflags usage
Hana Kim [Thu, 14 Dec 2017 21:11:03 +0000 (16:11 -0500)]
doc/debugging_with_gdb: update -gcflags usage

After go1.10, compiler/linker option flags apply only to the packages
listed directly on the command line unless the matching pattern is
specified. For debugging, we want to apply the flags to all packages.

Change-Id: Ic69eee1491b1080fc140592f200c59a6e03d87ac
Reviewed-on: https://go-review.googlesource.com/84135
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/dist: increase default cmd/go test timeout
Brad Fitzpatrick [Fri, 15 Dec 2017 01:49:04 +0000 (01:49 +0000)]
cmd/dist: increase default cmd/go test timeout

cmd/go has grown slow, even in short mode, and it's now regularly
failing on a number of builders where it's taking over the previous 3
minute timeout. for now, give it more time.

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

7 years agogo/types: collect methods with parenthesized receiver types
Robert Griesemer [Thu, 14 Dec 2017 06:49:23 +0000 (22:49 -0800)]
go/types: collect methods with parenthesized receiver types

The existing code simply dropped them on the floor. Don't do that.

Fixes #23130.

Change-Id: I10f20e41f2c466a76519983253f87af7cf6d5e70
Reviewed-on: https://go-review.googlesource.com/83918
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
7 years agocmd/compile/internal/ssa: group dump files alphabetically
Geoff Berry [Thu, 14 Dec 2017 18:35:59 +0000 (13:35 -0500)]
cmd/compile/internal/ssa: group dump files alphabetically

Change dump file names to group them alphabetically in directory
listings, in pass run order.

Change-Id: I8070578a5b4a3a7983dcc527ea1cfdb10a6d7d24
Reviewed-on: https://go-review.googlesource.com/83958
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agocmd/vet: limit printf check to known Printf-like functions
Russ Cox [Wed, 13 Dec 2017 19:45:50 +0000 (14:45 -0500)]
cmd/vet: limit printf check to known Printf-like functions

The name-based heuristics fail too often to be on during "go test",
but we really want the printf vet check in "go test", so change to
a list of exactly which standard library functions are print-like.

For a later release we'd like to bring back checking for user-defined
wrappers, but in a completely precise way. Not for Go 1.10, though.

The new, more precise list includes t.Skipf, which caught some
mistakes in standard library tests.

Fixes #22936.

Change-Id: I110448e3f6b75afd4327cf87b6abb4cc2021fd0d
Reviewed-on: https://go-review.googlesource.com/83838
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/go: vet support for upcoming cmd/vet fixes
Russ Cox [Wed, 13 Dec 2017 19:39:40 +0000 (14:39 -0500)]
cmd/go: vet support for upcoming cmd/vet fixes

Two minor changes to allow fixes in cmd/vet's printf checking.

1. Pass package import path in vet config, so that vet knows
whether it is, for example, vetting "fmt".

2. Add new, but undocumented and for now unsupported
flag -vettool to control which vet binary is invoked during go vet.
This lets the cmd/vet tests build and test a throwaway vet.exe
using cmd/go to ensure type checking information, all without
installing a potentially buggy cmd/vet.

For #22936.

Change-Id: I18df7c796ebc711361c847c63eb3ee17fb041ff7
Reviewed-on: https://go-review.googlesource.com/83837
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agohtml/template: add srcset content type
Mike Samuel [Sun, 19 Nov 2017 21:37:07 +0000 (06:37 +0900)]
html/template: add srcset content type

Srcset is largely the same as a URL, but is escaped in URL contexts.
Inside a srcset attribute, URLs have their commas percent-escaped to
avoid having the URL be interpreted as multiple URLs.  Srcset is placed
in a srcset attribute literally.

Fixes #17441

Change-Id: I676b544784c7e54954ddb91eeff242cab25d02c4
Reviewed-on: https://go-review.googlesource.com/38324
Reviewed-by: Kunpei Sakai <namusyaka@gmail.com>
Reviewed-by: Mike Samuel <mikesamuel@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agocmd/go: do not let test vet failures stop reporting of later test results
Russ Cox [Thu, 14 Dec 2017 02:11:47 +0000 (21:11 -0500)]
cmd/go: do not let test vet failures stop reporting of later test results

(This only manifested in test vet failures for packages without tests,
or else we'd probably have seen this sooner.)

Fixes #23047.

Change-Id: I41d09a7780999bbe1951377ffcc811ba86ea5000
Reviewed-on: https://go-review.googlesource.com/83955
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agodoc: make it clear which pprof package is used
JBD [Wed, 13 Dec 2017 23:57:46 +0000 (15:57 -0800)]
doc: make it clear which pprof package is used

Updates #22027.

Change-Id: I5a5bae77a744c7a2ecb75172846e6461a98ee8af
Reviewed-on: https://go-review.googlesource.com/83916
Reviewed-by: Andrew Bonventre <andybons@golang.org>
7 years agodoc/go1.10: note that netbsd/arm is definitely broken
Brad Fitzpatrick [Wed, 13 Dec 2017 21:18:28 +0000 (21:18 +0000)]
doc/go1.10: note that netbsd/arm is definitely broken

Remove the ambiguity, know that we know it's actually broken,
per https://github.com/golang/go/issues/23073#issuecomment-351045421

Updates #23073

Change-Id: I9b904da2f4c7105a0727d2a9056aaa6895d3dadc
Reviewed-on: https://go-review.googlesource.com/83856
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agoA+C: automated updates for Go 1.10
Brad Fitzpatrick [Wed, 13 Dec 2017 22:11:57 +0000 (22:11 +0000)]
A+C: automated updates for Go 1.10

Add Adam Thomason (individual CLA)
Add Adrian Hesketh (individual CLA)
Add Aeneas Rekkas (arekkas) (individual CLA)
Add Afanasev Stanislav (individual CLA)
Add Agniva De Sarker (individual CLA)
Add Alexander Pantyukhin (individual CLA)
Add Alexandre Parentea (individual CLA)
Add Aman Gupta (individual CLA)
Add Anand K. Mistry (individual CLA)
Add Andrii Soldatenko (individual CLA)
Add Andrii Soluk (individual CLA)
Add Andrzej Żeżel (individual CLA)
Add Anthony Alves (individual CLA)
Add Anthony Sottile (individual CLA)
Add Ariel Mashraki (individual CLA)
Add Axel Wagner (individual CLA)
Add Ben Haines (individual CLA)
Add Ben Laurie (corporate CLA for Google Inc.)
Add Ben Schwartz (corporate CLA for Google Inc.)
Add Blain Smith (individual CLA)
Add Blake Mesdag (individual CLA)
Add Borja Clemente (individual CLA)
Add Brett Merrill (individual CLA)
Add Brian Kessler (individual CLA)
Add Burak Guven (individual CLA)
Add Cholerae Hu (individual CLA)
Add Chris Ball (individual CLA)
Add Christian Alexander (individual CLA)
Add Christopher Henderson (individual CLA)
Add Christopher Koch (corporate CLA for Google Inc.)
Add Christos Zoulas (individual CLA)
Add Daniela Petruzalek (individual CLA)
Add Danny Rosseau (individual CLA)
Add Davor Kapsa (individual CLA)
Add Edan Bedrik (individual CLA)
Add Elbert Fliek (individual CLA)
Add Elena Grahovac (individual CLA)
Add Emerson Lin (individual CLA)
Add Eric Rescorla (individual CLA)
Add Evan Jones (individual CLA)
Add Frank Somers (individual CLA)
Add Frederic Guillot (individual CLA)
Add Garret Kelly (corporate CLA for Google Inc.)
Add Grant Griffiths (individual CLA)
Add Guilherme Garnier (individual CLA)
Add Guilherme Rezende (individual CLA)
Add Hanjun Kim (individual CLA)
Add Henry Adi Sumarto (individual CLA)
Add Henry Bubert (individual CLA)
Add Herbie Ong (corporate CLA for Google Inc.)
Add Hilko Bengen (individual CLA)
Add Hiroaki Nakamura (individual CLA)
Add Ian Kent (individual CLA)
Add Inanc Gumus (individual CLA)
Add Iskander Sharipov (corporate CLA for Intel Corporation)
Add Ivan Bertona (individual CLA)
Add James Lawrence (individual CLA)
Add James Treanor (individual CLA)
Add Jamie Liu (corporate CLA for Google Inc.)
Add Jared Culp (individual CLA)
Add Jason Wangsadinata (individual CLA)
Add Javier Segura (individual CLA)
Add Jean-Francois Cantin (individual CLA)
Add Jeet Parekh (individual CLA)
Add Jelte Fennema (individual CLA)
Add Jimmy Frasche (individual CLA)
Add Joshua Rubin (individual CLA)
Add Juan Carlos (individual CLA)
Add Jude Pereira (individual CLA)
Add Karel Pazdera (individual CLA)
Add Karsten Köhler (individual CLA)
Add Kenji Yano (individual CLA)
Add Kevin Ruffin (individual CLA)
Add Kieran Colford (individual CLA)
Add Kirk Han (individual CLA)
Add Kunpei Sakai (individual CLA)
Add Kyle Shannon (individual CLA)
Add Kyohei Kadota (individual CLA)
Add Lakshay Garg (individual CLA)
Add Lann Martin (corporate CLA for Google Inc.)
Add Laurent Voisin (individual CLA)
Add Leigh McCulloch (individual CLA)
Add Lorenz Bauer (corporate CLA for CloudFlare, Inc.)
Add Luca Bruno (corporate CLA for CoreOS, Inc)
Add Luke Granger-Brown (individual CLA)
Add Lyle Franklin (individual CLA)
Add Maicon Costa (individual CLA)
Add Manish Goregaokar (individual CLA)
Add Mansour Rahimi (individual CLA)
Add Mark Percival (individual CLA)
Add Mark Pulford (individual CLA)
Add Mark Wolfe (individual CLA)
Add Martins Sipenko (individual CLA)
Add Mat Byczkowski (individual CLA)
Add Matej Baćo (individual CLA)
Add Mateus Amin (individual CLA)
Add Matt Dee (individual CLA)
Add Matthew Broberg (individual CLA)
Add Max Schmitt (individual CLA)
Add Mayank Kumar (individual CLA)
Add Michael Brandenburg (individual CLA)
Add Michael McLoughlin (individual CLA)
Add Michael Schurter (individual CLA)
Add Michael Steinert (individual CLA)
Add Michal Pristas (individual CLA)
Add Mihail Minaev (individual CLA)
Add Muhammad Falak R Wani (individual CLA)
Add Naoki Kanatani (individual CLA)
Add Nicolas BRULEZ (individual CLA)
Add Nils Larsgård (individual CLA)
Add Noble Johnson (individual CLA)
Add Paul Boyd (individual CLA)
Add Paul Ruest (individual CLA)
Add Peter Wu (corporate CLA for CloudFlare, Inc.)
Add Petrica Voicu (individual CLA)
Add Pontus Leitzler (individual CLA)
Add Radek Sohlich (individual CLA)
Add Rajath Agasthya (individual CLA)
Add Rajender Reddy Kompally (individual CLA)
Add Ramazan AYYILDIZ (individual CLA)
Add RaviTeja Pothana (individual CLA)
Add Reilly Watson (individual CLA)
Add Roman Budnikov (individual CLA)
Add Ross Chater (individual CLA)
Add Rudi Kramer (individual CLA)
Add Ryoichi KATO (individual CLA)
Add Ryuji Iwata (individual CLA)
Add Scott Crunkleton (individual CLA)
Add Seiji Takahashi (individual CLA)
Add Sergey Frolov (corporate CLA for Google Inc.)
Add Sergey Semin (individual CLA)
Add Sergiusz Bazanski (individual CLA)
Add Stanislav Afanasev (individual CLA)
Add Sukrit Handa (individual CLA)
Add Sylvain Zimmer (individual CLA)
Add Tao Wang (individual CLA)
Add Terin Stock (individual CLA)
Add Thiago Avelino (individual CLA)
Add Thomas Wanielista (individual CLA)
Add Tim Cooper (individual CLA)
Add Tim Wright (individual CLA)
Add Tobias Assarsson (individual CLA)
Add Tom Lanyon (corporate CLA for Google Inc.)
Add Tom Levy (individual CLA)
Add Troels Thomsen (individual CLA)
Add Tugdual Saunier (individual CLA)
Add Tyler Bui-Palsulich (corporate CLA for Google Inc.)
Add Wembley G. Leach, Jr (individual CLA)
Add Will Faught (individual CLA)
Add Wèi Cōngruì (individual CLA)
Add Xi Ruoyao (individual CLA)
Add Yann Salaün (individual CLA)
Add Yosuke Akatsuka (individual CLA)
Add Zach Gershman (individual CLA)
Add Zhengyu He (corporate CLA for Google Inc.)
Add Zhongtao Chen (individual CLA)
Add Роман Хавроненко (individual CLA)
Add Тарас Буник (individual CLA)

Updates #12042

Change-Id: If8fd708d32434b8ba21a0b3ef433b0d176626ce8
Reviewed-on: https://go-review.googlesource.com/83858
Reviewed-by: Andrew Bonventre <andybons@golang.org>
7 years agodoc/go1.10: fix formatting of 'go tool fix' examples
Tobias Klauser [Thu, 14 Dec 2017 09:48:53 +0000 (10:48 +0100)]
doc/go1.10: fix formatting of 'go tool fix' examples

Also remove a superfluous </p>

Change-Id: Idca51cdfbd8abc6669f00c80ca3fb7f225ee445c
Reviewed-on: https://go-review.googlesource.com/84015
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agotesting: do not crash when m.Run is called twice and -test.testlogfile is used
Russ Cox [Thu, 14 Dec 2017 02:46:03 +0000 (21:46 -0500)]
testing: do not crash when m.Run is called twice and -test.testlogfile is used

Tests exist that call m.Run in a loop‽
Now we have one too.

Fixes #23129.

Change-Id: I8cbecb724f239ae14ad45d75e67d12c80e41c994
Reviewed-on: https://go-review.googlesource.com/83956
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agoos: don't wait for Close if the File was returned by NewFile
Wèi Cōngruì [Thu, 14 Dec 2017 02:54:11 +0000 (10:54 +0800)]
os: don't wait for Close if the File was returned by NewFile

os.NewFile doesn't put the fd into non-blocking mode.
In most cases, an *os.File returned by os.NewFile is in blocking mode.

Updates #7970
Updates #21856
Updates #23111

Change-Id: Iab08432e41f7ac1b5e25aaa8855d478adb7f98ed
Reviewed-on: https://go-review.googlesource.com/83995
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/cgo: don't define intgo in export prologue
Ian Lance Taylor [Thu, 14 Dec 2017 01:29:28 +0000 (17:29 -0800)]
cmd/cgo: don't define intgo in export prologue

The export prologue goes into the _cgo_export.h file, where it may be
be #include'd by a .swig file. As SWIG defines its own type "intgo",
the definition of "intgo" in the export prologue could conflict.
Since we don't need to define "intgo" in the _cgo_export.h file, don't.

Defining "intgo" in _cgo_export.h was new for this release, so this
should not break any existing code.

No test case as I can't quite bring myself to write a test that
combines SWIG and cgo.

Change-Id: I8073e8300a1860cecd5994b9ad07dd35a4298c89
Reviewed-on: https://go-review.googlesource.com/83936
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agotesting: emphasize that Fatal/FailNow/etc run deferred calls
Russ Cox [Thu, 14 Dec 2017 01:08:03 +0000 (20:08 -0500)]
testing: emphasize that Fatal/FailNow/etc run deferred calls

Fixes #22989.

Change-Id: I9776a7b0d0598c2cb118c323d1f8f933665da254
Reviewed-on: https://go-review.googlesource.com/83881
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
7 years agotesting: define Run result a little more clearly
Russ Cox [Thu, 14 Dec 2017 01:04:43 +0000 (20:04 -0500)]
testing: define Run result a little more clearly

t.Run(f) does not wait for f after f calls t.Parallel.
Otherwise it would be impossible to create new
parallel sibling subtests for f.

Fixes #22993.

Change-Id: I27e1555ab1ff608eb8155db261d5e7ee8f486aef
Reviewed-on: https://go-review.googlesource.com/83880
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/go: apply same per-package flags to compile and link of test
Russ Cox [Thu, 14 Dec 2017 00:47:32 +0000 (19:47 -0500)]
cmd/go: apply same per-package flags to compile and link of test

If package strings has a particular set of gcflags, then the strings_test
pseudo-package built as part of the test binary started inheriting the
same flags in CL 81496, to fix #22831.

Now the package main and final test binary link built as part of the
strings test binary also inherit the same flags, to fix #22994.

I am slightly uneasy about reusing package strings's flags for
package main, but the alternative would be to introduce some
kind of special case, which I'd be even more uneasy about.

This interpretation preserves the Go 1.9 behavior of existing
commands like:

go test -c -ldflags=-X=mypkg.debugString=foo mypkg

Fixes #22994.

Change-Id: I9ab83bf1a9a6adae530a7715b907e709fd6c1b5d
Reviewed-on: https://go-review.googlesource.com/83879
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agonet, os: don't wait for Close in blocking mode
Ian Lance Taylor [Wed, 13 Dec 2017 14:32:06 +0000 (06:32 -0800)]
net, os: don't wait for Close in blocking mode

Updates #7970
Updates #21856
Updates #23111

Change-Id: I0cd0151fcca740c40c3c976f941b04e98e67b0bf
Reviewed-on: https://go-review.googlesource.com/83715
Reviewed-by: Russ Cox <rsc@golang.org>
7 years agogo/types: remove TODOs from API that cannot be changed (cleanup)
Robert Griesemer [Thu, 14 Dec 2017 00:40:39 +0000 (16:40 -0800)]
go/types: remove TODOs from API that cannot be changed (cleanup)

Change-Id: I4e357a250b2f9cfbf780b05c5f54805682b19a62
Reviewed-on: https://go-review.googlesource.com/83935
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
7 years agodoc: add some links to the diagnostics page
JBD [Thu, 14 Dec 2017 00:03:19 +0000 (16:03 -0800)]
doc: add some links to the diagnostics page

Updates #22027.

Change-Id: I468348d2b000f146f88ef8b7cf450eea8d1c12a7
Reviewed-on: https://go-review.googlesource.com/83917
Reviewed-by: Andrew Bonventre <andybons@golang.org>
7 years agotest: skip "# package/path" output from cmd/go in errchk
Russ Cox [Wed, 13 Dec 2017 19:38:58 +0000 (14:38 -0500)]
test: skip "# package/path" output from cmd/go in errchk

This allows errchk to be used with "go vet" output (as opposed to "go tool vet").

Change-Id: I0009a53c9cb74accd5bd3923c137d6dbf9e46326
Reviewed-on: https://go-review.googlesource.com/83836
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoall: fix t.Skipf formats
Russ Cox [Wed, 13 Dec 2017 19:57:44 +0000 (14:57 -0500)]
all: fix t.Skipf formats

Found by upcoming cmd/vet change.

Change-Id: I7a8264a304b2a4f26f3bd418c1b28cc849889c9b
Reviewed-on: https://go-review.googlesource.com/83835
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agocrypto/x509: load all trusted certs on darwin (cgo)
Nathaniel Caza [Tue, 14 Feb 2017 03:15:40 +0000 (21:15 -0600)]
crypto/x509: load all trusted certs on darwin (cgo)

The current implementation ignores certs wherein the
Subject does not match the Issuer. An example of where
this causes issue is an enterprise environment with
intermediate CAs. In this case, the issuer is separate
(and may be loaded) but the intermediate is ignored.
A TLS handshake that does not include the intermediate
cert would then fail with an untrusted error in Go.

On other platforms (darwin-nocgo included), all trusted
certs are loaded and accepted reguardless of
Subject/Issuer names.

This change removes the Subject/Issuer name-matching
restriction of certificates when trustAsRoot is set,
allowing all trusted certs to be loaded on darwin (cgo).

Refs #16532

Change-Id: I451e929588f8911892be6bdc2143d0799363c5f8
Reviewed-on: https://go-review.googlesource.com/36942
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodoc: update info about flame graphs in diagnostics.html
Hana Kim [Wed, 13 Dec 2017 17:59:12 +0000 (12:59 -0500)]
doc: update info about flame graphs in diagnostics.html

Use Brendan Gregg's FlameGraphs page link.
Mention the flame graph is available from the upstream pprof.

Change-Id: Ife1d5a5f4f93f20cd5952a09083f798b77d25a60
Reviewed-on: https://go-review.googlesource.com/83798
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodoc/go1.10: preannounce deprecation of OS X 10.9 Mavericks
Russ Cox [Wed, 13 Dec 2017 16:00:14 +0000 (11:00 -0500)]
doc/go1.10: preannounce deprecation of OS X 10.9 Mavericks

By the time Go 1.11 is released, OS X 10.9 Mavericks will have gone
two years with no security updates.

For #23011.

Change-Id: I6482852a14477985769b72c45c92416aae8be100
Reviewed-on: https://go-review.googlesource.com/83795
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agotime: add space padding layout strings(using underscore) for not only day but others
Hanjun Kim [Mon, 20 Nov 2017 05:23:06 +0000 (14:23 +0900)]
time: add space padding layout strings(using underscore) for not only day but others

As mentioned in #22802, only day component of layout string has space
padding(represented by one underscore before its placeholder). This
commit expands the rule for month, hour, minute and second.

Updates #22802 (maybe fixes it)

Change-Id: I886998380489862ab9a324a6774f2e4cf7124122
Reviewed-on: https://go-review.googlesource.com/78735
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
7 years agocmd/go: don't use a testlog if there is an exec command
Ian Lance Taylor [Wed, 13 Dec 2017 01:41:49 +0000 (17:41 -0800)]
cmd/go: don't use a testlog if there is an exec command

An exec command is normally used on platforms were the test is run in
some unusual way, making it less likely that the testlog will be useful.

Updates #22593

Change-Id: I0768f6da89cb559d8d675fdf6d685db9ecedab9e
Reviewed-on: https://go-review.googlesource.com/83578
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodoc/go1.10: note that plugin now works on darwin/amd64
Brad Fitzpatrick [Wed, 13 Dec 2017 01:20:02 +0000 (01:20 +0000)]
doc/go1.10: note that plugin now works on darwin/amd64

Fixes #23085

Change-Id: I7fef281079e9e08c49ae05371506b0b881a467db
Reviewed-on: https://go-review.googlesource.com/83577
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/compile: remove broken inlining accounting code
Matthew Dempsky [Tue, 12 Dec 2017 19:13:49 +0000 (11:13 -0800)]
cmd/compile: remove broken inlining accounting code

We can't currently inline functions that contain closures anyway, so
just delete this budgeting code for now. Re-enable once we can (if
ever) inline functions with nested closures.

Updates #15561.
Fixes #23093.

Change-Id: Idc5f8e042ccfcc8921022e58d3843719d4ab821e
Reviewed-on: https://go-review.googlesource.com/83538
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
7 years agocmd/link: with -importcfg don't strip trailing ".a"
Ian Lance Taylor [Tue, 5 Dec 2017 07:10:56 +0000 (23:10 -0800)]
cmd/link: with -importcfg don't strip trailing ".a"

When using -importcfg, the import paths recorded by the compiler in
the object file are simply the import paths. When not using -importcfg,
the import paths have a trailing ".a". Assume that if we are using
-importcfg with the compiler, we are using it with the linker,
and so if the linker sees an -importcfg option it should not
strip ".a" from the import path read from the object files.

This was mostly working because the linker only strips a trailing
".x" for a literal dot and any single character 'x'. Since few import
paths end with ".x", most programs worked fine.

Fixes #22986

Change-Id: I6c10a160b97dd63fff3931f27a1514c856e8cd52
Reviewed-on: https://go-review.googlesource.com/81878
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
7 years agocmd/go: remove file created by test
Ian Lance Taylor [Mon, 11 Dec 2017 23:08:19 +0000 (15:08 -0800)]
cmd/go: remove file created by test

The file cmd/go/testdata/src/testcache/script.sh was accidentally
committed with CL 83256. Sorry about that.

Updates #22593

Change-Id: Id8f07587ea97015ed75439db220560a5446e53e6
Reviewed-on: https://go-review.googlesource.com/83395
Reviewed-by: Russ Cox <rsc@golang.org>
7 years agoos: don't use test logger for Getwd
Ian Lance Taylor [Tue, 12 Dec 2017 00:41:37 +0000 (16:41 -0800)]
os: don't use test logger for Getwd

Otherwise, on systems for which syscall does not implement Getwd,
a lot of unnecessary files and directories get added to the testlog,
right up the root directory. This was causing tests on such systems
to fail to cache in practice.

Updates #22593

Change-Id: Ic8cb3450ea62aa0ca8eeb15754349f151cd76f85
Reviewed-on: https://go-review.googlesource.com/83455
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agoplugin: document support for macOS
David Crawshaw [Sat, 23 Sep 2017 15:55:02 +0000 (11:55 -0400)]
plugin: document support for macOS

All plugins issues I would call bugs now closed, so
(with some amount of optimism) update the plugin documentation.

Change-Id: Ia421c18a166d7cdf599ac86f2336541c1ef42a0d
Reviewed-on: https://go-review.googlesource.com/65670
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/go: remove script.sh in TestTestCacheInputs
Ian Lance Taylor [Mon, 11 Dec 2017 20:11:19 +0000 (12:11 -0800)]
cmd/go: remove script.sh in TestTestCacheInputs

Updates #22593

Change-Id: I76e52dc8b874da13ae9e2d80e5c0d6d8424b67db
Reviewed-on: https://go-review.googlesource.com/83257
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/go: don't pass -test.testlogfile on NaCl
Ian Lance Taylor [Mon, 11 Dec 2017 19:28:50 +0000 (11:28 -0800)]
cmd/go: don't pass -test.testlogfile on NaCl

It causes every test to fail as the log file is on the local file system,
not the NaCl file system.

Updates #22593

Change-Id: Iee3d8307317bd792c9c701baa962ebbbfa34c147
Reviewed-on: https://go-review.googlesource.com/83256
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/api: don’t rely on hardcoded go versions
Andrew Bonventre [Mon, 11 Dec 2017 21:21:07 +0000 (16:21 -0500)]
cmd/api: don’t rely on hardcoded go versions

Instead of requiring that cmd/api/run.go be edited upon each
release to include the next Go version number, look in $GOROOT/api
for files with the prefix go1* and use those instead to perform
API checks.

Change-Id: I5d9407f2bd368ff5e62f487cccdd245641ca9c9b
Reviewed-on: https://go-review.googlesource.com/83355
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodoc/contrib.html: fix outdated link
Stanislav Afanasev [Mon, 11 Dec 2017 20:45:19 +0000 (23:45 +0300)]
doc/contrib.html: fix outdated link

Change-Id: I6d94a14a781a2fbeb90db35ae3490ce2ac5f8ed1
Reviewed-on: https://go-review.googlesource.com/83315
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodoc: change “substantial” to “significant”
Andrew Bonventre [Mon, 11 Dec 2017 22:05:14 +0000 (17:05 -0500)]
doc: change “substantial” to “significant”

Change-Id: Ie7f2890eab9ad82da93babc92380b13c611af3d0
Reviewed-on: https://go-review.googlesource.com/83375
Reviewed-by: Andrew Bonventre <andybons@golang.org>
7 years agodoc: fix misuse of “substantive” in 1.10 release notes
Andrew Bonventre [Mon, 11 Dec 2017 21:42:25 +0000 (16:42 -0500)]
doc: fix misuse of “substantive” in 1.10 release notes

Use “substantial”, which is believed to be the correct word.
Additionally, this change strips trailing whitespace from the file.

Change-Id: I5b6b718fc09e4b8b911b95e8be0733abd58e165d
Reviewed-on: https://go-review.googlesource.com/83356
Reviewed-by: Andrew Gerrand <adg@golang.org>
7 years agostrings: fix two Builder bugs allowing mutation of strings, remove ReadFrom
Brad Fitzpatrick [Mon, 11 Dec 2017 15:41:24 +0000 (15:41 +0000)]
strings: fix two Builder bugs allowing mutation of strings, remove ReadFrom

The Builder's ReadFrom method allows the underlying unsafe slice to
escape, and for callers to subsequently modify memory that had been
unsafely converted into an immutable string.

In the original proposal for Builder (#18990), I'd noted there should
be no Read methods:

> There would be no Reset or Bytes or Truncate or Read methods.
> Nothing that could mutate the []byte once it was unsafely converted
> to a string.

And in my prototype (https://golang.org/cl/37767), I handled ReadFrom
properly, but when https://golang.org/cl/74931 arrived, I missed that
it had a ReadFrom method and approved it.

Because we're so close to the Go 1.10 release, just remove the
ReadFrom method rather than think about possible fixes. It has
marginal utility in a Builder anyway.

Also, fix a separate bug that also allowed mutation of a slice's
backing array after it had been converted into a slice by disallowing
copies of the Builder by value.

Updates #18990
Fixes #23083
Fixes #23084

Change-Id: Id1f860f8a4f5f88b32213cf85108ebc609acb95f
Reviewed-on: https://go-review.googlesource.com/83255
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/go: invalidate cached test results if env vars or files change
Russ Cox [Mon, 4 Dec 2017 18:57:48 +0000 (13:57 -0500)]
cmd/go: invalidate cached test results if env vars or files change

When we write a cached test result, we now also write a log of the
environment variables and files inspected by the test run,
along with a hash of their content. Before reusing a cached test result,
we recompute the hash of the content specified by the log, and only
use the result if that content has not changed.

This makes test caching behave correctly for tests that consult
environment variables or stat or read files or directories.

Fixes #22593.

Change-Id: I8608798e73c90e0c1911a38bf7e03e1232d784dc
Reviewed-on: https://go-review.googlesource.com/81895
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agointernal/poll: fix error in increfAndClose documentation
Wèi Cōngruì [Mon, 11 Dec 2017 03:17:34 +0000 (11:17 +0800)]
internal/poll: fix error in increfAndClose documentation

Change-Id: I0c387b6286bc18fd00c6ac4e42bdf175cf89ccb1
Reviewed-on: https://go-review.googlesource.com/83155
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agoruntime: reset write barrier buffer on all flush paths
Austin Clements [Fri, 8 Dec 2017 22:32:23 +0000 (17:32 -0500)]
runtime: reset write barrier buffer on all flush paths

Currently, wbBufFlush does nothing if the goroutine is dying on the
assumption that the system is crashing anyway and running the write
barrier may crash it even more. However, it fails to reset the
buffer's "next" pointer. As a result, if there are later write
barriers on the same P, the write barrier will overflow the write
barrier buffer and start corrupting other fields in the P or other
heap objects. Often, this corrupts fields in the next allocated P
since they tend to be together in the heap.

Fix this by always resetting the buffer's "next" pointer, even if
we're not doing anything with the pointers in the buffer.

Updates #22987 and #22988. (May fix; it's hard to say.)

Change-Id: I82c11ea2d399e1658531c3e8065445a66b7282b2
Reviewed-on: https://go-review.googlesource.com/83016
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
7 years agoruntime: mark heapBits.bits nosplit
Austin Clements [Fri, 8 Dec 2017 22:12:41 +0000 (17:12 -0500)]
runtime: mark heapBits.bits nosplit

heapBits.bits is used during bulkBarrierPreWrite via
heapBits.isPointer, which means it must not be preempted. If it is
preempted, several bad things can happen:

1. This could allow a GC phase change, and the resulting shear between
the barriers and the memory writes could result in a lost pointer.

2. Since bulkBarrierPreWrite uses the P's local write barrier buffer,
if it also migrates to a different P, it could try to append to the
write barrier buffer concurrently with another write barrier. This can
result in the buffer's next pointer skipping over its end pointer,
which results in a buffer overflow that can corrupt arbitrary other
fields in the Ps (or anything in the heap, really, but it'll probably
crash from the corrupted P quickly).

Fix this by marking heapBits.bits go:nosplit. This would be the
perfect use for a recursive no-preempt annotation (#21314).

This doesn't actually affect any binaries because this function was
always inlined anyway. (I discovered it when I was modifying heapBits
and make h.bits() no longer inline, which led to rampant crashes from
problem 2 above.)

Updates #22987 and #22988 (but doesn't fix because it doesn't actually
change the generated code).

Change-Id: I60ebb928b1233b0613361ac3d0558d7b1cb65610
Reviewed-on: https://go-review.googlesource.com/83015
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>