Commit graph

53236 commits

Author SHA1 Message Date
Damien Neil 180bcad33d net/http: wait for listeners to exit in Server.Close and Shutdown
Avoid race conditions when a new connection is accepted just after
Server.Close or Server.Shutdown is called by waiting for the
listener goroutines to exit before proceeding to clean up active
connections.

No test because the mechanism required to trigger the race condition
reliably requires such tight coupling to the Server internals that
any test would be quite fragile in the face of reasonable refactorings.

Fixes #48642
Updates #33313, #36819

Change-Id: I109a93362680991bf298e0a95637595dcaa884af
Reviewed-on: https://go-review.googlesource.com/c/go/+/409537
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-07-08 17:00:50 +00:00
Cuong Manh Le 14abe8aa73 cmd/compile: don't convert to interface{} for un-comparable types in generic switch
Fixes #53635

Change-Id: I41f383be8870432fc0d29fa83687911ddd8217f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/415634
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-07-08 12:57:49 +00:00
Michael Anthony Knyszek 1ebc983000 runtime: overestimate the amount of allocated memory in heapLive
CL 377516 made it so that memory metrics are truly monotonic, but also
updated how heapLive tracked allocated memory to also be monotonic.

The result is that cached spans with allocated memory aren't fully
accounted for by the GC, causing it to make a worse assumption (the
exact mechanism is at this time unknown), resulting in a memory
regression, especially for smaller heaps.

This change is a partial revert of CL 377516 that makes heapLive a
non-monotonic overestimate again, which appears to resolve the
regression.

For #53738.

Change-Id: I5c51067abc0b8e0a6b89dd8dbd4a0be2e8c0c1b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/416417
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-07-07 21:15:48 +00:00
Roland Shoemaker c177d9d98a crypto/x509: restrict CRL number to <=20 octets
Similar to certificate serial numbers, RFC 5280 restricts the length of
the CRL number field to no more than 20 octets. Enforce this in
CreateRevocationList.

Fixes #53543

Change-Id: If392ef6b0844db716ae9ee6ef317135fceab039c
Reviewed-on: https://go-review.googlesource.com/c/go/+/415134
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Tatiana Bradley <tatiana@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
2022-07-07 19:43:03 +00:00
Aaron Gable 486fc01770 crypto/x509: correctly parse CRL entry extensions
When checking to see if a CRL entry has any extensions, attempt to read
them from the individual revokedCertificate, rather than from the parent
TBSCertList.

Additionally, crlEntryExtensions is not an EXPLICIT field (c.f.
crlExtension and Certificate extensions), so do not perform an extra
layer of unwrapping when parsing the field.

The added test case fails without the accompanying changes.

Fixes #53592

Change-Id: Icc00e4c911f196aef77e3248117de64ddc5ea27f
Reviewed-on: https://go-review.googlesource.com/c/go/+/414877
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-07-07 19:26:16 +00:00
Aaron Gable 8ac58de185 crypto/x509: populate Number and AKI of parsed CRLs
The x509.RevocationList type has two fields which correspond to
extensions, rather than native fields, of the underlying ASN.1 CRL:
the .Number field corresponds to the crlNumber extension, and
the .AuthorityKeyId field corresponds to the authorityKeyIdentifier
extension.

The x509.CreateRevocationList() function uses these fields to populate
their respective extensions in the resulting CRL. However, the
x509.ParseRevocationList() function does not perform the reverse
operation: the fields retain their zero-values even after parsing a CRL
which contains the relevant extensions.

Add code which populates these fields when parsing their extensions.
Add assertions to the existing tests to confirm that the values are
populated appropriately.

Fixes #53726

Change-Id: Ie5b71081e53034e0b5b9ff3c122065c62f15cf23
Reviewed-on: https://go-review.googlesource.com/c/go/+/416354
Run-TryBot: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2022-07-07 19:06:45 +00:00
Than McIntosh 0c7fcf6bd1 cmd/link: explicitly disable PIE for windows/amd64 -race mode
Turn off PIE explicitly for windows/amd64 when -race is in effect,
since at the moment the race detector runtime doesn't seem to handle
PIE binaries correctly. Note that newer C compilers on windows
produce PIE binaries by default, so the Go linker needs to explicitly
turn off PIE when invoking the external linker in this case.

Updates #53539.

