]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
20 months agoAutogenerated TLS-related strings go1.19.1-gost
Sergey Matveev [Tue, 6 Sep 2022 18:06:05 +0000 (21:06 +0300)]
Autogenerated TLS-related strings

go install golang.org/x/tools/cmd/stringer@latest
cd src/crypto/tls ; go generate

20 months agoGOST X.509 and TLS 1.3 support via GoGOST
Sergey Matveev [Fri, 19 Jun 2020 10:26:58 +0000 (13:26 +0300)]
GOST X.509 and TLS 1.3 support via GoGOST

20 months ago[release-branch.go1.19] go1.19.1 go1.19.1
Gopher Robot [Tue, 6 Sep 2022 15:53:07 +0000 (15:53 +0000)]
[release-branch.go1.19] go1.19.1

Change-Id: Iada84ba9c8e727e89cfb4ac21a27e085fa7f60e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/428697
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Gopher Robot <gobot@golang.org>
Auto-Submit: Gopher Robot <gobot@golang.org>

20 months ago[release-branch.go1.19] net/http: update bundled golang.org/x/net/http2
Damien Neil [Mon, 22 Aug 2022 23:28:21 +0000 (16:28 -0700)]
[release-branch.go1.19] net/http: update bundled golang.org/x/net/http2

Disable cmd/internal/moddeps test, since this update includes PRIVATE
track fixes.

Fixes CVE-2022-27664
Fixes #54376
For #54658

Change-Id: I747900a66d7276e7d0bd246cd8cd0da95305c3ca
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1554417
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/428655
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Tatiana Bradley <tatiana@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

21 months ago[release-branch.go1.19 cmd/compile: align stack offset to alignment larger than PtrSize
Cherry Mui [Tue, 23 Aug 2022 22:19:06 +0000 (18:19 -0400)]
[release-branch.go1.19 cmd/compile: align stack offset to alignment larger than PtrSize

In typebits.Set we check that the offset is a multiple of the
alignment, which makes perfect sense. But for values like
atomic.Int64, which has 8-byte alignment even on 32-bit platforms
(i.e. the alignment is larger than PtrSize), if it is on stack it
may be under-aligned, as the stack frame is only PtrSize aligned.

Normally we would prevent such values on stack, as the escape
analysis force values with higher alignment to heap. But for a
composite literal assignment like x = AlignedType{...}, the
compiler creates an autotmp for the RHS then copies it to the LHS.
The autotmp is on stack and may be under-aligned. Currently this
may cause an ICE in the typebits.Set check.

This CL makes it align the _offset_ of the autotmp to 8 bytes,
which satisfies the check. Note that this is actually lying: the
actual address at run time may not necessarily be 8-byte
aligned as we only align SP to 4 bytes.

The under-alignment is probably okay. The only purpose for the
autotmp is to copy the value to the LHS, and the copying code we
generate (at least currently) doesn't care the alignment beyond
stack alignment.

Updates #54638.
Fixes #54697.

Change-Id: I13c16afde2eea017479ff11dfc24092bcb8aba6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/425256
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 1211a62bdcb0f070c5082255bcc90e1a14c16bb2)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425935

21 months ago[release-branch.go1.19] runtime: mark morestack_noctxt SPWRITE on LR architectures
Cherry Mui [Wed, 24 Aug 2022 22:33:21 +0000 (18:33 -0400)]
[release-branch.go1.19] runtime: mark morestack_noctxt SPWRITE on LR architectures

On LR architectures, morestack (and morestack_noctxt) are called
with a special calling convention, where the caller doesn't save
LR on stack but passes it as a register, which morestack will save
to g.sched.lr. The stack unwinder currently doesn't understand it,
and would fail to unwind from it. morestack already writes SP (as
it switches stack), but morestack_noctxt (which tailcalls
morestack) doesn't. If a profiling signal lands right in
morestack_noctxt, the unwinder will try to unwind the stack and
go off, and possibly crash.

Marking morestack_noctxt SPWRITE stops the unwinding.

Ideally we could teach the unwinder about the special calling
convention, or change the calling convention to be less special
(so the unwinder doesn't need to fetch a register from the signal
context). This is a stop-gap solution, to stop the unwinder from
crashing.

Updates #54332.
Fixes #54675.

Change-Id: I75295f2e27ddcf05f1ea0b541aedcb9000ae7576
Reviewed-on: https://go-review.googlesource.com/c/go/+/425396
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
(cherry picked from commit e4be2ac79f3cc7219ae1cf8334463d11cae24e01)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425615

21 months ago[release-branch.go1.19] runtime: fix ppc64 startup on newer linux kernels
Paul E. Murphy [Fri, 19 Aug 2022 14:20:02 +0000 (09:20 -0500)]
[release-branch.go1.19] runtime: fix ppc64 startup on newer linux kernels

R0 needs to be cleared at startup as it may not always be cleared
by the kernel on newer kernels.

Fixes #54665

Change-Id: Id7055699aaa8d8b193b7e3e784f075ce29ac3f1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/424927
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/425394
Reviewed-by: Ian Lance Taylor <iant@google.com>
21 months ago[release-branch.go1.19] cmd/compile: only inline method wrapper if method don't conta...
Cuong Manh Le [Mon, 29 Aug 2022 03:48:28 +0000 (10:48 +0700)]
[release-branch.go1.19] cmd/compile: only inline method wrapper if method don't contain closures

CL 327871 changes methodWrapper to always perform inlining after global
escape analysis. However, inlining the method may reveal closures, which
require walking all function bodies to decide whether to capture free
variables by value or by ref.

To fix it, just not doing inline if the method contains any closures.

Fixes #54726

Change-Id: I4b0255b86257cc6fe7e5fafbc545cc5cff9113e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/426334
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/426160

21 months ago[release-branch.go1.19] cmd/go/internal/imports: recognize "unix" build tag
Zeke Lu [Mon, 29 Aug 2022 23:29:48 +0000 (23:29 +0000)]
[release-branch.go1.19] cmd/go/internal/imports: recognize "unix" build tag

For #20322
For #51572
Updates #54712
Fixes #54736

Change-Id: I22fcfa820e83323bfdf1a40deee7286240f02b3e
GitHub-Last-Rev: cd2c6536b0298baf3c54e5bdbc456a814545cff4
GitHub-Pull-Request: golang/go#54716
Reviewed-on: https://go-review.googlesource.com/c/go/+/426296
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
(cherry picked from commit 3c6a5cdb9a29c0e3b12cdaa8ab81ba22d989e3b0)
Reviewed-on: https://go-review.googlesource.com/c/go/+/426814
Run-TryBot: Bryan Mills <bcmills@google.com>

21 months ago[release-branch.go1.19] cmd/link: fix trampolines breaking DWARF line info
Jeremy Quirke [Tue, 9 Aug 2022 17:20:33 +0000 (17:20 +0000)]
[release-branch.go1.19] cmd/link: fix trampolines breaking DWARF line info

When trampolines are needed (e.g. Darwin ARM64), the DWARF LPT (Line
Program Table - see DWARF section 6.1) generation fails because the
replacement symbols are marked as external symbols and skipped during
the DWARF LPT generation phase.

Fixes #54406

Change-Id: I6c93f5378f50e5edf30d5121402a48214abb1ce2
GitHub-Last-Rev: 085bbc55dbc95d55456cc2acc46a0d02416c2848
GitHub-Pull-Request: golang/go#54321
Reviewed-on: https://go-review.googlesource.com/c/go/+/422154
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 2340d371796f95acdcc399e60f9ecefec2add8df)
Reviewed-on: https://go-review.googlesource.com/c/go/+/423214
Run-TryBot: Cherry Mui <cherryyz@google.com>

21 months ago[release-branch.go1.19] crypto/tls: support ECDHE when ec_point_formats is missing
Filippo Valsorda [Wed, 24 Aug 2022 10:39:20 +0000 (12:39 +0200)]
[release-branch.go1.19] crypto/tls: support ECDHE when ec_point_formats is missing

Updates #49126
Fixes #54643

Change-Id: I9d6f6392b1a6748bdac1d2c6371b22d75829a2b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/425295
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Alex Scheel <alex.scheel@hashicorp.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: David Chase <drchase@google.com>
(cherry picked from commit 1df2a03b17b4496bddfb482ec45b2a29c20e5249)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425635

21 months ago[release-branch.go1.19] cmd/go/internal/imports: include ToolTags in the Tags map
Zeke Lu [Thu, 25 Aug 2022 04:17:00 +0000 (04:17 +0000)]
[release-branch.go1.19] cmd/go/internal/imports: include ToolTags in the Tags map

This fixes a regression introduced when the "race" mode tag was moved to
the ToolTags field in CL 358539.

Fixes #54660
Updates #54468

Change-Id: I107771948a4fe9d743cc13d1c15f324212b08e03
GitHub-Last-Rev: d211e351ef3331f2c38b16d327d992a32ebbfe30
GitHub-Pull-Request: golang/go#54618
Reviewed-on: https://go-review.googlesource.com/c/go/+/425154
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 6ba2674ddc5373f261211ba5ebc38496dc660604)
Reviewed-on: https://go-review.googlesource.com/c/go/+/426434
Reviewed-by: Heschi Kreinick <heschi@google.com>
21 months ago[release-branch.go1.19] cmd/go: avoid registering AtExit handlers in tests
Bryan C. Mills [Wed, 24 Aug 2022 13:45:18 +0000 (09:45 -0400)]
[release-branch.go1.19] cmd/go: avoid registering AtExit handlers in tests

Ever since 'go build' was added (in CL 5483069), it has used an atexit
handler to clean up working directories.

CL 154109 introduced 'cc' command to the script test framework that
called Init on a builder once per invocation. Unfortunately, since
base.AtExit is unsynchronized, the Init added there caused any script
that invokes that command to be unsafe for concurrent use.