Change-Id: Ib990621f22cf61a5fa383584bab81d3dfd7552e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/415676
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2022-07-07 14:33:55 +00:00
Than McIntosh eaf2125654 cmd/go: default to "exe" build mode for windows -race
This patch changes the default build mode from "pie" to "exe" when
building programs on windows with "-race" in effect. The Go command
already issues an error if users explicitly ask for -buildmode=pie in
combination with -race on windows, but wasn't revising the default
"pie" build mode if a specific buildmode was not requested.

Updates #53539.
Updates #35006.

Change-Id: I2f81a41a1d15a0b4f5ae943146175c5a1202cbe0
Reviewed-on: https://go-review.googlesource.com/c/go/+/416174
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
2022-07-07 14:33:31 +00:00
Cuong Manh Le 1243ec9c17 cmd/compile: only check implicit dots for method call enabled by a type bound
Fixes #53419

Change-Id: Ibad64f5c4af2112deeb0a9ecc9c589b17594bd05
Reviewed-on: https://go-review.googlesource.com/c/go/+/414836
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-07-06 20:29:10 +00:00
Daniel Martí c391156f96 cmd/go: set up git identity for build_buildvcs_auto.txt
Just like in other tests like get_dotfiles.txt or
version_buildvcs_git.txt. Without it, I get a failure on my machine:

	fatal: empty ident name (for <mvdan@p14s.localdomain>) not allowed

Change-Id: I1c17c0d58c539b59154570b5438c7bd850bac5aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/416095
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-07-06 17:17:08 +00:00
Keith Randall 2acd3646fc cmd/compile: rework induction variable detector
Induction variable detection is still not quite right. I've added
another failing test.

Redo the overflow/underflow detector so it is more obviously correct.

Update #53600
Fixes #53653
Fixes #53663

Change-Id: Id95228e282fdbf6bd80b26e1c41d62e935ba08ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/415874
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-07-06 17:00:37 +00:00
Ian Lance Taylor 53a4152d47 os/exec: clarify that Wait must be called
Fixes #52580

Change-Id: Ib2dd8a793b9c6fcb083abb3f7c346f6279adefc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/414056
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-07-06 16:51:00 +00:00
Ian Lance Taylor 177306f630 cmd/internal/notsha256: add purego tag as needed
This permits building the package with gccgo, when using gccgo
as a bootstrap compiler.

Fixes #53662

Change-Id: Ic7ae9323ec5954e9306a32e1160e9aa1ed3aa202
Reviewed-on: https://go-review.googlesource.com/c/go/+/415935
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
2022-07-06 16:39:07 +00:00
Ian Lance Taylor f4755fc733 cmd/dist: use purego tag when building the bootstrap binaries
This is in addition to the current math_big_pure_go tag.
Using purego ensures that we can build the cmd binaries with gccgo.

For #53662

Change-Id: Ib82f8bf10659b5f94935f2b427ae8b2da875cd3b
Reviewed-on: https://go-review.googlesource.com/c/go/+/415934
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-07-06 16:22:03 +00:00
Cherry Mui 4484c30f78 misc/cgo/test: make TestSetgidStress cheaper
TestSetgidStress spawns 1000 threads, which can be expensive on
some platforms or slow builders. Run with 50 threads in short
mode instead.

This makes the failure less reproducible even with buggy code. But
one can manually stress test it (e.g. when a flaky failure appear
on the builder).

Fixes #53641.

Change-Id: I33b5ea5ecaa8c7a56f59c16f9171657ee295db47
Reviewed-on: https://go-review.googlesource.com/c/go/+/415677
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
2022-07-06 14:23:50 +00:00
Ian Lance Taylor 2007599dc8 test: recognize new gofrontend error message
The new gofrontend message matches other gofrontend error messages,
so adjust the test to accept it.

For #27938
For #51237

Change-Id: I29b536f83a0cf22b1dbdae9abc2f5f6cf21d522d
Reviewed-on: https://go-review.googlesource.com/c/go/+/416014
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-07-06 00:02:11 +00:00
Michael Pratt d602380f58 cmd/compile: drop "buildcfg" from no instrument packages
Package buildcfg was added to this list by CL 403851, but package
buildcfg does not exist.

This was probably intended to refer to internal/buildcfg, but
internal/buildcfg is only used by the compiler so it is not clear why it
couldn't be instrumented.

For #44853.

Change-Id: Iad2517358be79c3eabf240376156bcff0c4bcefc
Reviewed-on: https://go-review.googlesource.com/c/go/+/414516
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
2022-07-05 20:07:49 +00:00
Russ Cox c111091071 cmd/go: make module@nonexistentversion failures reusable
CL 411398 added the -reuse flag for reusing cached JSON output
when the remote Git repository has not changed. One case that was
not yet cached is a lookup of a nonexistent version.

This CL adds caching of failed lookups of nonexistent versions,
by saving a checksum of all the heads and tags refs on the remote
server (we never consider other kinds of refs). If none of those have
changed, then we don't need to download the full server.

Fixes #53644.

Change-Id: I428bbc8ec8475bd7d03788934d643e1e2be3add0
Reviewed-on: https://go-review.googlesource.com/c/go/+/415678
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-07-05 12:57:46 +00:00
Russ Cox 5f305ae8e5 cmd/go: add -reuse flag to make proxy invocations more efficient
The go list -m and go mod download commands now have a -reuse flag,
which is passed the name of a file containing the JSON output from a
previous run of the same command. (It is up to the caller to ensure
that flags such as -versions or -retracted, which affect the output,
are consistent between the old and new run.)

The new run uses the old JSON to evaluate whether the answer is
unchanged since the old run. If so, it reuses that information,
avoiding a costly 'git fetch', and sets a new Reuse: true field in its
own JSON output.

This dance with saving the JSON output and passing it back to -reuse
is not necessary on most systems, because the go command caches
version control checkouts in the module cache. That cache means that a
new 'git fetch' would only download the commits that are new since the
previous one (often none at all).

The dance becomes important only on systems that do not preserve the
module cache, for example by running 'go clean -modcache' aggressively
or by running in some environment that starts with an empty file
system.

For #53644.

Change-Id: I447960abf8055f83cc6dbc699a9fde9931130004
Reviewed-on: https://go-review.googlesource.com/c/go/+/411398
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-07-05 12:57:45 +00:00
Russ Cox 84e091eef0 cmd/go: record origin metadata during module download
This change adds an "Origin" JSON key to the output of
go list -json -m and go mod download -json. The associated value is a
JSON object with metadata about the source control system. For Git,
that metadata is sufficient to evaluate whether the remote server has
changed in any interesting way that might invalidate the cached data.
In most cases, it will not have, and a fetch could then avoid
downloading a full repo from the server.

This origin metadata is also now recorded in the .info file for a
given module@version, for informational and debugging purposes.