This change fixes the race by having the 'cc' command pass in its
working directory instead of allowing the Builder to allocate one.
Following modern Go best practices, it also replaces the in-place Init
method (which is prone to typestate and aliasing bugs) with a
NewBuilder constructor function.

Updates #54423.
Fixes #54637.

Change-Id: I8fc2127a7d877bb39a1174e398736bb51d03d4d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/425205
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
(cherry picked from commit d5aa088d822bc8ef3ceb80c20184f40fcb9b8d2e)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425207

21 months ago[release-branch.go1.19] crypto/x509: don't panic marshaling invalid ECDSA keys
Filippo Valsorda [Tue, 9 Aug 2022 20:02:57 +0000 (13:02 -0700)]
[release-branch.go1.19] crypto/x509: don't panic marshaling invalid ECDSA keys

MarshalPKIXPublicKey, CreateCertificate, CreateCertificateRequest,
MarshalECPrivateKey, and MarshalPKCS8PrivateKey started raising a panic
when encoding an invalid ECDSA key in Go 1.19. Since they have an error
return value, they should return an error instead.

Updates #54288
Fixes #54295

Change-Id: Iba132cd2f890ece36bb7d0396eb9a9a77bdb81df
Reviewed-on: https://go-review.googlesource.com/c/go/+/422298
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
(cherry picked from commit f64f12f0b32eba7d49c259480e0fa0c79eb47600)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425634

21 months ago[release-branch.go1.19] net/url: consistently remove ../ elements in JoinPath
Damien Neil [Fri, 12 Aug 2022 23:21:09 +0000 (16:21 -0700)]
[release-branch.go1.19] net/url: consistently remove ../ elements in JoinPath

JoinPath would fail to remove relative elements from the start of
the path when the first path element is "".

In addition, JoinPath would return the original path unmodified
when provided with no elements to join, violating the documented
behavior of always cleaning the resulting path.

Correct both these cases.

    JoinPath("http://go.dev", "../go")
    // before: http://go.dev/../go
    // after:  http://go.dev/go

    JoinPath("http://go.dev/../go")
    // before: http://go.dev/../go
    // after:  http://go.dev/go

For #54385.
Fixes #54635.
Fixes CVE-2022-32190.

Change-Id: I6d22cd160d097c50703dd96e4f453c6c118fd5d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/423514
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
(cherry picked from commit 0765da5884adcc8b744979303a36a27092d8fc51)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425357
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

21 months ago[release-branch.go1.19] cmd/go: avoid overwriting cached Origin metadata
Bryan C. Mills [Tue, 23 Aug 2022 22:00:34 +0000 (18:00 -0400)]
[release-branch.go1.19] cmd/go: avoid overwriting cached Origin metadata

Fixes #54633.
Updates #54631.

Change-Id: I17d2fa282642aeb1ae2a6e29a0756b8960bea34b
Reviewed-on: https://go-review.googlesource.com/c/go/+/425255
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
(cherry picked from commit e3004d96b6899945d76e5dd373756324c8ff98fb)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425211

21 months ago[release-branch.go1.19] cmd/compile: handle partially overlapping assignments
Keith Randall [Mon, 22 Aug 2022 17:26:50 +0000 (10:26 -0700)]
[release-branch.go1.19] cmd/compile: handle partially overlapping assignments

Normally, when moving Go values of type T from one location to another,
we don't need to worry about partial overlaps. The two Ts must either be
in disjoint (nonoverlapping) memory or in exactly the same location.
There are 2 cases where this isn't true:
 1) Using unsafe you can arrange partial overlaps.
 2) Since Go 1.17, you can use a cast from a slice to a ptr-to-array.
    https://go.dev/ref/spec#Conversions_from_slice_to_array_pointer
    This feature can be used to construct partial overlaps of array types.
      var a [3]int
      p := (*[2]int)(a[:])
      q := (*[2]int)(a[1:])
      *p = *q
We don't care about solving 1. Or at least, we haven't historically
and no one has complained.
For 2, we need to ensure that if there might be partial overlap,
then we can't use OpMove; we must use memmove instead.
(memmove handles partial overlap by copying in the correct
direction. OpMove does not.)

Note that we have to be careful here not to introduce a call when
we're marshaling arguments to a call or unmarshaling results from a call.

Fixes #54629

Change-Id: I1ca6aba8041576849c1d85f1fa33ae61b80a373d
Reviewed-on: https://go-review.googlesource.com/c/go/+/425076
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
(cherry picked from commit 332a5981d0ae3f21f668f94755f43ecd8ee9a9eb)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425234

21 months ago[release-branch.go1.19] misc/cgo/testcarchive: permit SIGQUIT for TestSignalForwardin...
Ian Lance Taylor [Fri, 19 Aug 2022 21:43:47 +0000 (14:43 -0700)]
[release-branch.go1.19] misc/cgo/testcarchive: permit SIGQUIT for TestSignalForwardingExternal

Occasionally the signal will be sent to a Go thread, which will cause
the program to exit with SIGQUIT rather than SIGSEGV.

Add TestSignalForwardingGo to test the case where the signal is
expected to be delivered to a Go thread.

This is a roll forward of CL 419014 which was rolled back in CL 424954.
This CL differs from 419014 in that it skips TestSignalForwardingGo
on darwin-amd64.

For #53907
Fixes #54239

Change-Id: I5df3fd610c068df3bd48d9b3d7a9379248b97999
Reviewed-on: https://go-review.googlesource.com/c/go/+/425002
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
(cherry picked from commit d05ce23756573c6dc2c5026d936f2ef6ac140ee2)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425487
Reviewed-by: David Chase <drchase@google.com>
21 months ago[release-branch.go1.19] cmd/compile: correct alignment of atomic.Int64
Cuong Manh Le [Wed, 3 Aug 2022 08:14:25 +0000 (15:14 +0700)]
[release-branch.go1.19] cmd/compile: correct alignment of atomic.Int64

Same as CL 417555, but for cmd/compile.

Fixes #54235

Change-Id: I4cc6deaf0a87c952f636888b4ab73f81a44bfebd
Reviewed-on: https://go-review.googlesource.com/c/go/+/420975
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/422034
Reviewed-by: Than McIntosh <thanm@google.com>
21 months ago[release-branch.go1.19] cmd: vendor github.com/google/pprof to fix mangled type param...
Michael Pratt [Fri, 12 Aug 2022 18:29:56 +0000 (14:29 -0400)]
[release-branch.go1.19] cmd: vendor github.com/google/pprof to fix mangled type parameter symbol names

Updates github.com/google/pprof to bring in the commit from
https://github.com/google/pprof/pull/717 which fixes mangled
symbol names for type parameters.

For #54105
Fixes #54420

Change-Id: I01af9f780aba3338b960a03b30906a23642e4448
Reviewed-on: https://go-review.googlesource.com/c/go/+/420234
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Than McIntosh <thanm@google.com>
(cherry picked from commit cd9cd925bb9ed79975f2531a6b84f69905e4fc31)
Reviewed-on: https://go-review.googlesource.com/c/go/+/423356
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
21 months ago[release-branch.go1.19] cmd/compile: fix wrong typeparams for selector expr with...
Cuong Manh Le [Sat, 23 Jul 2022 15:31:35 +0000 (22:31 +0700)]
[release-branch.go1.19] cmd/compile: fix wrong typeparams for selector expr with embedded generic type

For selector expression "x.M" where "M" is a promoted method, irgen is using
the type of receiver "x" for determining the typeparams for instantiation.
However, because M is a promoted method, so its associated receiver is
not "x", but "x.T" where "T" is the embedded field of "x". That casues a
mismatch when converting non-shape types arguments.

Fixing it by using the actual receiver which has the method, instead of
using the base receiver.

Fixes #54243

Change-Id: I1836fc422d734df14e9e6664d4bd014503960bfc
Reviewed-on: https://go-review.googlesource.com/c/go/+/419294
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/423114
Reviewed-by: Carlos Amedee <carlos@golang.org>
21 months ago[release-branch.go1.19] cmd/compile: fix import/export of ODYNAMICDOTTYPE
Matthew Dempsky [Fri, 5 Aug 2022 23:09:22 +0000 (16:09 -0700)]
[release-branch.go1.19] cmd/compile: fix import/export of ODYNAMICDOTTYPE

The RType field isn't needed when performing type assertions from
non-empty interface types, because we use the ITab field instead. But
the inline body exporter didn't know to expect this.

It's possible we could use a single bool to distinguish whether
we're serializing the RType or ITab field, but using two is simpler
and seems safer.

Fixes #54309.

Change-Id: I9ddac72784fb2241fee0a0dee30493d868a2c259
Reviewed-on: https://go-review.googlesource.com/c/go/+/421755
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: Keith Randall <khr@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
(cherry picked from commit 0c4db1e347dc51589e5289388305b02108ca0aa1)
Reviewed-on: https://go-review.googlesource.com/c/go/+/421715
Reviewed-by: Than McIntosh <thanm@google.com>
21 months ago[release-branch.go1.19] go1.19 go1.19
Gopher Robot [Tue, 2 Aug 2022 16:39:14 +0000 (16:39 +0000)]
[release-branch.go1.19] go1.19

Change-Id: Iea643b04a7eea7c882d7eec481b67e4ecc08a559
Reviewed-on: https://go-review.googlesource.com/c/go/+/420834
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
22 months ago[release-branch.go1.19] test: improve generic type assertion test
Matthew Dempsky [Mon, 1 Aug 2022 20:23:36 +0000 (13:23 -0700)]
[release-branch.go1.19] test: improve generic type assertion test

The test added in CL 420674 only tested that the type assertions
compiled at all. This CL changes it into a run test to make sure the
type assertions compile and also run correctly.