This change only adds the metadata. It does not use it to optimize
away unnecessary git fetch operations. (That's the next change.)

For #53644.

Change-Id: I4a1712a2386d1d8ab4e02ffdf0f72ba75d556115
Reviewed-on: https://go-review.googlesource.com/c/go/+/411397
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-07-05 12:57:42 +00:00
Cristian Greco ceda93ed67 build/constraint: update doc to mention a feature added in Go 1.17
The pkg documentation mentions that the "//go:build" syntax "will be"
added in Go 1.17. In fact, it has been added in that Go release, so the
documentation can now be updated.

Change-Id: I72f24063c3be62d97ca78bf724d56599f5f19460
GitHub-Last-Rev: 4371886f6c
GitHub-Pull-Request: golang/go#53647
Reviewed-on: https://go-review.googlesource.com/c/go/+/415774
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-07-04 14:31:39 +00:00
Ori Bernstein 3cf79d9610 runtime: pass correct string to exits on Plan 9
In CL 405901 the definition of exit in the Plan 9 go runtime
was changed like so:

	-               status = append(itoa(tmp[:len(tmp)-1], uint64(e)), 0)
	+               sl := itoa(tmp[:len(tmp)-1], uint64(e))
	+               // Don't append, rely on the existing data being zero.
	+               status = tmp[:len(sl)+1]

However, itoa only puts the converted number "somewhere" in the buffer.
Specifically, it builds it from the end of the buffer towards the start,
meaning the first byte of the buffer is a 0 byte, and the resulting string
that's passed to exits is empty, leading to a falsely successful exit.

This change uses the returned value from itoa, rather than the buffer
that was passed in, so that we start from the correct location in the
string.

Fixes #53669

Change-Id: I63f0c7641fc6f55250857dc17a1eeb12ae0c2e10
Reviewed-on: https://go-review.googlesource.com/c/go/+/415680
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-07-04 04:09:44 +00:00
Alexander Yastrebov e822b1e26e net/http: omit invalid header value from error message
Updates #43631

Change-Id: I0fe3aafdf7ef889fed1a830128721393f8d020e6
GitHub-Last-Rev: c359542d74
GitHub-Pull-Request: golang/go#48979
Reviewed-on: https://go-review.googlesource.com/c/go/+/355929
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-07-01 15:57:45 +00:00
Ian Lance Taylor 4a2a3bca18 cmd/go, go/build: clarify build constraint docs
Clarify that the //go:build line is an expression of constraints,
not a constraint itself.

Fixes #53308

Change-Id: Ib67243c6ee5cfe3b688c12b943b5e7496f686035
Reviewed-on: https://go-review.googlesource.com/c/go/+/411697
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
2022-07-01 15:39:01 +00:00
Sebastian Gassner 9a4d5357f4 flag: highlight support for double dashes in docs
Updating examples, to show that double dashes are also permitted. This has been easy to miss previously.

Change-Id: Ib67b4e39fea90ef4cb9e894709c53baedfc18fc2
GitHub-Last-Rev: f7df57b646
GitHub-Pull-Request: golang/go#53628
Reviewed-on: https://go-review.googlesource.com/c/go/+/415374
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-07-01 15:37:46 +00:00
Matthew Dempsky d667be8831 [dev.unified] cmd/compile/internal/walk: RType fields for range assignments
This CL adds extra fields to RangeStmt that can be used when
desugaring into primitive assignment statements. This will allow the
frontend to wire up all of the RTTI necessary, pulling from
dictionaries as necessary.

Updates #53328.

Change-Id: Iab0e3029ff18c947782ff24f71ef20b2b5cb8305
Reviewed-on: https://go-review.googlesource.com/c/go/+/415518
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
2022-07-01 15:12:15 +00:00
Robert Griesemer c847a2c9f0 go/types, types2: document that exported predicates are unspecified for invalid type arguments
Per discussion on the issue.

For #53595.

Change-Id: Iefd161e5c7e792d454652cbe831a0c2d769f748e
Reviewed-on: https://go-review.googlesource.com/c/go/+/415574
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-07-01 01:36:45 +00:00
Robert Griesemer 405c269b85 go/types, types2: re-enable a couple of commented out tests
Change-Id: Ibb27012b18fc0f0f9f9ef74cc120e7ef981e6d43
Reviewed-on: https://go-review.googlesource.com/c/go/+/415156
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2022-06-30 23:25:23 +00:00
Ben Sarah Golightly aad9382e59 go/doc/comment: support links in lists in comments
The proposed (#51082) new go doc comment additions supports lists,
links, and doc links, but does not support links and doc links inside
lists, so implemnent this.

Fixes #53610

Change-Id: I4fa17d204fc9efa8f3633133e4a49e56cf1aa9bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/415174
Reviewed-by: Ben Golightly <golightly.ben@googlemail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-06-30 21:57:02 +00:00
AndreasHGK af725f4286 os: fix a typo in path_windows.go
I believe the path_windows.go file has a typo, which is fixed in this PR

Change-Id: Ibf1a7189a6312dbb3b1e6b512beeb6d99da5b5bc
GitHub-Last-Rev: cedac7eaa0
GitHub-Pull-Request: golang/go#53629
Reviewed-on: https://go-review.googlesource.com/c/go/+/415434
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-06-30 21:52:06 +00:00
Matthew Dempsky 1b838e9556 [dev.unified] all: merge master (993c387) into dev.unified
Conflicts:

- test/run.go: textual conflict in 1.18 known failures list

Merge List:

+ 2022-06-30 993c387032 os: simplify deadline fluctuation tests
+ 2022-06-30 4914e4e334 cmd/go/internal/modindex: remove spurious field from index_format documentation
+ 2022-06-30 981d5947af cmd/go: include module root in package index key
+ 2022-06-30 84db00ffd1 cmd/go: add a 'sleep' command for script tests
+ 2022-06-30 31b8c23c57 cmd/compile: fix prove pass when upper condition is <= maxint
+ 2022-06-30 17083a2fdf spec: retitle section on "Assignments" to "Assignment statements"
+ 2022-06-30 4d95fe6653 test: add regress test for #53619
+ 2022-06-29 6a7c64fde5 debug/pe: add IMAGE_FILE_MACHINE_LOONGARCH{64,32}
+ 2022-06-29 b2cc0fecc2 net/http: preserve nil values in Header.Clone
+ 2022-06-29 64ef16e777 cmd/internal/obj/arm64: save LR and SP in one instruction for small frames
+ 2022-06-29 0750107074 go/token: use atomics not Mutex for last file cache
+ 2022-06-29 e5017a93fc net/http: don't strip whitespace from Transfer-Encoding headers
+ 2022-06-29 20760cff00 runtime: add race annotations to cbs.lock
+ 2022-06-29 e6c0546c54 crypto/x509/pkix: move crl deprecation message
+ 2022-06-29 3562977b6f cmd/internal/obj/mips,s390x,riscv: save LR after decrementing SP
+ 2022-06-29 d6481d5b96 runtime: add race annotations to metricsSema
+ 2022-06-29 bd1783e812 crypto/x509: improve RevocationList documentation
+ 2022-06-28 160414ca6a cmd/internal/obj/arm64: fix BITCON constant printing error
+ 2022-06-28 a30f434667 cmd/go: pass --no-decorate when listing git tags for a commit
+ 2022-06-28 3580ef9d64 os/exec: on Windows, suppress ErrDot if the implicit path matches the explicit one
+ 2022-06-28 34f3ac5f16 cmd/compile: fix generic inter-inter comparisons from value switch statements
+ 2022-06-28 7df0a002e6 cmd/go/internal/modfetch: cache latest revinfo in Versions func
+ 2022-06-28 d5bf9604aa test: add more tests for const decls with ommitted RHS expressions
+ 2022-06-28 533082d1a0 test: add test that gofrontend failed to compile
+ 2022-06-28 47e792e22e runtime: clean up unused function gosave on loong64
+ 2022-06-28 a6e5be0d30 cmd/go: omit build metadata that may contain system paths when -trimpath is set
+ 2022-06-28 d3ffff2790 api: correct debug/pe issue number for Go 1.19 changes
+ 2022-06-28 751cae8855 cmd/go/internal/modload: fix doc comment
+ 2022-06-28 85d7bab91d go/printer: report allocs and set bytes
+ 2022-06-27 3af5280c00 net: really skip Windows PTR tests if we say we are skipping them
+ 2022-06-27 a42573c2f1 net: avoid darwin/arm64 platform bug in TestCloseWrite
+ 2022-06-27 68289f39f0 html/template: fix typo in content_test.go
+ 2022-06-27 c3bea70d9b cmd/link: link against libsynchronization.a for -race on windows
+ 2022-06-27 f093cf90bf test: add test that caused gofrontend crash
+ 2022-06-27 155612a9b9 test: add test that caused gofrontend crash
+ 2022-06-27 a861eee51a cmd/go: compile runtime/internal/syscall as a runtime package
+ 2022-06-27 8f9bfa9b7b crypto/internal/boring: factor Cache into crypto/internal/boring/bcache
+ 2022-06-26 351e0f4083 runtime: avoid fma in mkfastlog2table
+ 2022-06-26 416c953960 test: add test that gofrontend gets wrong
+ 2022-06-26 666d736ecb cmd/compile: do branch/label checks only once
+ 2022-06-26 6b309be7ab cmd/compile/internal/syntax: check fallthrough in CheckBranches mode
+ 2022-06-25 1821639b57 runtime: mark string comparison hooks as no split
+ 2022-06-25 3b594b9255 io: clarify SeekEnd offset value
+ 2022-06-25 4f45ec5963 cmd/go: prepend builtin prolog when checking for preamble errors
+ 2022-06-24 41e1d9075e strconv: avoid panic on invalid call to FormatFloat
+ 2022-06-24 bd4753905d internal/trace: add Go 1.19 test data
+ 2022-06-24 6b6c64b1cc cmd/internal/archive: don't rely on an erroneous install target in tests

Change-Id: Ib43126833bf534c311730d4283d4d25381cd3428
2022-06-30 13:39:54 -07:00
Ian Lance Taylor 993c387032 os: simplify deadline fluctuation tests
This applies the net package CL 365334, CL 366176, CL 372215 to the os
package.

CL 365334:

    These tests were checking for fairly narrow timing windows, but were
    running in parallel and heavily dependent on timer and goroutine
    scheduling. This change eliminates unnecessary goroutines, runs the
    tests sequentially (dramatically shortening the timeouts to reduce the
    penalty of doing so), and uses timestamp comparison instead of
    background timers to hopefully gain some robustness from monotonic
    timestamps.

    Many of the other tests from this package would benefit from similar
    simplifications, which we can apply if and when we notice flaky
    failures or want to improve the latency of running the test.

CL 366176:

    It appears that at least the OpenBSD kernel gets sloppier the longer
    the timeout we give it, up to an observed overhead of around 25%.
    Let's give it a little more than that (33%) in the comparison, and
    also increase the growth curve to match the actual observed times
    instead of exponential initial growth.

CL 372215:

    Decrease the slop everywhere else, since NetBSD and OpenBSD seem to be
    the only ones that miss by that much.

For #36108
For #50189
Fixes #50725 (we hope)

Change-Id: I0854d27af67ca9fcf0f9d9e4ff67acff4c2effc8
Reviewed-on: https://go-review.googlesource.com/c/go/+/415234
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-06-30 19:37:21 +00:00
Bryan C. Mills 4914e4e334 cmd/go/internal/modindex: remove spurious field from index_format documentation
The 'path' field was removed in an earlier revision to the format.

While auditing the format, I also cleaned up a couple of minor
typographical issues.

For #53586.

Change-Id: I4cd1ce9e970023441c11244428ed2971be1d8138
Reviewed-on: https://go-review.googlesource.com/c/go/+/415514
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-30 19:32:09 +00:00
Matthew Dempsky 0a503cf43a [dev.unified] cmd/compile: refactor range desugaring
This CL refactors the code responsible for emitting the user-visible
assignments within a range statement. This will make it easier to
propagate RTTI from the frontend into any implicit conversions.

Updates #53328.

Change-Id: Ibed15e3b4951b0a6a726067b401a630977f4c6c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/415158
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-30 18:42:33 +00:00
Matthew Dempsky 3635b07d16 [dev.unified] cmd/compile/internal/noder: implicit conversions for multi-valued expressions
This CL changes GOEXPERIMENT=unified to insert implicit conversions
for multi-valued expressions.

Unfortunately, IR doesn't have strong, first-class support for
multi-valued expressions, so this CL takes the approach of spilling
them to temporary variables, which can then be implicitly converted.
This is the same approach taken by walk, but doing it this early does
introduce some minor complications:

1. For select case clauses with comma-ok assignments (e.g., `case x,
ok := <-ch:`), the compiler middle end wants to see the OAS2RECV
assignment is the CommClause.Comm statement. So when constructing
select statements, we need to massage this around a little.

2. The extra temporary variables and assignments skew the existing
inlining heuristics. As mentioned, the temporaries/assignments will
eventually be added (and often optimized away again) anyway, but now
they're visible to the inliner. So this CL also kludges the inlining
heuristics in this case to keep things comparable.

Change-Id: I3e3ea756ad92472ebe28bae3963be61ed7684a75
Reviewed-on: https://go-review.googlesource.com/c/go/+/415244
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-30 18:42:24 +00:00
Matthew Dempsky e7219cc093 [dev.unified] cmd/compile/internal/noder: refactor N:1 expression handling
Pull all multi-value expression handling logic into a new multiExpr
helper method.

Change-Id: I78ec2dfc523abcfa3368a1064df7045aade8e468
Reviewed-on: https://go-review.googlesource.com/c/go/+/415243
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-06-30 18:42:06 +00:00
Matthew Dempsky 2f3ef73e18 [dev.unified] test: tweak nilcheck test
A subsequent CL will change Unified IR to emit extra temporary
variables for multi-value expressions, because they're sometimes
necessary for handling implicit conversions.

A consequence of this is that:

	_, ok := m[""]

will be rewritten into:

	autotmp_1, autotmp_2 := m[""]
	_, ok := autotmp_1, autotmp_2

As the comment in nilcheck.go says, we don't want this code sequence
to emit any nil checks, and it doesn't either way. But only the second
form results in the compiler reporting "removed nil check", and I
can't make sense of why.

Rather than splitting this test case into separate unified and
nounified variants, it seems easier to just tweak the test case to the
more complex form and verify that we correctly remove the nil check
still.

Change-Id: I6a9266db933b201352d52da4d403a330fdeac48b
Reviewed-on: https://go-review.googlesource.com/c/go/+/415242
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-06-30 18:41:59 +00:00
Matthew Dempsky 95d7ce9ab1 [dev.unified] test: break escape_iface.go into unified/nounified variants
The assignment `sink, *(&ok) = y.(int)` should (and does) escape a
value to the heap, but this detail is missed because the implicit
conversion of the multi-value expression `y.(int)` isn't visible to
escape analysis (because it's not inserted until desugaring during
walk).

For Unified IR, I plan to apply this desugaring earlier (because it's
necessary for correct dictionary handling), which means we'll
now (correctly) report the heap escape.

Due to limitations of the $GOROOT/test harness, the easiest way to
handle that GOEXPERIMENT=unified gets this right while
GOEXPERIMENT=nounified does not is to split the test case into
separate files. Hence this CL.

Change-Id: I91f3a6c015cbc646ab018747e152cac2874cf24c
Reviewed-on: https://go-review.googlesource.com/c/go/+/415241
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-06-30 18:41:26 +00:00
Matthew Dempsky f751319a0b [dev.unified] test: relax live_regabi.go
Unified IR will soon introduce additional temporary variables for
multi-valued expressions, which cause this test to start failing.
However, according to the comment on lines 594--596, we don't care
what temporaries are printed on the noisy lines, just that they're not
mentioned on the printnl lines.

This CL relaxes the test expectations so that temporaries are allowed
to be live at the call to fb38() too, not just the calls to fi38() and
fc38().

Change-Id: Ia6c5f28ccf760fd8890a4313fb0d9f0eb9850bba
Reviewed-on: https://go-review.googlesource.com/c/go/+/415240
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
2022-06-30 18:41:17 +00:00
Bryan C. Mills 981d5947af cmd/go: include module root in package index key
The package index format includes the directory relative to the module
root. The module root for a given directory can change even if the
contents of the directory itself do not (by adding or removing a
go.mod file in some parent directory).

Thus, we need to invalidate the index for a package when its module
root location changes.

Fixes #53586 (I think).

Change-Id: I2d9f4de80e16bce75b3106a2bad4a11d8378d037
Reviewed-on: https://go-review.googlesource.com/c/go/+/415475
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-30 18:20:39 +00:00
Bryan C. Mills 84db00ffd1 cmd/go: add a 'sleep' command for script tests
Due to mtime skew we don't index mutable packages with an mtime
younger than 2 seconds. In order to test indexed packages reliably, we
want to be able to sleep long enough for the files in the package to be cached.

(As an alternative we could instead use os.Chtimes to fake old enough
timestamps, but sleeping keeps the tests more realistic.)

For #53586.

Change-Id: I1873f47c55a72d928451593b8c989f0092a557db
Reviewed-on: https://go-review.googlesource.com/c/go/+/415474
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-30 18:10:53 +00:00
Matthew Dempsky e3cdc981c8 [dev.unified] cmd/compile/internal/walk: fix typo in debug print
We want to print `init` here. We called `ir.TakeInit(r)` earlier, so
`r.Init()` always evaluates to nil at this point.

Change-Id: I196fdcfbf5e63c80b7bff0cce1881c9e58302501
Reviewed-on: https://go-review.googlesource.com/c/go/+/415239
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-06-30 16:03:25 +00:00
Keith Randall 31b8c23c57 cmd/compile: fix prove pass when upper condition is <= maxint
When the terminating condition is <= X, we need to make sure that
X+step doesn't overflow.

Fixes #53600

Change-Id: I36e5384d05b4d7168e48db6094200fcae409bfe5
Reviewed-on: https://go-review.googlesource.com/c/go/+/415219
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
2022-06-30 15:11:19 +00:00
Robert Griesemer 17083a2fdf spec: retitle section on "Assignments" to "Assignment statements"
This permits a clear distinction between an individual assignment
and an assignment statement which may assign more than one value.
It also makes this section title consistent with all other section
titles about statements. Adjust internal links and prose where
appropriate. (Note that the spec already referred to assignment
statements in a couple of places, even before this change.)

Add an introductory paragraph to the section on assignment statements.

Preparation for adding a section on value vs reference types
(issue #5083).

Change-Id: Ie140ac296e653c67da2a5a203b63352b3dc4f9f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/413615
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-06-30 00:58:41 +00:00
Matthew Dempsky 4d95fe6653 test: add regress test for #53619
Works with cmd/compile, but fails with gccgo currently.

Updates #53619.

Change-Id: I787faa9584cc33bd851c9cc8f146c91f4eb36fc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/415238
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
2022-06-30 00:08:36 +00:00
Guoqi Chen 6a7c64fde5 debug/pe: add IMAGE_FILE_MACHINE_LOONGARCH{64,32}
Related: https://github.com/MicrosoftDocs/win32/pull/1067

Change-Id: I946253f217a5c616ae4a19be44634000cba5020e
Reviewed-on: https://go-review.googlesource.com/c/go/+/411616
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-06-29 22:29:34 +00:00
Damien Neil b2cc0fecc2 net/http: preserve nil values in Header.Clone
ReverseProxy makes a distinction between nil and zero-length header values.
Avoid losing nil-ness when cloning a request.

Thanks to Christian Mehlmauer for discovering this.

Fixes #53423
Fixes CVE-2022-32148

Change-Id: Ice369cdb4712e2d62e25bb881b080847aa4801f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/412857
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2022-06-29 22:28:30 +00:00
Cherry Mui 64ef16e777 cmd/internal/obj/arm64: save LR and SP in one instruction for small frames
When we create a thread with signals blocked. But glibc's
pthread_sigmask doesn't really allow us to block SIGSETXID. So we
may get a signal early on before the signal stack is set. If we
get a signal on the current stack, it will clobber anything below
the SP. This CL makes it to save LR and decrement SP in a single
MOVD.W instruction for small frames, so we don't write below the
SP.

We used to use a single MOVD.W instruction before CL 379075.
CL 379075 changed to use an STP instruction to save the LR and FP,
then decrementing the SP. This CL changes it back, just this part
(epilogues and large frame prologues are unchanged). For small
frames, it is the same number of instructions either way.

This decreases the size of a "small" frame from 0x1f0 to 0xf0.
For frame sizes in between, it could benefit from using an
STP instruction instead of using the prologue for the "large"
frame case. We don't bother it for now as this is a stop-gap
solution anyway.

This only addresses the issue with small frames. Luckily, all
functions from thread entry to setting up the signal stack have
samll frames.

Other possible ideas:
- Expand the unwind info metadata, separate SP delta and the
  location of the return address, so we can express "SP is
  decremented but the return address is in the LR register". Then
  we can always create the frame first then write the LR, without
  writing anything below the SP (except the frame pointer at SP-8,
  which is minor because it doesn't really affect program
  execution).
- Set up the signal stack immediately in mstart in assembly.

For Go 1.19 we do this simple fix. We plan to do the metadata fix
in Go 1.20 ( #53609 ).

Other LR architectures are addressed in CL 413428.

Fix #53374.

Change-Id: I9d6582ab14ccb06ac61ad43852943d9555e22ae5
Reviewed-on: https://go-review.googlesource.com/c/go/+/412474
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Eric Fang <eric.fang@arm.com>
2022-06-29 22:26:58 +00:00
Alan Donovan 0750107074 go/token: use atomics not Mutex for last file cache
Previously, FileSet would cache the last *File found by a lookup,
using a full (exclusive) mutex within FileSet.File, turning a logical
read operation into an update. This was one of the largest sources
of contention in gopls.  This change uses atomic load/store on the
'last' field without a mutex.

Also, in FileSet.AddFile, allocate the File outside the critical
section; all the other operations are typically cheap.

Fixes #53507

Change-Id: Ice8641650d8495b25b0428e9b9320837ff2ca7e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/411909
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-29 22:19:48 +00:00
Damien Neil e5017a93fc net/http: don't strip whitespace from Transfer-Encoding headers
Do not accept "Transfer-Encoding: \rchunked" as a valid TE header
setting chunked encoding.

Thanks to Zeyu Zhang (https://www.zeyu2001.com/) for identifying
the issue.

Fixes #53188
Fixes CVE-2022-1705

Change-Id: I1a16631425159267f2eca68056b057192a7edf6c
Reviewed-on: https://go-review.googlesource.com/c/go/+/409874
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2022-06-29 20:22:10 +00:00