Updates #54135.

Change-Id: Id17469faad1bb55ff79b0bb4163ef50179330033
Reviewed-on: https://go-review.googlesource.com/c/go/+/420421
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
(cherry picked from commit f2a9f3e2e0ce7e582d226ad9a41d3c36b146fc25)
Reviewed-on: https://go-review.googlesource.com/c/go/+/420675
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
22 months ago[release-branch.go1.19] cmd/compile: fix wrong dict pass condition for type assertions
Wayne Zuo [Sun, 31 Jul 2022 09:20:26 +0000 (17:20 +0800)]
[release-branch.go1.19] cmd/compile: fix wrong dict pass condition for type assertions

Updates #54135.

Change-Id: I2b27af8124014b2699ea44bdc765e1fb8f6c8028
Reviewed-on: https://go-review.googlesource.com/c/go/+/420394
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
(cherry picked from commit 27038b70f860e29fdf472ac5fb208b6ad9598c10)
Reviewed-on: https://go-review.googlesource.com/c/go/+/420674
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
22 months ago[release-branch.go1.19] all: merge master (e99f53f) into release-branch.go1.19
Dmitri Shuralyov [Mon, 1 Aug 2022 18:19:15 +0000 (14:19 -0400)]
[release-branch.go1.19] all: merge master (e99f53f) into release-branch.go1.19

Merge List:

+ 2022-08-01 e99f53fed9 doc: move Go 1.19 release notes to x/website
+ 2022-08-01 8b13a073a1 doc: mention removal of cmd/compile's -importmap and -installsuffix flags
+ 2022-08-01 e95fd4c238 doc/go1.19: fix typo: EM_LONGARCH -> EM_LOONGARCH
+ 2022-08-01 dee3efd9f8 doc/go1.19: fix a few links that were missing trailing slashes
+ 2022-07-30 f32519e5fb runtime: fix typos
+ 2022-07-29 9a2001a8cc cmd/dist: always pass -short=true with -quick
+ 2022-07-28 5c8ec89cb5 doc/go1.19: minor adjustments and links
+ 2022-07-28 417be37048 doc/go1.19: improve the loong64 release notes
+ 2022-07-28 027855e8d8 os/exec: add GODEBUG setting to opt out of ErrDot changes
+ 2022-07-27 462b78fe70 misc/cgo/test: use fewer threads in TestSetgidStress in long mode
+ 2022-07-27 055113ef36 math/big: check buffer lengths in GobDecode
+ 2022-07-27 4248146154 net: document UDPConn.ReadFromUDPAddrPort's AddrPort result more
+ 2022-07-26 faf4e97200 net: fix WriteMsgUDPAddrPort addr handling
+ 2022-07-26 caa225dd29 doc/go1.19: note that updated race syso files require GNU ld 2.26
+ 2022-07-26 ceefd3a37b bytes: document that Reader.Reset affects the result of Size
+ 2022-07-26 3e97294663 runtime/cgo: use frame address to set g0 stack bound
+ 2022-07-25 24dc27a3c0 cmd/compile: fix blank label code
+ 2022-07-25 9fcc8b2c1e runtime: fix runtime.Breakpoint() on windows/arm64
+ 2022-07-25 795a88d0c3 cmd/go: add space after comma in 'go help test'
+ 2022-07-25 9eb3992ddd doc/go1.19: minor fixes
+ 2022-07-25 dcea1ee6e3 time: clarify documentation for allowed formats and add tests to prove them
+ 2022-07-25 37c8112b82 internal/fuzz: fix typo in function comments
+ 2022-07-25 850d547d2d doc/go1.19: expand crypto release notes
+ 2022-07-24 64f2829c9c runtime: fix typo in function comments
+ 2022-07-24 2ff563a00e cmd/compile/internal/noder: correct spelling errors for instantiation
+ 2022-07-22 c5da4fb7ac cmd/compile: make jump table symbol local
+ 2022-07-22 774fa58d1d A+C: delete AUTHORS and CONTRIBUTORS
+ 2022-07-21 2d655fb15a unsafe: document when Sizeof/Offsetof/Alignof are not constant
+ 2022-07-21 076c3d7f07 net/http: remove accidental heading in Head documentation
+ 2022-07-21 c4a6d3048b cmd/dist: enable race detector test on S390X
+ 2022-07-20 244c8b0500 cmd/cgo: allow cgo to pass strings or []bytes bigger than 1<<30
+ 2022-07-20 df38614bd7 test: use go tool from tree, not path
+ 2022-07-20 bb1749ba3b cmd/compile: improve GOAMD64=v1 violation test
+ 2022-07-19 176b63e711 crypto/internal/nistec,debug/gosym: fix typos
+ 2022-07-19 8e1e64c16a cmd/compile: fix mknode script
+ 2022-07-19 28be440d34 A+C: add Weizhi Yan
+ 2022-07-19 85a482fc24 runtime: revert to using the precomputed trigger for pacer calculations
+ 2022-07-19 ae7340ab68 CONTRIBUTORS: update for the Go 1.19 release
+ 2022-07-18 de8101d21b runtime: fix typos
+ 2022-07-18 967a3d985d cmd/compile: revert "remove -installsuffix flag"
+ 2022-07-18 c0c1bbde17 http: improve Get documentation
+ 2022-07-15 2aa473cc54 go/types, types2: correct alignment of atomic.Int64
+ 2022-07-15 4651ebf961 encoding/gob: s/TestIngoreDepthLimit/TestIgnoreDepthLimit/
+ 2022-07-14 dc00aed6de go/parser: skip TestParseDepthLimit for short tests
+ 2022-07-14 783ff7dfc4 encoding/xml: skip TestCVE202230633 for short tests
+ 2022-07-14 aa80228526 cmd/go/internal/modfetch: avoid duplicating path components in Git fetch errors
+ 2022-07-14 b9d5a25442 cmd/go: save zip sums for downloaded modules in 'go mod download' in a workspace
+ 2022-07-14 a906d3dd09 cmd/go: avoid re-enqueuing workspace dependencies with errors
+ 2022-07-14 266c70c263 doc/go1.19: add a release note for 'go list -json=SomeField'
+ 2022-07-13 558785a0a9 cmd/compile: remove -installsuffix flag
+ 2022-07-13 1355ea3045 cmd/compile: remove -importmap flag
+ 2022-07-13 f71f3d1b86 misc/cgo/testshared: run tests only in GOPATH mode
+ 2022-07-13 feada53661 misc/cgo/testcshared: don't rely on an erroneous install target in tests
+ 2022-07-13 c006b7ac27 runtime: clear timerModifiedEarliest when last timer is deleted
+ 2022-07-13 923740a8cc cmd/compile: fix type assert in dict pass
+ 2022-07-12 bf2ef26be3 cmd/go: in script tests, avoid checking non-main packages for staleness
+ 2022-07-12 5f5cae7200 cmd/go: avoid indexing GOROOT packages when the compiler is 'gccgo'
+ 2022-07-12 c2edb2c841 cmd/go: port TestIssue16471 to a script test and add verbose logging
+ 2022-07-12 9c2526e637 cmd/go/internal/modfetch/codehost: add missing newline in '# lock' log message
+ 2022-07-12 85486bcccb image/jpeg: increase TestLargeImageWithShortData timeout by an order of magnitude
+ 2022-07-12 27794c4d4a cmd/go/internal/modload: ignore disallowed errors when checking for updates

Change-Id: Ic05832c8c7c33ab016386bf7e85d6bad62a8fb98

22 months agodoc: move Go 1.19 release notes to x/website
Dmitri Shuralyov [Mon, 1 Aug 2022 17:38:27 +0000 (13:38 -0400)]
doc: move Go 1.19 release notes to x/website

Now that the development of the Go 1.19 release is almost done, its
release notes are moved to their eventual long-term home in x/website
in CL 420417. Delete the initial development copy here.

For golang/go#51400.

Change-Id: I741285555af28ce9a64e7f8d2b9fe2a0f3e13c26
Reviewed-on: https://go-review.googlesource.com/c/go/+/420418
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
22 months agodoc: mention removal of cmd/compile's -importmap and -installsuffix flags
Matthew Dempsky [Wed, 13 Jul 2022 22:00:53 +0000 (15:00 -0700)]
doc: mention removal of cmd/compile's -importmap and -installsuffix flags

Updates #51225.

Change-Id: I820f3f5ba169635fee37c30e41b370c9399a436d
Reviewed-on: https://go-review.googlesource.com/c/go/+/417534
Reviewed-by: Russ Cox <rsc@golang.org>
22 months agodoc/go1.19: fix typo: EM_LONGARCH -> EM_LOONGARCH
WANG Xuerui [Mon, 1 Aug 2022 13:19:29 +0000 (21:19 +0800)]
doc/go1.19: fix typo: EM_LONGARCH -> EM_LOONGARCH

Another last-minute fix. The whole repo is checked case-insensitively
against "longarch" and this is the only occurrence.

Change-Id: If13c123c1e44001a346f1df1df9d839c699703b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/420494
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
22 months agodoc/go1.19: fix a few links that were missing trailing slashes
Brad Fitzpatrick [Wed, 27 Jul 2022 02:28:00 +0000 (19:28 -0700)]
doc/go1.19: fix a few links that were missing trailing slashes

They were part of a chain of three redirects. Now it's only two,
but that's #54081.

Change-Id: Ibfe6a17a372df61df40124892951b48577e4ced9
Reviewed-on: https://go-review.googlesource.com/c/go/+/419634
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agoruntime: fix typos
hopehook [Sat, 30 Jul 2022 14:11:32 +0000 (22:11 +0800)]
runtime: fix typos

Change-Id: I30c125be6cb321aa03ea827bd11c3169087e3d4c
Reviewed-on: https://go-review.googlesource.com/c/go/+/420314
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

22 months agocmd/dist: always pass -short=true with -quick
Ian Lance Taylor [Sat, 16 Jul 2022 23:08:35 +0000 (16:08 -0700)]
cmd/dist: always pass -short=true with -quick

Fixes #53818

Change-Id: I190a8bcf50d92b9c10e9980e630ebb362d8b19ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/417918
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
22 months agodoc/go1.19: minor adjustments and links
Russ Cox [Thu, 28 Jul 2022 17:06:28 +0000 (13:06 -0400)]
doc/go1.19: minor adjustments and links

A few last-minute clarifications before the release.

Change-Id: Ia0123441633c147aa3f76ea29ed26c7722e2416c
Reviewed-on: https://go-review.googlesource.com/c/go/+/419994
Reviewed-by: Ian Lance Taylor <iant@google.com>
22 months agodoc/go1.19: improve the loong64 release notes
WANG Xuerui [Sat, 16 Jul 2022 12:15:49 +0000 (20:15 +0800)]
doc/go1.19: improve the loong64 release notes

Link to the LoongArch documentations site, mention the ABI variant
supported, and add a note about the unfortunate old-world/new-world split
situation that users must be aware of.

Updates #46229
For #51400

Change-Id: I6789f509263a0dbf113481148665e7951aa6a989
Reviewed-on: https://go-review.googlesource.com/c/go/+/417715
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
22 months agoos/exec: add GODEBUG setting to opt out of ErrDot changes
Russ Cox [Wed, 27 Jul 2022 18:36:05 +0000 (14:36 -0400)]
os/exec: add GODEBUG setting to opt out of ErrDot changes

The changes are likely to break users, and we need
to make it easy to unbreak without code changes.

For #43724.
Fixes #53962.

Change-Id: I105c5d6c801d354467e0cefd268189c18846858e
Reviewed-on: https://go-review.googlesource.com/c/go/+/419794
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

22 months agomisc/cgo/test: use fewer threads in TestSetgidStress in long mode
Cherry Mui [Wed, 27 Jul 2022 16:59:16 +0000 (12:59 -0400)]
misc/cgo/test: use fewer threads in TestSetgidStress in long mode

TestSetgidStress originally spawns 1000 threads for stress testing.
It caused timeout on some builders so CL 415677 reduced to 50 in
short mode. But it still causes flaky timeouts in longtest
builders, so reduce the number of threads in long mode as well.

Should fix #53641.

Change-Id: I02f4ef8a143bb1faafe3d11ad223f36f5cc245c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/419453
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agomath/big: check buffer lengths in GobDecode
Roland Shoemaker [Fri, 15 Jul 2022 17:43:44 +0000 (10:43 -0700)]
math/big: check buffer lengths in GobDecode

In Float.GobDecode and Rat.GobDecode, check buffer sizes before
indexing slices.

Fixes #53871

Change-Id: I1b652c32c2bc7a0e8aa7620f7be9b2740c568b0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/417774
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tatiana Bradley <tatiana@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>

22 months agonet: document UDPConn.ReadFromUDPAddrPort's AddrPort result more
Brad Fitzpatrick [Tue, 26 Jul 2022 20:29:16 +0000 (13:29 -0700)]
net: document UDPConn.ReadFromUDPAddrPort's AddrPort result more

Clarify the form of its IPv4 addresses when listening on an
unspecified address.

(found while testing/reviewing CL 399454)

Change-Id: I62b367f5a4e6d340eb72dd7ec342080f1821e63e
Reviewed-on: https://go-review.googlesource.com/c/go/+/419614
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

22 months agonet: fix WriteMsgUDPAddrPort addr handling
database64128 [Fri, 29 Apr 2022 17:29:58 +0000 (17:29 +0000)]
net: fix WriteMsgUDPAddrPort addr handling

WriteMsgUDPAddrPort should accept IPv4 target addresses on IPv6 UDP sockets.
An IPv4 target address will be converted to an IPv4-mapped IPv6 address.

Fixes #52264.

Change-Id: Ib9ed4c61fa1289ae7bbc8c4c9de1a9951b647ec0
GitHub-Last-Rev: 6776fdb0a76faa71ebde58f5143fb1ffb3112adf
GitHub-Pull-Request: golang/go#52265
Reviewed-on: https://go-review.googlesource.com/c/go/+/399454
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
22 months agodoc/go1.19: note that updated race syso files require GNU ld 2.26
Ian Lance Taylor [Tue, 26 Jul 2022 19:50:02 +0000 (12:50 -0700)]
doc/go1.19: note that updated race syso files require GNU ld 2.26

For #54060

Change-Id: I6360565056d7fb7110ff00b0f3f9a3fc02ba7f2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/419595
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agobytes: document that Reader.Reset affects the result of Size
Muhammed Can Küçükaslan [Sun, 24 Jul 2022 21:44:11 +0000 (21:44 +0000)]
bytes: document that Reader.Reset affects the result of Size

The Reader.Reset changes the underlying byte slice, so it actually
changes the return value of the Size method.

Fixes #54018

Change-Id: I160deaa2244e95cb93303cb5dfb67a8d90a375ef
GitHub-Last-Rev: b04724a072d956db1f84a8f5db0afa0dbb158e96
GitHub-Pull-Request: golang/go#54020
Reviewed-on: https://go-review.googlesource.com/c/go/+/419237
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@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>

22 months agoruntime/cgo: use frame address to set g0 stack bound
Cherry Mui [Mon, 25 Jul 2022 15:02:56 +0000 (11:02 -0400)]
runtime/cgo: use frame address to set g0 stack bound

For a cgo binary, at startup we set g0's stack bounds using the
address of a local variable (&size) in a C function x_cgo_init and
the stack size from pthread_attr_getstacksize. Normally, &size is
an address within the current stack frame. However, when  it is
compiled with ASAN, it may be instrumented to __asan_stack_malloc_0
and the address may not live in the current stack frame, causing
the stack bound to be set incorrectly, e.g. lo > hi.

Using __builtin_frame_address(0) to get the stack address instead.

Change-Id: I41df929e5ed24d8bbf3e15027af6dcdfc3736e37
Reviewed-on: https://go-review.googlesource.com/c/go/+/419434
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
22 months agocmd/compile: fix blank label code
Keith Randall [Sun, 24 Jul 2022 16:48:56 +0000 (09:48 -0700)]
cmd/compile: fix blank label code

When checkEnabled is forced true, the 52278 test fails. Be a bit
more careful about processing blank labels.

Update #52278

Change-Id: I48aa89e2c9e3715d8efe599bc4363b5b5879d8a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/419318
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
22 months agoruntime: fix runtime.Breakpoint() on windows/arm64
qmuntal [Thu, 21 Jul 2022 10:18:51 +0000 (12:18 +0200)]
runtime: fix runtime.Breakpoint() on windows/arm64

Fixes #53837

Change-Id: I4219fe35aac1a88aae2905998fbb1d7db87bbfb2
Reviewed-on: https://go-review.googlesource.com/c/go/+/418734
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Alessandro Arzilli <alessandro.arzilli@gmail.com>

22 months agocmd/go: add space after comma in 'go help test'
Justin Traglia [Wed, 20 Jul 2022 14:20:41 +0000 (14:20 +0000)]
cmd/go: add space after comma in 'go help test'

This PR fixes a simple typo. It adds a space after a comma. Noticed while looking at `go help test` output.

Change-Id: I5b54f4da0d08a056bffc04899983d858dfa91043
GitHub-Last-Rev: da9cab5eb946523b8783aafe4f05f516e4a77437
GitHub-Pull-Request: golang/go#53931
Reviewed-on: https://go-review.googlesource.com/c/go/+/418034
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
22 months agodoc/go1.19: minor fixes
Tobias Klauser [Fri, 22 Jul 2022 21:35:41 +0000 (23:35 +0200)]
doc/go1.19: minor fixes

EM_LONGARCH and R_LARCH_* are defined in package debug/elf. Change the
definition list title accordingly.

Format links sort.Find and sort.Search as code.

Add a link to syscall.Getrusage.

Change-Id: I30602baedda8ccac028101858a608f1d8ffb633b
Reviewed-on: https://go-review.googlesource.com/c/go/+/419214
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
22 months agotime: clarify documentation for allowed formats and add tests to prove them
Marcus Watkins [Thu, 21 Jul 2022 18:38:51 +0000 (12:38 -0600)]
time: clarify documentation for allowed formats and add tests to prove them

The existing documentation for the time.Layout const states "Only these values
are recognized", but then doesn't include the numeric forms for month leading to
ambiguity and assumptions that may not be true. It's unclear, for example,
that space padding is only available for day of the month.

Finally I add tests to show the behaviors in specific scenarios.

Change-Id: I4e08a14834c17b6bdf3b6b47d39dafa8c1a138fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/418875
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>

22 months agointernal/fuzz: fix typo in function comments
Abirdcfly [Sun, 24 Jul 2022 15:05:37 +0000 (15:05 +0000)]
internal/fuzz: fix typo in function comments

The correct word to use here is 'retrieve' not 'retrive'

Change-Id: I8de0961a254cf429ddbaf599fe996155e24c7af2
GitHub-Last-Rev: 65aaeec8db14c23e7bc8a62ce9ecfde98a263a49
GitHub-Pull-Request: golang/go#54026
Reviewed-on: https://go-review.googlesource.com/c/go/+/419317
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@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>

22 months agodoc/go1.19: expand crypto release notes
Filippo Valsorda [Sun, 24 Jul 2022 13:48:29 +0000 (15:48 +0200)]
doc/go1.19: expand crypto release notes

Not included are the following changes that were backported to Go 1.18
minor releases.

bb1f441618 crypto/rand: properly handle large Read on windows
35998c0109 crypto/x509: only disable SHA-1 verification for certificates
0fca8a8f25 crypto/x509: fix Certificate.Verify crash
fe4de36198 crypto/tls: randomly generate ticket_age_add
37065847d8 crypto/elliptic: tolerate zero-padded scalars in generic P-256
9a53b472b5 crypto/x509: properly handle issuerUniqueID and subjectUniqueID

The following are the benchmarks to back up the 3x speedup claim in the
crypto/elliptic notes.

name                    old time/op    new time/op    delta
pkg:crypto/elliptic goos:darwin goarch:arm64
ScalarBaseMult/P256-8   18.3µs ± 0%    18.2µs ± 0%      -0.56%  (p=0.000 n=10+10)
ScalarBaseMult/P224-8    233µs ± 0%      74µs ± 0%     -68.09%  (p=0.000 n=9+10)
ScalarBaseMult/P384-8    805µs ± 0%     236µs ± 0%     -70.73%  (p=0.000 n=8+10)
ScalarBaseMult/P521-8   2.50ms ± 0%    0.68ms ± 0%     -72.63%  (p=0.000 n=10+8)
ScalarMult/P256-8       68.4µs ± 0%    68.6µs ± 0%      +0.26%  (p=0.000 n=10+10)
ScalarMult/P224-8        234µs ± 0%     231µs ± 0%      -1.18%  (p=0.000 n=10+8)
ScalarMult/P384-8        805µs ± 0%     805µs ± 0%        ~     (p=0.211 n=9+10)
ScalarMult/P521-8       2.50ms ± 0%    2.49ms ± 0%      -0.69%  (p=0.000 n=10+10)
pkg:crypto/ecdsa goos:darwin goarch:arm64
Sign/P256-8             31.9µs ± 1%    31.7µs ± 0%      -0.64%  (p=0.001 n=10+10)
Sign/P224-8              264µs ± 0%     106µs ± 0%     -60.09%  (p=0.000 n=10+10)
Sign/P384-8              884µs ± 0%     313µs ± 0%     -64.53%  (p=0.000 n=9+10)
Sign/P521-8             2.64ms ± 0%    0.84ms ± 0%     -68.13%  (p=0.000 n=9+9)
Verify/P256-8           91.6µs ± 0%    91.7µs ± 0%        ~     (p=0.052 n=10+10)
Verify/P224-8            486µs ± 0%     300µs ± 0%     -38.15%  (p=0.000 n=9+9)
Verify/P384-8           1.66ms ± 0%    1.01ms ± 0%     -39.12%  (p=0.000 n=10+9)
Verify/P521-8           5.12ms ± 1%    3.06ms ± 0%     -40.27%  (p=0.000 n=10+10)
GenerateKey/P256-8      19.6µs ± 0%    19.4µs ± 0%      -0.79%  (p=0.000 n=10+10)
GenerateKey/P224-8       235µs ± 0%      76µs ± 1%     -67.45%  (p=0.000 n=8+10)
GenerateKey/P384-8       807µs ± 0%     239µs ± 0%     -70.43%  (p=0.000 n=9+10)
GenerateKey/P521-8      2.49ms ± 0%    0.69ms ± 0%     -72.36%  (p=0.000 n=9+10)

Change-Id: I7fb2db3aea4aac785a48d45fff7a32909f3b578c
Reviewed-on: https://go-review.googlesource.com/c/go/+/419355
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
22 months agoruntime: fix typo in function comments
Abirdcfly [Sun, 24 Jul 2022 13:41:16 +0000 (13:41 +0000)]
runtime: fix typo in function comments

The correct word to use here is 'receive' not 'recieve'

Change-Id: Ia33e2a91c1c2da6dbe479a05518dbb9b8733d20d
GitHub-Last-Rev: e3c3e211dd7055d1dab8699a88d0b35c459da149
GitHub-Pull-Request: golang/go#54025
Reviewed-on: https://go-review.googlesource.com/c/go/+/419316
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>

22 months agocmd/compile/internal/noder: correct spelling errors for instantiation
jacobishao [Sun, 24 Jul 2022 12:38:48 +0000 (12:38 +0000)]
cmd/compile/internal/noder: correct spelling errors for instantiation

Change-Id: I8091b3181e6dd0c335763c411a6a64026fe5a651
GitHub-Last-Rev: 505c6caa9cd4538f76dde4287b9266e8947e395e
GitHub-Pull-Request: golang/go#54024
Reviewed-on: https://go-review.googlesource.com/c/go/+/419315
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>

22 months agocmd/compile: make jump table symbol local
Cherry Mui [Thu, 21 Jul 2022 22:23:39 +0000 (18:23 -0400)]
cmd/compile: make jump table symbol local

When using plugins, if the plugin and the main executable both
have the same function, and if it uses jump table, currently the
jump table symbol have the same name so it will be deduplicated by
the dynamic linker. This causes a function in the plugin may (in
the middle of the function) jump to the function with the same name
in the main executable (or vice versa). But the function may be
compiled slightly differently, because the plugin needs to be PIC.
Jumping from the middle of one function to the other will not work.
Avoid this problem by marking the jump table symbol local to a DSO.

Fixes #53989.

Change-Id: I2b573b9dfc22401c8a09ffe9b9ea8bb83d3700ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/418960
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agoA+C: delete AUTHORS and CONTRIBUTORS
Russ Cox [Fri, 22 Jul 2022 15:10:23 +0000 (11:10 -0400)]
A+C: delete AUTHORS and CONTRIBUTORS

In 2009, Google's open-source lawyers asked us to create the AUTHORS
file to define "The Go Authors", and the CONTRIBUTORS file was in
keeping with open source best practices of the time.

Re-reviewing our repos now in 2022, the open-source lawyers are
comfortable with source control history taking the place of the
AUTHORS file, and most open source projects no longer maintain
CONTRIBUTORS files.

To ease maintenance, remove AUTHORS and CONTRIBUTORS from all repos.

For #53961.

Change-Id: I332327afb49c45d54e71e018193fb18b09e5d91a
Reviewed-on: https://go-review.googlesource.com/c/go/+/419114
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agounsafe: document when Sizeof/Offsetof/Alignof are not constant
Ian Lance Taylor [Sat, 16 Jul 2022 22:51:25 +0000 (15:51 -0700)]
unsafe: document when Sizeof/Offsetof/Alignof are not constant

They are not constant if their arguments have types that are variable size.

Fixes #53921

Change-Id: I2d46754c27f55a281331c099a11ea3cd85ec4e89
Reviewed-on: https://go-review.googlesource.com/c/go/+/417917
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
22 months agonet/http: remove accidental heading in Head documentation
Dmitri Shuralyov [Thu, 21 Jul 2022 21:09:35 +0000 (17:09 -0400)]
net/http: remove accidental heading in Head documentation

This short sentence was missing a period at the end, which caused it
to be interpreted as a heading. It also gained a '# ' prefix as part
of new gofmt formatting applied in CL 384268. This change makes it a
regular sentence as originally intended.

Updates #51082.

Change-Id: I100410cca21e4f91130f1f3432327bb6d66b12a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/418959
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
22 months agocmd/dist: enable race detector test on S390X
Cherry Mui [Thu, 21 Jul 2022 19:11:13 +0000 (15:11 -0400)]
cmd/dist: enable race detector test on S390X

The support was added but the test was not enabled. Enable it.

Fixes #53981.

Change-Id: I81ea73ea4ebc1013c35cb70ae88b096e02497887
Reviewed-on: https://go-review.googlesource.com/c/go/+/418914
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agocmd/cgo: allow cgo to pass strings or []bytes bigger than 1<<30
Keith Randall [Wed, 20 Jul 2022 19:46:33 +0000 (12:46 -0700)]
cmd/cgo: allow cgo to pass strings or []bytes bigger than 1<<30

There's no real reason to limit to 1<<30 bytes. Maybe it would catch
some mistakes, but probably ones that would quickly manifest in other
ways.

We can't use the fancy new unsafe.Slice function because this code
may still be generated for people with 1.16 or earlier in their go.mod file.
Use unsafe shenanigans instead.

Fixes #53965
Fixes #53958

Change-Id: Ibfa095192f50276091d6c2532e8ccd7832b57ca8
Reviewed-on: https://go-review.googlesource.com/c/go/+/418557
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agotest: use go tool from tree, not path
Keith Randall [Tue, 19 Jul 2022 22:35:51 +0000 (15:35 -0700)]
test: use go tool from tree, not path

Some of our tests do exec.Command("go", "tool", "compile", ...) or
similar. That "go" is selected from PATH. When run.go is started
from the command line (but not from all.bash), the first "go" is whatever
happens to be first in the user's path (some random older version than
tip). We really want all these tests to use the "go" tool from the
source tree under test. Add GOROOT/bin to the front of the path to
ensure that the tools we use come from the source tree under test.

Change-Id: I609261a4add8cd5cb228316752d52b5499aec963
Reviewed-on: https://go-review.googlesource.com/c/go/+/418474
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agocmd/compile: improve GOAMD64=v1 violation test
Keith Randall [Fri, 8 Jul 2022 16:41:14 +0000 (09:41 -0700)]
cmd/compile: improve GOAMD64=v1 violation test

Add more opcodes that are only available in >v1 modes.

This test will now correctly detect the regression in -race mode
for #53743.

Change-Id: Icfbb1384e4333d7b4ff167c9ebcb6f4c7aeb6134
Reviewed-on: https://go-review.googlesource.com/c/go/+/416477
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
22 months agocrypto/internal/nistec,debug/gosym: fix typos
Dan Kortschak [Sat, 16 Jul 2022 23:13:55 +0000 (08:43 +0930)]
crypto/internal/nistec,debug/gosym: fix typos

Change-Id: I228a23754656b41843573bd4217de4df46c9df36
Reviewed-on: https://go-review.googlesource.com/c/go/+/417954
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

22 months agocmd/compile: fix mknode script
Keith Randall [Tue, 19 Jul 2022 16:07:38 +0000 (09:07 -0700)]
cmd/compile: fix mknode script

It's not currently working. Somehow a field of type []constant.Value
causes it to barf. (That field was added with jump table statements.)

Also added some instructions about how to run it correctly (which took
me a suprisingly long time to figure out).

Larger improvements coming, but this gets us to a working state
and is safe for 1.19.

Change-Id: I3027356fde1294942e87d075ca28bb40d2c0d6c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/418234
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Keith Randall <khr@golang.org>

22 months agoA+C: add Weizhi Yan
yanweizhi [Tue, 19 Jul 2022 10:56:23 +0000 (18:56 +0800)]
A+C: add Weizhi Yan

Change-Id: I2cef8fa2a61fc69b9b21ff75428af428d99ae2f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/418174
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

22 months agoruntime: revert to using the precomputed trigger for pacer calculations
Michael Anthony Knyszek [Thu, 14 Jul 2022 21:19:37 +0000 (21:19 +0000)]
runtime: revert to using the precomputed trigger for pacer calculations

Issue #53738 describes in detail how switching to using the actual
trigger point over the precomputed trigger causes a memory regression,
that arises from the fact that the PI controller in front of the
cons/mark ratio has a long time constant (for overdamping), so it
retains a long history of inputs.

This change, for the Go 1.19 cycle, just reverts to using the
precomputed trigger because it's safer, but in the future we should
consider moving away from such a history-sensitive smoothing function.

See the big comment in the diff and #53738 for more details.

Performance difference vs. 1.18 after this change:
https://perf.golang.org/search?q=upload:20220714.15

Fixes #53738.

Change-Id: I636993a730a3eaed25da2a2719860431b296c6f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/417557
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>

22 months agoCONTRIBUTORS: update for the Go 1.19 release
Carlos Amedee [Mon, 18 Jul 2022 16:42:25 +0000 (12:42 -0400)]
CONTRIBUTORS: update for the Go 1.19 release

This update was created using the updatecontrib command:

go install golang.org/x/build/cmd/updatecontrib@latest
cd gotip
updatecontrib

With manual changes based on publicly available information
to canonicalize letter case and formatting for a few names.

For #12042.

Change-Id: I5e648b99004026513c5772b579a72b7add970db4
Reviewed-on: https://go-review.googlesource.com/c/go/+/418016
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agoruntime: fix typos
Jun10ng [Sat, 16 Jul 2022 14:31:14 +0000 (14:31 +0000)]
runtime: fix typos

"finializer" =>  "finalizer"

Change-Id: Ia3c12bff8556b6a8d33b700c59357f47502757b1
GitHub-Last-Rev: c64cf47974020c8480039ba61d0890bdc07a3b0f
GitHub-Pull-Request: golang/go#53917
Reviewed-on: https://go-review.googlesource.com/c/go/+/417915
Reviewed-by: Keith Randall <khr@golang.org>
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: Keith Randall <khr@google.com>
22 months agocmd/compile: revert "remove -installsuffix flag"
Matthew Dempsky [Mon, 18 Jul 2022 17:03:30 +0000 (17:03 +0000)]
cmd/compile: revert "remove -installsuffix flag"

This reverts CL 415236 (commit 558785a0a9df5fbb7e9617c05059cf2892884620).

Reason for revert: Google's internal build system uses -installsuffix.
Restoring -installsuffix for Go 1.19, and will try again for Go 1.20.

Change-Id: Id6571f34f99f01bcf55e8e949e6fe7b6c1896134
Reviewed-on: https://go-review.googlesource.com/c/go/+/418036
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
22 months agohttp: improve Get documentation
minherz [Mon, 13 Jun 2022 05:26:02 +0000 (22:26 -0700)]
http: improve Get documentation

The existing documentation is unclear about header keys formatting.
The clarifying sentence is added to Get function to emphasis that
keys have to be stored in canonical format to have Get returining
non empty value.

Fixes #53140

Change-Id: Icd0955bcbb6676cec028fe37042aed5846e13ed1
Reviewed-on: https://go-review.googlesource.com/c/go/+/417975
Run-TryBot: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
22 months agogo/types, types2: correct alignment of atomic.Int64
Austin Clements [Wed, 13 Jul 2022 19:18:41 +0000 (15:18 -0400)]
go/types, types2: correct alignment of atomic.Int64

atomic.Int64 has special logic in the compiler to ensure it's 8-byte
aligned on 32-bit architectures. The equivalent logic is missing in
go/types, which means the compiler and go/types can come to different
conclusions about the layout of types.

Fix this by mirroring the compiler's logic into go/types.

Fixes #53884.

Change-Id: I3f58a56babb76634839a161ca174c8f085fe3ba4
Reviewed-on: https://go-review.googlesource.com/c/go/+/417555
Reviewed-by: Robert Findley <rfindley@google.com>
22 months agoencoding/gob: s/TestIngoreDepthLimit/TestIgnoreDepthLimit/
Ian Lance Taylor [Fri, 15 Jul 2022 02:47:59 +0000 (19:47 -0700)]
encoding/gob: s/TestIngoreDepthLimit/TestIgnoreDepthLimit/

For #53615

Change-Id: Ib85004d400931094fc1ea933cf73f4a5157aece1
Reviewed-on: https://go-review.googlesource.com/c/go/+/417559
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
22 months agogo/parser: skip TestParseDepthLimit for short tests
Roland Shoemaker [Thu, 14 Jul 2022 20:00:05 +0000 (13:00 -0700)]
go/parser: skip TestParseDepthLimit for short tests

Because it requires a not insignificant amount of memory to run. Also
remove the WASM-only skip from TestScopeDepthLimit, which is less
intensive.

Fixes #53816

Change-Id: I8463046510ce4dd3d8f6d66938828d5e6963c3be
Reviewed-on: https://go-review.googlesource.com/c/go/+/417657
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>

22 months agoencoding/xml: skip TestCVE202230633 for short tests
Roland Shoemaker [Thu, 14 Jul 2022 19:09:19 +0000 (12:09 -0700)]
encoding/xml: skip TestCVE202230633 for short tests

TestCVE202230633 uses a bunch of memory, and the input cannot be
feasibly reduced while maintaining the behavior hasn't regressed. This
test could be reasonably removed, but I'd rather keep it around if we
can.

Fixes #53814

Change-Id: Ie8b3f306efd20b2d9c0fb73122c26351a55694c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/417655
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
22 months agocmd/go/internal/modfetch: avoid duplicating path components in Git fetch errors
Bryan C. Mills [Wed, 16 Feb 2022 19:07:06 +0000 (14:07 -0500)]
cmd/go/internal/modfetch: avoid duplicating path components in Git fetch errors

Fixes #51114

Change-Id: Iebfe65f826b7b583ff2b48b8bc9d2eb23f2726af
Reviewed-on: https://go-review.googlesource.com/c/go/+/386234
Reviewed-by: Valentin Deleplace <deleplace@google.com>
Reviewed-by: Nooras Saba‎ <saba@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>

22 months agocmd/go: save zip sums for downloaded modules in 'go mod download' in a workspace
Bryan C. Mills [Thu, 14 Jul 2022 18:44:21 +0000 (14:44 -0400)]
cmd/go: save zip sums for downloaded modules in 'go mod download' in a workspace

Within a single module we expect all needed checksums to have already
been recorded by a previous call to 'go get' or 'go mod tidy' in that
module. However, when we combine multiple modules in a workspace, they
may upgrade each other's dependencies, so a given module might be
upgraded above the highest version recorded in the individual go.sum
files for the workspace modules.

Since the checksums might not be present in individual go.sum files,
record them in go.work.sum.

Fixes #51946.

Change-Id: Icb4ea874b9e5c5b1950d42650974a24b5d6543d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/417654
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>

22 months agocmd/go: avoid re-enqueuing workspace dependencies with errors
Bryan C. Mills [Thu, 14 Jul 2022 14:51:56 +0000 (10:51 -0400)]
cmd/go: avoid re-enqueuing workspace dependencies with errors

Fixes #53874.

Change-Id: I41ab15cb9b86b807a9d9ad21fe21fb7aa5fbb46f
Reviewed-on: https://go-review.googlesource.com/c/go/+/417594
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agodoc/go1.19: add a release note for 'go list -json=SomeField'
Bryan C. Mills [Thu, 14 Jul 2022 15:37:17 +0000 (11:37 -0400)]
doc/go1.19: add a release note for 'go list -json=SomeField'

For #29666.

Change-Id: I575375fb039e5809b0ed2ce985f6352a61142d63
Reviewed-on: https://go-review.googlesource.com/c/go/+/417595
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Bryan Mills <bcmills@google.com>

22 months agocmd/compile: remove -installsuffix flag
Matthew Dempsky [Wed, 29 Jun 2022 20:20:36 +0000 (13:20 -0700)]
cmd/compile: remove -installsuffix flag

Obsoleted by -importcfg.

cmd/link has a similar flag, but it seems to still be needed at least
for misc/cgo/testshared.TestGopathShlib. I can't immediately tell why
(has something to do with finding .so files), but it doesn't appear to
possibly affect cmd/compile.

Updates #51225.

Change-Id: I80c6aef860bd162c010ad4a1a4f532b400cf901c
Reviewed-on: https://go-review.googlesource.com/c/go/+/415236
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agocmd/compile: remove -importmap flag
Matthew Dempsky [Wed, 29 Jun 2022 20:03:51 +0000 (13:03 -0700)]
cmd/compile: remove -importmap flag

Obsoleted by -importcfg, and no longer used by anything.

Updates #51225.

Change-Id: I49e646d2728347f862f90805051bb03dd4f4bed2
Reviewed-on: https://go-review.googlesource.com/c/go/+/415235
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
22 months agomisc/cgo/testshared: run tests only in GOPATH mode
Bryan C. Mills [Tue, 12 Jul 2022 18:41:33 +0000 (14:41 -0400)]
misc/cgo/testshared: run tests only in GOPATH mode

-buildmode=shared installs shared libraries into GOROOT
and expects to reuse them across builds.
Builds in module mode, however, each have their own set of
dependencies (determined by the module's requirements), so in general
cannot share dependencies with a single GOROOT.

Ideally in the long term we would like to eliminate -buildmode=shared
entirely (see #47788), but first we need a replacement for the subset
of use-cases where it still works today.

In the meantime, we should run these tests only in GOPATH mode.
Non-main packages in module mode should not be installed to
GOPATH/pkg, but due to #37015 they were installed there anyway,
and this test heavily relies on installing non-main packages.

For #37015.

Change-Id: I7c5d90b4075d6f33e3505d6a8f12752309ae5c03
Reviewed-on: https://go-review.googlesource.com/c/go/+/417194
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>

22 months agomisc/cgo/testcshared: don't rely on an erroneous install target in tests
Bryan C. Mills [Tue, 12 Jul 2022 17:43:02 +0000 (13:43 -0400)]
misc/cgo/testcshared: don't rely on an erroneous install target in tests

Non-main packages in module mode should not be installed to
GOPATH/pkg, but due to #37015 they were installed there anyway.

This change switches the 'go install' command in createHeaders to
instead use 'go build' (with an extension determined by the install
target for 'runtime/cgo', which is well-defined at least for the
moment), and switches TestCachedInstall (which appears to be
explicitly testing 'go install') to explicitly request GOPATH mode
(which provides a well-defined install target for the library).

This change follows a similar structure to CL 416954.

For #37015.

Change-Id: I22ae4af0f0d4c50adc9e0f0dc279859d1f258cc8
Reviewed-on: https://go-review.googlesource.com/c/go/+/417096
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
22 months agoruntime: clear timerModifiedEarliest when last timer is deleted
Michael Pratt [Wed, 13 Jul 2022 15:48:04 +0000 (11:48 -0400)]
runtime: clear timerModifiedEarliest when last timer is deleted

timerModifiedEarliest contains the lowest possible expiration for a
modified earlier timer, which may be earlier than timer0When because we
haven't yet updated the heap. Note "may", as the modified earlier timer
that set timerModifiedEarliest may have since been modified later or
deleted.

We can clear timerModifiedEarliest when the last timer is deleted
because by definition there must not be any modified earlier timers.

Why does this matter? checkTimersNoP claims that there is work to do if
timerModifiedEarliest has passed, causing findRunnable to loop back
around to checkTimers. But the code to clean up timerModifiedEarliest in
checkTimers (i.e., the call to adjusttimers) is conditional behind a
check that len(pp.timers) > 0.

Without clearing timerModifiedEarliest, a spinning M that would
otherwise go to sleep will busy loop in findRunnable until some other
work is available.

Note that changing the condition on the call to adjusttimers would also
be a valid fix. I took this approach because it feels a bit cleaner to
clean up timerModifiedEarliest as soon as it is known to be irrelevant.

Fixes #51654.

Change-Id: I3f3787c67781cac7ce87939c5706cef8db927dd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/417434
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
22 months agocmd/compile: fix type assert in dict pass
Wayne Zuo [Sun, 10 Jul 2022 03:11:05 +0000 (11:11 +0800)]
cmd/compile: fix type assert in dict pass

For type assertions, if src type is empty interface, we should
use normal type assertions rather than dynamic type assertions.

Fixes #53762

Change-Id: I596b2e4ad647fe5e42ad884f7273c78f8f50dac2
Reviewed-on: https://go-review.googlesource.com/c/go/+/416736
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
22 months ago[release-branch.go1.19] go1.19rc2 go1.19rc2
Gopher Robot [Tue, 12 Jul 2022 21:47:27 +0000 (21:47 +0000)]
[release-branch.go1.19] go1.19rc2

Change-Id: I1dbe540826135c2f25e2efc49e384b9ec892a72c
Reviewed-on: https://go-review.googlesource.com/c/go/+/417179
Auto-Submit: Gopher Robot <gobot@golang.org>
Run-TryBot: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agocmd/go: in script tests, avoid checking non-main packages for staleness
Bryan C. Mills [Mon, 11 Jul 2022 19:12:06 +0000 (15:12 -0400)]
cmd/go: in script tests, avoid checking non-main packages for staleness

Non-main packages in module mode should not be installed to
GOPATH/pkg, but due to #37015 they were installed there anyway.
Lacking a proper install location, 'go install' becomes a no-op
for non-main packages in module mode.

This change switches the 'go install' commands in the test_fuzz_cache
and build_overlay tests to instead use 'go build', using the '-x' flag
to check for compile commands instead of querying 'go list' about
staleness.

For #37015.

Change-Id: I56d80cf2a43efb6163c62082c86cd3e4f0ff73c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/417095
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
22 months agocmd/go: avoid indexing GOROOT packages when the compiler is 'gccgo'
Bryan C. Mills [Tue, 12 Jul 2022 14:48:47 +0000 (10:48 -0400)]
cmd/go: avoid indexing GOROOT packages when the compiler is 'gccgo'

The gccgo compiler does not load standard-library packages from
GOROOT/src, so we cannot load those packages from the GOROOT/src
index when using that compiler.

This fixes TestScript/gccgo_link_c (and perhaps other gccgo tests)
when a 'gccgo' executable is present. Unfortunately, only a few
builders caught the broken test because 'gccgo' is not installed
on most Go project builders (see #35786).

For #53577.
Fixes #53815.

Change-Id: I11a5cf6dbf4ac9893c4d02bd6ab7ef60f67b1e87
Reviewed-on: https://go-review.googlesource.com/c/go/+/417094
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
22 months agocmd/go: port TestIssue16471 to a script test and add verbose logging
Bryan C. Mills [Fri, 7 Jan 2022 19:17:51 +0000 (14:17 -0500)]
cmd/go: port TestIssue16471 to a script test and add verbose logging

For #50471

Change-Id: I082c1f96113a3228f2ef423a04eaa9fbaa6c7522
Reviewed-on: https://go-review.googlesource.com/c/go/+/376359
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agocmd/go/internal/modfetch/codehost: add missing newline in '# lock' log message
Bryan C. Mills [Wed, 4 May 2022 15:11:20 +0000 (11:11 -0400)]
cmd/go/internal/modfetch/codehost: add missing newline in '# lock' log message

Change-Id: Ib92e983b6cdeed2b275a028c85b2bba583def059
Reviewed-on: https://go-review.googlesource.com/c/go/+/403850
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
22 months agoimage/jpeg: increase TestLargeImageWithShortData timeout by an order of magnitude
Bryan C. Mills [Wed, 25 May 2022 15:09:56 +0000 (11:09 -0400)]
image/jpeg: increase TestLargeImageWithShortData timeout by an order of magnitude

Also dump goroutines on failure.

The original bug report in #10413 reported a hang of “several
minutes”. An apparently-spurious failure was observed in
https://build.golang.org/log/e5ac3ce3fb7d04ec13e5bbfadea8bb5869a4dd1e,
with a delay of only 3.64s.

Moreover, if the test does fail due to a regression, we will want a
goroutine dump to diagnose where it got stuck. The current call to
t.Fatalf does not produce such a dump, so is not nearly as useful if
the failure only occasionally reproduces.

Updates #10413.

Change-Id: I6ab9d112f14f438a0c54e02ec95934627acdc64b
Reviewed-on: https://go-review.googlesource.com/c/go/+/408355
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Yuval Pavel Zholkover <paulzhol@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agocmd/go/internal/modload: ignore disallowed errors when checking for updates
Jay Conrod [Wed, 29 Jun 2022 01:15:32 +0000 (18:15 -0700)]
cmd/go/internal/modload: ignore disallowed errors when checking for updates

addUpdate calls Query with the query "upgrade". Normally, this returns
the highest release version (or prerelease, etc.) that is higher than
the current version and is not retracted or excluded. If there is no
such version, Query should return the current version. If the current
version is retracted or excluded, then Query currently returns an error.

addUpdate should ignore this error, as it ignores ErrNotExist and
NoMatchingVersionError. For 'go list -m -u', addRetraction is also
called, and that will detect the retraction.

Fixes #53594

Change-Id: I90a2872cdeabf03894acad9e0cbdd7db4a4e269e
Reviewed-on: https://go-review.googlesource.com/c/go/+/414825
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
22 months ago[release-branch.go1.19] all: merge master (b2b8872) into release-branch.go1.19
Michael Anthony Knyszek [Tue, 12 Jul 2022 16:00:36 +0000 (16:00 +0000)]
[release-branch.go1.19] all: merge master (b2b8872) into release-branch.go1.19

Merge List:

+ 2022-07-12 b2b8872c87 compress/gzip: fix stack exhaustion bug in Reader.Read
+ 2022-07-12 ac68c6c683 path/filepath: fix stack exhaustion in Glob
+ 2022-07-12 fa2d41d0ca io/fs: fix stack exhaustion in Glob
+ 2022-07-12 6fa37e98ea encoding/gob: add a depth limit for ignored fields
+ 2022-07-12 695be961d5 go/parser: limit recursion depth
+ 2022-07-12 08c46ed43d encoding/xml: use iterative Skip, rather than recursive
+ 2022-07-12 c4c1993fd2 encoding/xml: limit depth of nesting in unmarshal
+ 2022-07-12 913d05133c cmd/go: avoid spurious readdir during fsys.Walk
+ 2022-07-12 d3d7998756 net/http: clarify that MaxBytesReader returns *MaxBytesError
+ 2022-07-11 126c22a098 syscall: gofmt after CL 412114
+ 2022-07-11 123a6328b7 internal/trace: don't report regions on system goroutines
+ 2022-07-11 846490110a runtime/race: update amd64 syso images to avoid sse4
+ 2022-07-11 b75ad09cae cmd/trace: fix typo in web documentation
+ 2022-07-11 7510e597de cmd/go: make module index loading O(1)
+ 2022-07-11 b8bf820d5d cmd/nm: don't rely on an erroneous install target in tests
+ 2022-07-11 ad641e8521 misc/cgo/testcarchive: don't rely on an erroneous install target in tests
+ 2022-07-11 bf5898ef53 net/url: use EscapedPath for url.JoinPath
+ 2022-07-11 398dcd1cf0 database/sql: make TestTxContextWaitNoDiscard test more robust
+ 2022-07-11 f956941b0f cmd/go: use package index for std in load.loadPackageData
+ 2022-07-11 59ab6f351a net/http: remove Content-Encoding in writeNotModified
+ 2022-07-08 c1a4e0fe01 cmd/compile: fix libfuzzer instrumentation line number
+ 2022-07-08 5c1a13e7a4 cmd/go: avoid setting variables for '/' and ':' in TestScript subprocess environments
+ 2022-07-08 180bcad33d net/http: wait for listeners to exit in Server.Close and Shutdown
+ 2022-07-08 14abe8aa73 cmd/compile: don't convert to interface{} for un-comparable types in generic switch
+ 2022-07-07 1ebc983000 runtime: overestimate the amount of allocated memory in heapLive
+ 2022-07-07 c177d9d98a crypto/x509: restrict CRL number to <=20 octets
+ 2022-07-07 486fc01770 crypto/x509: correctly parse CRL entry extensions
+ 2022-07-07 8ac58de185 crypto/x509: populate Number and AKI of parsed CRLs
+ 2022-07-07 0c7fcf6bd1 cmd/link: explicitly disable PIE for windows/amd64 -race mode
+ 2022-07-07 eaf2125654 cmd/go: default to "exe" build mode for windows -race
+ 2022-07-06 1243ec9c17 cmd/compile: only check implicit dots for method call enabled by a type bound
+ 2022-07-06 c391156f96 cmd/go: set up git identity for build_buildvcs_auto.txt

Change-Id: Ib2b544e080fc7fce20614d4ed310767c2591931f

22 months agocompress/gzip: fix stack exhaustion bug in Reader.Read
Tatiana Bradley [Fri, 6 May 2022 15:25:06 +0000 (11:25 -0400)]
compress/gzip: fix stack exhaustion bug in Reader.Read

Replace recursion with iteration in Reader.Read to avoid stack
exhaustion when there are a large number of files.

Fixes CVE-2022-30631
Fixes #53168

Change-Id: I47d8afe3f2d40b0213ab61431df9b221794dbfe0
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1455673
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/417067
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agopath/filepath: fix stack exhaustion in Glob
Julie Qiu [Thu, 23 Jun 2022 23:18:56 +0000 (23:18 +0000)]
path/filepath: fix stack exhaustion in Glob

A limit is added to the number of path separators allowed by an input to
Glob, to prevent stack exhaustion issues.

Thanks to Juho Nurminen of Mattermost who reported the issue.

Fixes CVE-2022-30632
Fixes #53416

Change-Id: I1b9fd4faa85411a05dbc91dceae1c0c8eb021f07
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1498176
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/417066
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>

22 months agoio/fs: fix stack exhaustion in Glob
Julie Qiu [Thu, 23 Jun 2022 23:17:53 +0000 (23:17 +0000)]
io/fs: fix stack exhaustion in Glob

A limit is added to the number of path separators allowed by an input to
Glob, to prevent stack exhaustion issues.

Thanks to Juho Nurminen of Mattermost who reported a similar issue in
path/filepath.

Fixes CVE-2022-30630
Fixes golang/go#53415

Change-Id: I5a9d02591fed90cd3d52627f5945f1301e53465d
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1497588
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/417065
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
22 months agoencoding/gob: add a depth limit for ignored fields
Roland Shoemaker [Tue, 7 Jun 2022 20:00:43 +0000 (13:00 -0700)]
encoding/gob: add a depth limit for ignored fields

Enforce a nesting limit of 10,000 for ignored fields during decoding
of messages. This prevents the possibility of triggering stack
exhaustion.

Fixes #53615
Fixes CVE-2022-30635

Change-Id: I05103d06dd5ca3945fcba3c1f5d3b5a645e8fb0f
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1484771
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/417064
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tatiana Bradley <tatiana@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>

22 months agogo/parser: limit recursion depth
Roland Shoemaker [Wed, 15 Jun 2022 17:43:05 +0000 (10:43 -0700)]
go/parser: limit recursion depth

Limit nested parsing to 100,000, which prevents stack exhaustion when
parsing deeply nested statements, types, and expressions. Also limit
the scope depth to 1,000 during object resolution.

Thanks to Juho Nurminen of Mattermost for reporting this issue.

Fixes #53616
Fixes CVE-2022-1962

Change-Id: I4d7b86c1d75d0bf3c7af1fdea91582aa74272c64
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1491025
Reviewed-by: Russ Cox <rsc@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/417063
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agoencoding/xml: use iterative Skip, rather than recursive
Roland Shoemaker [Tue, 29 Mar 2022 01:41:26 +0000 (18:41 -0700)]
encoding/xml: use iterative Skip, rather than recursive

Prevents exhausting the stack limit in _incredibly_ deeply nested
structures.

Fixes #53614
Fixes CVE-2022-28131

Change-Id: I47db4595ce10cecc29fbd06afce7b299868599e6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1419912
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/417062
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agoencoding/xml: limit depth of nesting in unmarshal
Roland Shoemaker [Tue, 29 Mar 2022 22:52:09 +0000 (15:52 -0700)]
encoding/xml: limit depth of nesting in unmarshal

Prevent exhausting the stack limit when unmarshalling extremely deeply
nested structures into nested types.

Fixes #53611
Fixes CVE-2022-30633

Change-Id: Ic6c5d41674c93cfc9a316135a408db9156d39c59
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1421319
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/417061
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agocmd/go: avoid spurious readdir during fsys.Walk
Russ Cox [Wed, 6 Jul 2022 17:21:34 +0000 (13:21 -0400)]
cmd/go: avoid spurious readdir during fsys.Walk

fsys.Walk is cloned from filepath.Walk, which has always handled
a walk of a directory by reading the full directory before calling the
callback on the directory itself. So if the callback returns fs.SkipDir,
those entries are thrown away, but the expense of reading them was
still incurred. (Worse, this is the expensive directory read that also
calls Stat on every entry.) On machines with slow file system I/O,
these reads are particularly annoying. For example, if I do

go list m...

there is a call to filepath.Walk that is told about $GOROOT/src/archive
and responds by returning filepath.SkipDir because archive does not
start with m, but it only gets the chance to do that after the archive
directory has been read. (Same for all the other top-level directories.)
Even something like go list github.com/foo/bar/... reads every top-level
$GOPATH/src directory.

When we designed filepath.WalkDir, one of the changes we made was
to allow calling the callback twice for a directory: once before reading it,
and then possibly again if the read produces an error (uncommon).
This CL changes fsys.Walk to use that same model. None of the callbacks
need changing, but now the $GOROOT/src/archive and other top-level
directories won't be read when evaluating a pattern like 'm...'.

For #53577.
Fixes #53765.

Change-Id: Idfa3b9e2cc335417bfd9d66dd584cb16f92bd12e
Reviewed-on: https://go-review.googlesource.com/c/go/+/416179
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agonet/http: clarify that MaxBytesReader returns *MaxBytesError
Damien Neil [Mon, 11 Jul 2022 16:49:14 +0000 (09:49 -0700)]
net/http: clarify that MaxBytesReader returns *MaxBytesError

A MaxBytesReader returns a *MaxBytesError when reading beyond
its limit, not a MaxBytesError.

Fixes #53764.

Change-Id: Icac3aeac96fd8b172f951241f8f111cda633752c
Reviewed-on: https://go-review.googlesource.com/c/go/+/416914
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agosyscall: gofmt after CL 412114
Tobias Klauser [Mon, 11 Jul 2022 17:10:00 +0000 (19:10 +0200)]
syscall: gofmt after CL 412114

Change-Id: Ie51545eaebd22a31379bf8814a2c62b91d1d105b
Reviewed-on: https://go-review.googlesource.com/c/go/+/416934
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
22 months agointernal/trace: don't report regions on system goroutines
Michael Pratt [Mon, 11 Jul 2022 19:34:26 +0000 (15:34 -0400)]
internal/trace: don't report regions on system goroutines

If a goroutine is started within a user region, internal/trace assigns
the child goroutine a nameless region for its entire lifetime which is
assosciated the same task as the parent's region.

This is not strictly necessary: a child goroutine is not necessarily
related to the task unless it performs some task operation (in which
case it will be associated with the task through the standard means).

However, it can be quite handy to see child goroutines within a region,
which may be child worker goroutines that you simply didn't perform task
operations on.

If the first GC occurs during a region, the GC worker goroutines will
also inherit a child region. We know for sure that these aren't related
to the task, so filter them out from the region list.

Note that we can't exclude system goroutines from setting activeRegions
in EvGoCreate handling, because we don't know the goroutine start
function name until the first EvGoStart.

Fixes #53784.

Change-Id: Ic83d84e23858a8400a76d1ae2f1418ef49951178
Reviewed-on: https://go-review.googlesource.com/c/go/+/416858
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>