]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
2 months ago[release-branch.go1.22] go1.22.1 go1.22.1
Gopher Robot [Tue, 5 Mar 2024 17:00:20 +0000 (17:00 +0000)]
[release-branch.go1.22] go1.22.1

Change-Id: I9db641e2a029c4c9fa72d7b423b2b6b7f113d9a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/569257
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2 months ago[release-branch.go1.22] net/textproto, mime/multipart: avoid unbounded read in MIME...
Damien Neil [Tue, 16 Jan 2024 23:37:52 +0000 (15:37 -0800)]
[release-branch.go1.22] net/textproto, mime/multipart: avoid unbounded read in MIME header

mime/multipart.Reader.ReadForm allows specifying the maximum amount
of memory that will be consumed by the form. While this limit is
correctly applied to the parsed form data structure, it was not
being applied to individual header lines in a form.

For example, when presented with a form containing a header line
that never ends, ReadForm will continue to read the line until it
runs out of memory.

Limit the amount of data consumed when reading a header.

Fixes CVE-2023-45290
Fixes #65850
For #65383

Change-Id: I7f9264d25752009e95f6b2c80e3d76aaf321d658
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/2134435
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/2174345
Reviewed-by: Carlos Amedee <amedee@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/569237
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

2 months ago[release-branch.go1.22] net/http, net/http/cookiejar: avoid subdomain matches on...
Damien Neil [Thu, 11 Jan 2024 19:31:57 +0000 (11:31 -0800)]
[release-branch.go1.22] net/http, net/http/cookiejar: avoid subdomain matches on IPv6 zones

When deciding whether to forward cookies or sensitive headers
across a redirect, do not attempt to interpret an IPv6 address
as a domain name.

Avoids a case where a maliciously-crafted redirect to an
IPv6 address with a scoped addressing zone could be
misinterpreted as a within-domain redirect. For example,
we could interpret "::1%.www.example.com" as a subdomain
of "www.example.com".

Thanks to Juho Nurminen of Mattermost for reporting this issue.

Fixes CVE-2023-45289
Fixes #65859
For #65065

Change-Id: I8f463f59f0e700c8a18733d2b264a8bcb3a19599
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/2131938
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/2174344
Reviewed-by: Carlos Amedee <amedee@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/569236
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

2 months ago[release-branch.go1.22] crypto/x509: make sure pub key is non-nil before interface...
Roland Shoemaker [Thu, 18 Jan 2024 20:51:13 +0000 (12:51 -0800)]
[release-branch.go1.22] crypto/x509: make sure pub key is non-nil before interface conversion

alreadyInChain assumes all keys fit a interface which contains the
Equal method (which they do), but this ignores that certificates may
have a nil key when PublicKeyAlgorithm is UnknownPublicKeyAlgorithm. In
this case alreadyInChain panics.

Check that the key is non-nil as part of considerCandidate (we are never
going to build a chain containing UnknownPublicKeyAlgorithm anyway).

For #65390
Fixes #65831
Fixes CVE-2024-24783

Change-Id: Ibdccc0a487e3368b6812be35daad2512220243f3
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/2137282
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/2174343
Reviewed-by: Carlos Amedee <amedee@google.com>
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/569235
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2 months ago[release-branch.go1.22] net/http: add missing call to decConnsPerHost
Julian Tibble [Wed, 14 Feb 2024 13:24:52 +0000 (13:24 +0000)]
[release-branch.go1.22] net/http: add missing call to decConnsPerHost

A recent change to Transport.dialConnFor introduced an early return that
skipped dialing. This path did not call decConnsPerHost, which can cause
subsequent HTTP calls to hang if Transport.MaxConnsPerHost is set.

For #65705
Fixes #65759

Change-Id: I157591114b02a3a66488d3ead7f1e6dbd374a41c
Reviewed-on: https://go-review.googlesource.com/c/go/+/564036
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
(cherry picked from commit 098a87fb1930b9ef99d394fe1bca75f1bd74ce8d)
Reviewed-on: https://go-review.googlesource.com/c/go/+/566536
Reviewed-by: Carlos Amedee <carlos@golang.org>
2 months ago[release-branch.go1.22] html/template: escape additional tokens in MarshalJSON errors
Roland Shoemaker [Thu, 15 Feb 2024 01:18:36 +0000 (17:18 -0800)]
[release-branch.go1.22] html/template: escape additional tokens in MarshalJSON errors

Escape "</script" and "<!--" in errors returned from MarshalJSON errors
when attempting to marshal types in script blocks. This prevents any
user controlled content from prematurely terminating the script block.

Updates #65697
Fixes #65969

Change-Id: Icf0e26c54ea7d9c1deed0bff11b6506c99ddef1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/564196
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
(cherry picked from commit ccbc725f2d678255df1bd326fa511a492aa3a0aa)
Reviewed-on: https://go-review.googlesource.com/c/go/+/567535
Reviewed-by: Carlos Amedee <carlos@golang.org>
2 months ago[release-branch.go1.22] net: work around runtime scheduler starvation on js and wasip1
Bryan C. Mills [Fri, 19 Jan 2024 21:51:24 +0000 (16:51 -0500)]
[release-branch.go1.22] net: work around runtime scheduler starvation on js and wasip1

For #65883.
Updates #65177.
Updates #65178.
Updates #64321.

Change-Id: I698fd3b688c7dfbde692eb7c29cbdafc89e7ca32
Cq-Include-Trybots: luci.golang.try:go1.22-js-wasm,go1.22-wasip1-wasm_wasmtime,go1.22-wasip1-wasm_wazero
Reviewed-on: https://go-review.googlesource.com/c/go/+/557037
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
(cherry picked from commit f19f31f2e7c136a8dae03cbfe4f8ebbb8b54569b)
Reviewed-on: https://go-review.googlesource.com/c/go/+/566175
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2 months ago[release-branch.go1.22] net/mail: properly handle special characters in phrase and...
Roland Shoemaker [Wed, 10 Jan 2024 19:02:14 +0000 (11:02 -0800)]
[release-branch.go1.22] net/mail: properly handle special characters in phrase and obs-phrase

Fixes a couple of misalignments with RFC 5322 which introduce
significant diffs between (mostly) conformant parsers.

This change reverts the changes made in CL50911, which allowed certain
special RFC 5322 characters to appear unquoted in the "phrase" syntax.
It is unclear why this change was made in the first place, and created
a divergence from comformant parsers. In particular this resulted in
treating comments in display names incorrectly.

Additionally properly handle trailing malformed comments in the group
syntax.

For #65083
Fixed #65849

Change-Id: I00dddc044c6ae3381154e43236632604c390f672
Reviewed-on: https://go-review.googlesource.com/c/go/+/555596
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/566215
Reviewed-by: Carlos Amedee <carlos@golang.org>
2 months ago[release-branch.go1.22] cmd/go/internal/modcmd: correctly filter out main modules...
Michael Matloob [Tue, 20 Feb 2024 21:13:33 +0000 (16:13 -0500)]
[release-branch.go1.22] cmd/go/internal/modcmd: correctly filter out main modules in verify

This change fixes a bug where we incorrectly filtered out the main
modules from the beginning of the build list before verifying them. We
made the assumption that the first MainModules.Len() entries of the
build list were the main modules, but now it can contain the go and
toolchain version entries, so removing the first MainModules.Len()
entries could leave main module names in the build list if any of
their names sorted after the string 'go'.

For #62663
Fixes #65852

Change-Id: I35ab6857a556f58d306303322afe24c48fc8b38f
Reviewed-on: https://go-review.googlesource.com/c/go/+/565378
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit 3f60da7944352d7f2d4a04830c0612457643016c)
Reviewed-on: https://go-review.googlesource.com/c/go/+/565775
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>

2 months ago[release-branch.go1.22] cmd/trace/v2,internal/trace: use correct frame for identifyin...
Nick Ripley [Wed, 7 Feb 2024 16:43:05 +0000 (11:43 -0500)]
[release-branch.go1.22] cmd/trace/v2,internal/trace: use correct frame for identifying goroutines

To determine the identity of a goroutine for displaying in the trace UI,
we should use the root frame from a call stack. This will be the
starting function for the goroutine and is the same for each call stack
from a given goroutine. The new tracer no longer includes starting PCs
for goroutines which existed at the start of tracing, so we can't use a
PC for grouping together goroutines any more. Instead, we just use the
name of the entry function for grouping.

For #65574
Fixes #65577

Change-Id: I5324653316f1acf0ab90c30680f181060ea45dd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/562455
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
(cherry picked from commit a51713103b5769a792b691e313254b7806855fa6)
Reviewed-on: https://go-review.googlesource.com/c/go/+/562558
Reviewed-by: Michael Pratt <mpratt@google.com>
2 months ago[release-branch.go1.22] go/types, types2: ensure that Alias.actual is set in NewAlias
Rob Findley [Fri, 2 Feb 2024 23:26:06 +0000 (18:26 -0500)]
[release-branch.go1.22] go/types, types2: ensure that Alias.actual is set in NewAlias

Types returned by the go/types API must be immutable (or at least
concurrency safe), but NewAlias returned an alias without actual set.

Ensure that actual is set by unaliasing. Also make some superficial
simplifications to unalias, and avoid indirection where unnecessary.

Fixes golang/go#65728

Change-Id: Ic9a020da5accf9032056a924b65c9e9e08cb2e0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/560915
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Robert Griesemer <gri@google.com>
(cherry picked from commit 10a65649a3b2e34ffe8e4202bfa3df851cea0fb4)
Reviewed-on: https://go-review.googlesource.com/c/go/+/564356

2 months ago[release-branch.go1.22] runtime/internal/atomic: correct GOARM=7 guard at a DMB instr...
Cherry Mui [Fri, 16 Feb 2024 15:58:56 +0000 (10:58 -0500)]
[release-branch.go1.22] runtime/internal/atomic: correct GOARM=7 guard at a DMB instruction

CL 525637 changed to the guard of DMB instruction from the
compiled-in runtime.goarm value to GOARM_7 macro and CPU feature
detection. It missed a place where runtime.goarm is loaded to a
register and reused later. This CL corrects the condition.

Updates #65601.
Fixes #65760.

Change-Id: I2ddefd03a1eb1048dbec0254c6e234c65b054279
Reviewed-on: https://go-review.googlesource.com/c/go/+/564855
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
(cherry picked from commit a0226c5680f3ce6b0d8a8341f8c69611f3008393)
Reviewed-on: https://go-review.googlesource.com/c/go/+/567555
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Bypass: Carlos Amedee <carlos@golang.org>

2 months ago[release-branch.go1.22] cmd/compile: make jump table symbol static
Cherry Mui [Tue, 20 Feb 2024 20:05:29 +0000 (15:05 -0500)]
[release-branch.go1.22] cmd/compile: make jump table symbol static

The jump table symbol is accessed only from the function symbol
(in the same package), so it can be static. Also, if the function
is DUPOK and it is, somehow, compiled differently in two different
packages, the linker must choose the jump table symbol associated
to the function symbol it chose. Currently the jump table symbol
is DUPOK, so that is not guaranteed. Making it static will
guarantee that, as each copy of the function symbol refers to its
own jump table symbol.

Updates #65783.
Fixes #65818.

Change-Id: I27e051d01ef585d07700b75d4dfac5768f16441e
Reviewed-on: https://go-review.googlesource.com/c/go/+/565535
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
(cherry picked from commit 290835298067014e906c540d64dcaa706d66b2ce)
Reviewed-on: https://go-review.googlesource.com/c/go/+/566475

3 months ago[release-branch.go1.22] cmd/compile: fail noder.LookupFunc gracefully if function...
Michael Pratt [Thu, 8 Feb 2024 18:07:33 +0000 (13:07 -0500)]
[release-branch.go1.22] cmd/compile: fail noder.LookupFunc gracefully if function generic

PGO uses noder.LookupFunc to look for devirtualization targets in
export data.  LookupFunc does not support type-parameterized
functions, and will currently fail the build when attempting to lookup
a type-parameterized function because objIdx is passed the wrong
number of type arguments.

This doesn't usually come up, as a PGO profile will report a generic
function with a symbol name like Func[.go.shape.foo]. In export data,
this is just Func, so when we do LookupFunc("Func[.go.shape.foo]")
lookup simply fails because the name doesn't exist.

However, if Func is not generic when the profile is collected, but the
source has since changed to make Func generic, then LookupFunc("Func")
will find the object successfully, only to fail the build because we
failed to provide type arguments.

Handle this with a objIdxMayFail, which allows graceful failure if the
object requires type arguments.

Bumping the language version to 1.21 in pgo_devirtualize_test.go is
required for type inference of the uses of mult.MultFn in
cmd/compile/internal/test/testdata/pgo/devirtualize/devirt_test.go.

For #65615.
Fixes #65618.

Change-Id: I84d9344840b851182f5321b8f7a29a591221b29f
Reviewed-on: https://go-review.googlesource.com/c/go/+/562737
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit 532c6f1c8d724975f578c8ec519f1f5b07d949da)
Reviewed-on: https://go-review.googlesource.com/c/go/+/563016

3 months ago[release-branch.go1.22] cmd/compile: accept -lang=go1 as -lang=go1.0
Matthew Dempsky [Thu, 8 Feb 2024 01:25:48 +0000 (17:25 -0800)]
[release-branch.go1.22] cmd/compile: accept -lang=go1 as -lang=go1.0

Fixes #65619.

Change-Id: I55fef8cf7be4654c7242462d45f12999e0c91c02
Reviewed-on: https://go-review.googlesource.com/c/go/+/562322
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
(cherry picked from commit 08370dcd9af8122956fc3ab024889c5357fffd5a)
Reviewed-on: https://go-review.googlesource.com/c/go/+/562815

3 months ago[release-branch.go1.22] runtime: don't call traceReadCPU on the system stack
Michael Pratt [Fri, 9 Feb 2024 18:49:21 +0000 (13:49 -0500)]
[release-branch.go1.22] runtime: don't call traceReadCPU on the system stack

traceReadCPU calls profBuf.read, which does a raceacquire. g0 does not
have a race context, so this crashes when running on the system stack.

We could borrow a race context, but it is simpler to just move
traceReadCPU off of the system stack.

For #65607.
Fixes #65644.

Change-Id: I335155b96d683aebb92b2f4e1eea063dd139f2d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/562996
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
(cherry picked from commit 9fa153b729969855fcb694e12c16e20b1407ed9c)
Reviewed-on: https://go-review.googlesource.com/c/go/+/562559

3 months ago[release-branch.go1.22] cmd/cgo/internal/testsanitizers: disable location checking...
Michael Anthony Knyszek [Thu, 8 Feb 2024 15:59:07 +0000 (15:59 +0000)]
[release-branch.go1.22] cmd/cgo/internal/testsanitizers: disable location checking for clang

Pending a resolution to #65606, this CL marks clang's ASAN runtime as
unable to symbolize stack traces to unblock the LUCI clang builder.

For #65606.
For #65469.
Fixes #65641.

Change-Id: I649773085aff30e5703e7f7ac2c72a0430a015c2
Cq-Include-Trybots: luci.golang.try:go1.22-linux-amd64-clang15
Reviewed-on: https://go-review.googlesource.com/c/go/+/562675
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit d94ab597af9b3f8e8ba371023314d80f6b3be5a5)
Reviewed-on: https://go-review.googlesource.com/c/go/+/563015

3 months ago[release-branch.go1.22] internal/testenv: support the LUCI mobile builders in tests
Michael Anthony Knyszek [Thu, 25 Jan 2024 17:23:15 +0000 (17:23 +0000)]
[release-branch.go1.22] internal/testenv: support the LUCI mobile builders in tests

This change updates the testenv tests to correctly match on future LUCI
builder names for mobile builders. This isn't a problem today because
those haven't been set up yet, but the builder names are structured and
it's clear where the modifiers will appear. Might as well set them up
now.

For #65473.
Fixes #65474.

Change-Id: I244b88a62a90312c0f3ff2360527d58531070362
Reviewed-on: https://go-review.googlesource.com/c/go/+/558597
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit 5c7c24ce827b10982245951f6c2b1bbf0abc5aae)
Reviewed-on: https://go-review.googlesource.com/c/go/+/560536

3 months ago[release-branch.go1.22] internal/testenv: allow "-noopt" anywhere in builder name...
Michael Anthony Knyszek [Thu, 25 Jan 2024 17:13:11 +0000 (17:13 +0000)]
[release-branch.go1.22] internal/testenv: allow "-noopt" anywhere in builder name in test

testenv's TestHasGoBuild test is supposed to allow noopt builders to not
have go build, but the pattern match is failing on the LUCI builders
where a test shard might have an additional "-test_only" suffix in the
builder name. Furthermore, in the LUCI world, "run mods" (the builder
type suffixes) are supposed to be well-defined and composable, so it
doesn't make sense to restrict "-noopt" to the builder suffix anyway.

This change modifies the test to allow "-noopt" to appear anywhere in
the builder name when checking if it's running on a noopt builder.

For #65470.
Fixes #65471.

Change-Id: I393818e3e8e452c7b0927cbc65726d552aa8ff8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/558596
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
(cherry picked from commit 93f0c0b25e7ea8ae7c2d5df32c6083cfabf2ffc2)
Reviewed-on: https://go-review.googlesource.com/c/go/+/560696

3 months ago[release-branch.go1.22] spec: fix typo in year (it's 2024 now)
Robert Griesemer [Wed, 7 Feb 2024 17:12:05 +0000 (09:12 -0800)]
[release-branch.go1.22] spec: fix typo in year (it's 2024 now)

While at it, set the date to the Go 1.22 release date.

Change-Id: I03872626e500433eb63786d24c67810c8c6289f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/562337
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/562320
Reviewed-by: Russ Cox <rsc@golang.org>
3 months ago[release-branch.go1.22] go1.22.0 go1.22.0
Gopher Robot [Tue, 6 Feb 2024 21:54:53 +0000 (21:54 +0000)]
[release-branch.go1.22] go1.22.0

Change-Id: If7b9fa19ee424d94e1c259e1867b89e8bda7fcde
Reviewed-on: https://go-review.googlesource.com/c/go/+/562276
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
3 months ago[release-branch.go1.22] cmd/go/internal/generate: call modload.InitWorkFile
Michael Matloob [Mon, 29 Jan 2024 16:14:05 +0000 (11:14 -0500)]
[release-branch.go1.22] cmd/go/internal/generate: call modload.InitWorkFile

This is necessary for go generate to enter workspace mode for
recognizing package paths in the workspace.

For #56098
Fixes #65352

Change-Id: I25f68de24f4189259353f63194823516e9d3d505
Reviewed-on: https://go-review.googlesource.com/c/go/+/559195
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
(cherry picked from commit b91bad78199aaf8baeb66cb8a30f51b89b8f90ee)
Reviewed-on: https://go-review.googlesource.com/c/go/+/559236

3 months ago[release-branch.go1.22] runtime: traceAcquire and traceRelease across all P steals
Michael Anthony Knyszek [Thu, 1 Feb 2024 05:32:03 +0000 (05:32 +0000)]
[release-branch.go1.22] runtime: traceAcquire and traceRelease across all P steals

Currently there are a few places where a P can get stolen where the
runtime doesn't traceAcquire and traceRelease across the steal itself.
What can happen then is the following scenario:
- Thread 1 enters a syscall and writes an event about it.
- Thread 2 steals Thread 1's P.
- Thread 1 exits the syscall and writes one or more events about it.
- Tracing ends (trace.gen is set to 0).
- Thread 2 checks to see if it should write an event for the P it just
  stole, sees that tracing is disabled, and doesn't.

This results in broken traces, because there's a missing ProcSteal
event. The parser always waits for a ProcSteal to advance a
GoSyscallEndBlocked event, and in this case, it never comes.

Fixes #65181.

Change-Id: I437629499bb7669bf7fe2fc6fc4f64c53002916b
Reviewed-on: https://go-review.googlesource.com/c/go/+/560235
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit c9d88ea2aa628cae224335c49f256e13adfce337)
Reviewed-on: https://go-review.googlesource.com/c/go/+/559958
Auto-Submit: Michael Knyszek <mknyszek@google.com>

3 months ago[release-branch.go1.22] runtime: clear trace map without write barriers
Michael Anthony Knyszek [Thu, 1 Feb 2024 05:10:32 +0000 (05:10 +0000)]
[release-branch.go1.22] runtime: clear trace map without write barriers

Currently the trace map is cleared with an assignment, but this ends up
invoking write barriers. Theoretically, write barriers could try to
write a trace event and eventually try to acquire the same lock. The
static lock ranking expresses this constraint.

This change replaces the assignment with a call to memclrNoHeapPointer
to clear the map, removing the write barriers.

Note that technically this problem is purely theoretical. The way the
trace maps are used today is such that reset is only ever called when
the tracer is no longer writing events that could emit data into a map.
Furthermore, reset is never called from an event-writing context.

Therefore another way to resolve this is to simply not hold the trace
map lock over the reset operation. However, this makes the trace map
implementation less robust because it needs to be used in a very
specific way. Furthermore, the rest of the trace map code avoids write
barriers already since its internal structures are all notinheap, so
it's actually more consistent to just avoid write barriers in the reset
method.

Fixes #56554.

Change-Id: Icd86472e75e25161b2c10c1c8aaae2c2fed4f67f
Reviewed-on: https://go-review.googlesource.com/c/go/+/560216
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit 829f2ce3ba33a09a7975139a0a33d462bb3114db)
Reviewed-on: https://go-review.googlesource.com/c/go/+/559957
Auto-Submit: Michael Knyszek <mknyszek@google.com>

3 months ago[release-branch.go1.22] runtime: fix trace EvGoStop Gosched reason to match function
Michael Anthony Knyszek [Thu, 21 Dec 2023 20:26:38 +0000 (20:26 +0000)]
[release-branch.go1.22] runtime: fix trace EvGoStop Gosched reason to match function

Currently the stop reason for runtime.Gosched is labeled
"runtime.GoSched" which doesn't actually match the function name. Fix
the label to match the function name.

This change doesn't regenerate the internal/trace/v2 tests, because
regenerating the tests breaks summarization tests in internal/trace that
rely on very specific details in the example traces that aren't
guaranteed. Also, go122-gc-trace.test isn't generated at all, as it
turns out. I'll fix this all up in a follow-up CL. For now, just replace
runtime.GoSched with runtime.Gosched in the traces so we don't have a
problem later if a test wants to look for that string.

This change does regenerate the cmd/trace/v2 test, but it turns out the
cmd/trace/v2 tests are way too strict about network unblock events, and
3 usually pop up instead of 1 or 2, which is what the test expects.
AFAICT this looks plausible to me, so just lift the restriction on
"up to 2" events entirely.

Change-Id: Id7350132be19119c743c259f2f5250903bf41a04
Reviewed-on: https://go-review.googlesource.com/c/go/+/552275
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
(cherry picked from commit 287f791845ac0311012814f4419d5e043c212d17)
Reviewed-on: https://go-review.googlesource.com/c/go/+/560555
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

3 months ago[release-branch.go1.22] runtime: model wakeableSleep.lock in the race detector
Michael Anthony Knyszek [Thu, 1 Feb 2024 04:47:22 +0000 (04:47 +0000)]
[release-branch.go1.22] runtime: model wakeableSleep.lock in the race detector

Currently the flight recorder tests are failing in race mode because the
race detector doesn't see s.lock, leading to false positives. This has
also appeared in the trace tests. Model the lock in the race detector.

Fixes #65207.
Fixes #65283.

Change-Id: I1e9a5c9606536f55fdfc46b5f8443e9c7213c23d
Reviewed-on: https://go-review.googlesource.com/c/go/+/560215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
(cherry picked from commit 0b12e3d81cdba8a5676d6d61970d3dc5cb1462ac)
Reviewed-on: https://go-review.googlesource.com/c/go/+/559956
Auto-Submit: Michael Knyszek <mknyszek@google.com>

3 months ago[release-branch.go1.22] go/version: fix package to accept go1.21.0-bigcorp
Russ Cox [Wed, 24 Jan 2024 21:29:20 +0000 (16:29 -0500)]
[release-branch.go1.22] go/version: fix package to accept go1.21.0-bigcorp

The proposal discussion made clear that suffixes should be accepted,
so that people who use custom VERSION files can still pass runtime.Version()
to this code. But we forgot to do that in the CL. Do that.

Note that cmd/go also strips space- and tab-prefixed suffixes,
but go.dev/doc/toolchain only mentions dash, so this code only
strips dash.

Fixes #65061.

Change-Id: I6a427b78f964eb41c024890dae30223beaef13eb
Cq-Include-Trybots: luci.golang.try:go1.22-linux-amd64-longtest,go1.22-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/559796
TryBot-Bypass: Russ Cox <rsc@golang.org>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/559802
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 months ago[release-branch.go1.22] spec: clarify iteration variable type for range over integer
Robert Griesemer [Mon, 22 Jan 2024 23:46:01 +0000 (15:46 -0800)]
[release-branch.go1.22] spec: clarify iteration variable type for range over integer

Also: report language version (plus date) in spec header.

For #65137.

Change-Id: I4f1d220d5922c40a36264df2d0a7bb7cd0756bac
Reviewed-on: https://go-review.googlesource.com/c/go/+/557596
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/559875

3 months ago[release-branch.go1.22] cmd/go/internal/toolchain: apply the -modcacherw flag when...
Bryan C. Mills [Thu, 11 Jan 2024 20:00:17 +0000 (15:00 -0500)]
[release-branch.go1.22] cmd/go/internal/toolchain: apply the -modcacherw flag when downloading a module to determine what toolchain it needs

Fixes #64282.

Change-Id: I3f211c599ee70cb58254d0bc07eeb3c135124e58
Reviewed-on: https://go-review.googlesource.com/c/go/+/555436
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
(cherry picked from commit cc38c68ae09fa591697a4239a7dedd2efe386995)
Reviewed-on: https://go-review.googlesource.com/c/go/+/559218
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 months ago[release-branch.go1.22] Revert "crypto/internal/boring: upgrade module to fips-202206...
Filippo Valsorda [Fri, 26 Jan 2024 22:22:45 +0000 (23:22 +0100)]
[release-branch.go1.22] Revert "crypto/internal/boring: upgrade module to fips-20220613" +1

This reverts commit 7383b2a4db5dc93c9b875b42d5add73d27cc4b9f
("crypto/internal/boring: upgrade module to fips-20220613") and commit
4106de901a8efe914cda6f6c4e8d45ff8c115da4 ("crypto/tls: align FIPS-only
mode with BoringSSL policy").

Fixes #65324
Updates #65321
Updates #64717
Updates #62372

Change-Id: I0938b97e5b4904e6532448b8ae76e920d03d0508
Reviewed-on: https://go-review.googlesource.com/c/go/+/558796
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit 09b5de48e64e67db92b31eaca054c5d096e3c057)
Reviewed-on: https://go-review.googlesource.com/c/go/+/558797
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
3 months ago[release-branch.go1.22] Revert "archive/tar: add FileInfoNames interface"
Cherry Mui [Wed, 24 Jan 2024 20:00:47 +0000 (15:00 -0500)]
[release-branch.go1.22] Revert "archive/tar: add FileInfoNames interface"

This reverts CL 514235. Also reverts CL 518056 which is a followup
fix.

Reason for revert: Proposal #50102 defined an interface that is
too specific to UNIX-y systems and also didn't make much sense.
The proposal is un-accepted, and we'll revisit in Go 1.23.

Fixes #65245.
Updates #50102.

Change-Id: I41ba0ee286c1d893e6564a337e5d76418d19435d
Reviewed-on: https://go-review.googlesource.com/c/go/+/558295
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
(cherry picked from commit 5000b5168037d26a796da46a07088e834c3af1a0)
Reviewed-on: https://go-review.googlesource.com/c/go/+/558296

3 months ago[release-branch.go1.22] go1.22rc2 go1.22rc2
Gopher Robot [Wed, 24 Jan 2024 16:04:39 +0000 (16:04 +0000)]
[release-branch.go1.22] go1.22rc2

Change-Id: Iac7129fa56d739ead8bac461e178b0e23104bcc5
Reviewed-on: https://go-review.googlesource.com/c/go/+/558235
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 months ago[release-branch.go1.22] cmd/trace/v2: emit user log annotations in all views
Michael Anthony Knyszek [Fri, 19 Jan 2024 19:25:04 +0000 (19:25 +0000)]
[release-branch.go1.22] cmd/trace/v2: emit user log annotations in all views

This was an oversight in porting over cmd/trace to the new trace format
and API.

Fixes #65153.

Change-Id: I883d302f95956fcc9abb60aa53165acb6d099d67
Reviewed-on: https://go-review.googlesource.com/c/go/+/557175
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
(cherry picked from commit 7cb98c1da1d38447a272c50b2a33634ebb845aa4)
Reviewed-on: https://go-review.googlesource.com/c/go/+/557817
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

3 months ago[release-branch.go1.22] runtime: make a much better effort to emit CPU profile in...
Michael Anthony Knyszek [Thu, 11 Jan 2024 21:55:04 +0000 (21:55 +0000)]
[release-branch.go1.22] runtime: make a much better effort to emit CPU profile in a trace

Currently the new execution tracer's handling of CPU profile samples is
very best-effort. The same CPU profile buffer is used across
generations, leading to a high probability that CPU samples will bleed
across generations. Also, because the CPU profile buffer (not the trace
buffer the samples get written into) isn't guaranteed to be flushed when
we close out a generation, nor when tracing stops. This has led to test
failures, but can more generally just lead to lost samples.

In general, lost samples are considered OK. The CPU profile buffer is
only read from every 100 ms, so if it fills up too much before then, old
samples will get overwritten. The tests already account for this, and in
that sense the CPU profile samples are already best-effort. But with
actual CPU profiles, this is really the only condition under which
samples are dropped.

This CL aims to align CPU profiles better with traces by eliminating
all best-effort parts of the implementation aside from the possibility
of dropped samples from a full buffer.

To achieve this, this CL adds a second CPU profile buffer and has the
SIGPROF handler pick which CPU profile buffer to use based on the
generation, much like every other part of the tracer. The SIGPROF
handler then reads the trace generation, but not before ensuring it
can't change: it grabs its own thread's trace seqlock. It's possible
that a SIGPROF signal lands while this seqlock is already held by the
thread. Luckily this is detectable and the SIGPROF handler can simply
elide the locking if this happens (the tracer will already wait until
all threads exit their seqlock critical section).

Now that there are two CPU profile buffers written to, the read side
needs to change. Instead of calling traceAcquire/traceRelease for every
single CPU sample event, the trace CPU profile reader goroutine holds
this conceptual lock over the entirety of flushing a buffer. This means
it can pick the CPU profile buffer for the current generation to flush.

With all this machinery in place, we're now at a point where all CPU
profile samples get divided into either the previous generation or the
current generation. This is good, since it means that we're able to
emit profile samples into the correct generation, avoiding surprises in
the final trace. All that's missing is to flush the CPU profile buffer
from the previous generation, once the runtime has moved on from that
generation. That is, when the generation counter updates, there may yet
be CPU profile samples sitting in the last generation's buffer. So,
traceCPUFlush now first flushes the CPU profile buffer, followed by any
trace buffers containing CPU profile samples.

The end result of all this is that no sample gets left behind unless it
gets overwritten in the CPU profile buffer in the first place. CPU
profile samples in the trace will now also get attributed to the right
generation, since the SIGPROF handler now participates in the tracer's
synchronization across trace generations.

Fixes #55317.

Change-Id: I47719fad164c544eef0bb12f99c8f3c15358e344
Reviewed-on: https://go-review.googlesource.com/c/go/+/555495
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
(cherry picked from commit f5e475edafd4186c51aadf2e7fdf164eb365379f)
Reviewed-on: https://go-review.googlesource.com/c/go/+/557838
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 months ago[release-branch.go1.22] cmd/cgo/internal/test: skip TestCallbackCallersSEH when inter...
qmuntal [Thu, 18 Jan 2024 06:53:50 +0000 (07:53 +0100)]
[release-branch.go1.22] cmd/cgo/internal/test: skip TestCallbackCallersSEH when internal linking

TestCallbackCallersSEH is flaky when using the internal linker. Skip
it for now until the flakiness is resolved.

Updates #65116

Change-Id: I7628b07eaff8be00757d5604722f30aede25fce5
Reviewed-on: https://go-review.googlesource.com/c/go/+/556635
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit adead1a93f472affa97c494ef19f2f492ee6f34a)
Reviewed-on: https://go-review.googlesource.com/c/go/+/557815

3 months ago[release-branch.go1.22] runtime: use the correct M ID for syscalling goroutines in...
Michael Anthony Knyszek [Mon, 22 Jan 2024 16:34:41 +0000 (16:34 +0000)]
[release-branch.go1.22] runtime: use the correct M ID for syscalling goroutines in traces

Earlier in the development of the new tracer, m.id was used as a the
canonical ID for threads. Later, we switched to m.procid because it
matches the underlying OS resource. However, in that switch, we missed a
spot.

The tracer catches and emits statuses for goroutines that have remained
in either waiting or syscall across a whole generation, and emits a
thread ID for the latter set. The ID being used here, however, was m.id
instead of m.procid, like the rest of the tracer.

This CL also adds a regression test. In order to make the regression
test actually catch the failure, we also have to make the parser a
little less lenient about GoStatus events with GoSyscall: if this isn't
the first generation, then we should've seen the goroutine bound to an
M already when its status is getting emitted for its context. If we emit
the wrong ID, then we'll catch the issue when we emit the right ID when
the goroutine exits the syscall.

Fixes #65196.

Change-Id: I78b64fbea65308de5e1291c478a082a732a8bf9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/557456
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit c46966653f6144e20f8b9bccb96e7a7f1d32aeb9)
Reviewed-on: https://go-review.googlesource.com/c/go/+/557436

3 months ago[release-branch.go1.22] doc: delete go1.22.html copy
Dmitri Shuralyov [Fri, 19 Jan 2024 20:48:16 +0000 (15:48 -0500)]
[release-branch.go1.22] doc: delete go1.22.html copy

The motivation is the same as in the commit message of CL 511317.

For #61422.

Change-Id: I0e86cf35ec3501a931d6d7fffb0c83f3e57106e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/557515
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 months ago[release-branch.go1.22] doc: remove last TODO item
Carlos Amedee [Mon, 22 Jan 2024 16:30:51 +0000 (11:30 -0500)]
[release-branch.go1.22] doc: remove last TODO item

For #61422

Change-Id: I50e427b78a533c3196aeb5291a34c05528ee0bed
Reviewed-on: https://go-review.googlesource.com/c/go/+/557475
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 months ago[release-branch.go1.22] all: merge master into release-branch.go1.22
Carlos Amedee [Fri, 19 Jan 2024 19:26:02 +0000 (14:26 -0500)]
[release-branch.go1.22] all: merge master into release-branch.go1.22

Change-Id: Icc6bf5dba9eae08fa3e4b63414f409727efb5197

3 months agocmd/go/internal/modfetch: set protocol.version=2 for shallow git fetches
Bryan C. Mills [Wed, 17 Jan 2024 20:00:40 +0000 (15:00 -0500)]
cmd/go/internal/modfetch: set protocol.version=2 for shallow git fetches

This works around an apparent bug in the Git HTTP backend, introduced
in Git 2.21, that causes responses for the version 1 protocol to
provide incomplete tags.

For Git commands older than 2.18, this configuration flag is ignored.
(Note that Git 2.29 and above already use protocol version 2 by
default.)

Fixes #56881.

Change-Id: I9b241cfb604e5f633ca6a5d799df6706246684a7
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/556358
Run-TryBot: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
3 months agogo/types, types2: fix range clause checks for constant range expressions
Robert Griesemer [Wed, 17 Jan 2024 19:04:11 +0000 (11:04 -0800)]
go/types, types2: fix range clause checks for constant range expressions

Add missing checks for the case where the range expression is
a (possibly untyped) constant integer expression.

Add context parameter to assignVar for better error message
where the expression is part of a range clause.

Also, rename s/expr/Expr/ where it denotes an AST expression,
for clarity.

Fixes #65133.
For #65137.

Change-Id: I72962d76741abe79f613e251f7b060e99261d3ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/556398
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
3 months agodoc/go1.22: document net/netip changes
Damien Neil [Wed, 17 Jan 2024 19:59:10 +0000 (11:59 -0800)]
doc/go1.22: document net/netip changes

For #61422

Change-Id: Ide818366b035eada4ba04b70b4741fb1891585d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/556396
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
3 months agodoc/go1.22: document net/http/cgi changes
Damien Neil [Wed, 17 Jan 2024 19:03:15 +0000 (11:03 -0800)]
doc/go1.22: document net/http/cgi changes

For #61422

Change-Id: If9c3d3ccbfb2061f42ffc26461209c96d38020e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/556395
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
3 months agoruntime: document GODEBUG panicnil values
Cuong Manh Le [Mon, 23 Oct 2023 03:56:57 +0000 (10:56 +0700)]
runtime: document GODEBUG panicnil values

Updates #25448

Change-Id: Ia1b7a376f5175f67e14ad4bd065d6e8ad5250d38
Reviewed-on: https://go-review.googlesource.com/c/go/+/536955
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>

3 months agoruntime: skip test if strace crashes
Austin Clements [Wed, 17 Jan 2024 19:24:06 +0000 (14:24 -0500)]
runtime: skip test if strace crashes

Very occasionally, at least on linux/386, strace itself will crash in
TestUsingVDSO. Detect these crashes and just skip the test.

Fixes #63734.

Change-Id: I050494459d47dd96c0b8dc0b16353cb532fba93e
Reviewed-on: https://go-review.googlesource.com/c/go/+/556357
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 months agoruntime: mark TestGdbCoreCrashThreadBacktrace as flaky
Michael Pratt [Wed, 17 Jan 2024 18:44:44 +0000 (13:44 -0500)]
runtime: mark TestGdbCoreCrashThreadBacktrace as flaky

This test exercises the SIGQUIT crash loop and managed to trigger the
race from #65138 at least once.

For #65138.
Fixes #64752.

Change-Id: I11091510aa7ae4f58b1d748e53df2e3e3dbfb323
Reviewed-on: https://go-review.googlesource.com/c/go/+/556356
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 months agocmp: add test case for uinitptr
lxl-renren [Fri, 12 Jan 2024 15:09:17 +0000 (15:09 +0000)]
cmp: add test case for uinitptr

Change-Id: Iebe79be01eb5208e9b9dea9297c464fe2b2dd3dd
GitHub-Last-Rev: 875ab08627b1fb0db3dc2a14ac332fdbc9af8b4b
GitHub-Pull-Request: golang/go#65017
Reviewed-on: https://go-review.googlesource.com/c/go/+/554595
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agocmd/compile: call types2.Unalias to be ready for GODEBUG=gotypesalias=1
Robert Griesemer [Wed, 17 Jan 2024 00:59:31 +0000 (16:59 -0800)]
cmd/compile: call types2.Unalias to be ready for GODEBUG=gotypesalias=1

types2.Unalias is not needed if we know we have a core or underlying
type. Also, types of declared functions (signatures) cannot be aliases
(this includes tuples).

Fixes #65125.

Change-Id: I1faa26b66f6c646719e830dd661136fae86f3775
Reviewed-on: https://go-review.googlesource.com/c/go/+/556036
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 months agodoc: fill out net/http.Request.PathValue,SetPathValue section
Dan Peterson [Thu, 21 Dec 2023 17:58:00 +0000 (13:58 -0400)]
doc: fill out net/http.Request.PathValue,SetPathValue section

And add a missing code tag wrap elsewhere.

Updates #61410
Updates #61422

Change-Id: I70a9c4ecaf4056af2e88d777b8db892a45dfcb9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/552195
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dan Peterson <danp@danp.net>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

4 months agoio/fs: godoc links to testing/fstest
Olivier Mengué [Mon, 9 Oct 2023 20:36:01 +0000 (22:36 +0200)]
io/fs: godoc links to testing/fstest

Add godoc links from io/fs to testing/fstest for discoverability.

Change-Id: I6550b4b703d2214faa732987ec8630ac903705b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/534095
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
4 months agoruntime: more godoc links
Olivier Mengué [Thu, 9 Nov 2023 21:04:38 +0000 (22:04 +0100)]
runtime: more godoc links

Change-Id: I8fe66326994894b17ce0eda991bba942844d26b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/541475
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agointernal/trace/v2: reject events for goroutines with unknown states
Dominik Honnef [Fri, 12 Jan 2024 19:46:14 +0000 (20:46 +0100)]
internal/trace/v2: reject events for goroutines with unknown states

Change-Id: Ifc472ed4cf0433d06f43559930ac80df23656a6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/555496
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
4 months agointernal/trace/v2: avoid several panics for malformed traces
Dominik Honnef [Wed, 27 Dec 2023 21:01:19 +0000 (22:01 +0100)]
internal/trace/v2: avoid several panics for malformed traces

This addresses some panics (out of bounds slice accesses and nil pointer
dereferences) when parsing malformed data. These were found via light
fuzzing, not by any rigorous means, and more potential panics probably
exist.

Fixes #64878.
Fixes #64879.

Change-Id: I4085788ba7dc91fec62e4abd88f50777577db42f
Reviewed-on: https://go-review.googlesource.com/c/go/+/552995
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
4 months agocrypto/rsa,crypto/internal/bigmod: improve verify/encrypt performance
Filippo Valsorda [Wed, 27 Dec 2023 15:05:19 +0000 (16:05 +0100)]
crypto/rsa,crypto/internal/bigmod: improve verify/encrypt performance

Most libraries don't consider N secret, but it's arguably useful for
privacy applications. However, E should generally be fixed, and there is
a lot of performance to be gained by using variable-time exponentiation.

The threshold trick is from BoringSSL.

goos: linux
goarch: amd64
pkg: crypto/rsa
cpu: Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz
                       │     old      │                 new                 │
                       │    sec/op    │   sec/op     vs base                │
DecryptPKCS1v15/2048-4    1.398m ± 0%   1.396m ± 4%        ~ (p=0.853 n=10)
DecryptPKCS1v15/3072-4    3.640m ± 0%   3.652m ± 1%        ~ (p=0.063 n=10)
DecryptPKCS1v15/4096-4    7.756m ± 0%   7.764m ± 0%        ~ (p=0.853 n=10)
EncryptPKCS1v15/2048-4   175.50µ ± 0%   39.37µ ± 0%  -77.57% (p=0.000 n=10)
DecryptOAEP/2048-4        1.375m ± 0%   1.371m ± 1%        ~ (p=0.089 n=10)
EncryptOAEP/2048-4       177.64µ ± 0%   41.17µ ± 1%  -76.82% (p=0.000 n=10)
SignPKCS1v15/2048-4       1.419m ± 0%   1.393m ± 1%   -1.84% (p=0.000 n=10)
VerifyPKCS1v15/2048-4    173.70µ ± 1%   38.28µ ± 2%  -77.96% (p=0.000 n=10)
SignPSS/2048-4            1.437m ± 1%   1.413m ± 0%   -1.64% (p=0.000 n=10)
VerifyPSS/2048-4         176.83µ ± 1%   43.08µ ± 5%  -75.64% (p=0.000 n=10)

This finally makes everything in crypto/rsa faster than it was in Go 1.19.

goos: linux
goarch: amd64
pkg: crypto/rsa
cpu: Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz
                       │ go1.19.txt  │              go1.20.txt               │              go1.21.txt               │               new.txt               │
                       │   sec/op    │    sec/op     vs base                 │    sec/op     vs base                 │   sec/op     vs base                │
DecryptPKCS1v15/2048-4   1.458m ± 0%    1.597m ± 1%    +9.50% (p=0.000 n=10)    1.395m ± 1%    -4.30% (p=0.000 n=10)   1.396m ± 4%   -4.25% (p=0.002 n=10)
DecryptPKCS1v15/3072-4   4.023m ± 1%    5.332m ± 1%   +32.53% (p=0.000 n=10)    3.649m ± 1%    -9.30% (p=0.000 n=10)   3.652m ± 1%   -9.23% (p=0.000 n=10)
DecryptPKCS1v15/4096-4   8.710m ± 1%   11.937m ± 1%   +37.05% (p=0.000 n=10)    7.564m ± 1%   -13.16% (p=0.000 n=10)   7.764m ± 0%  -10.86% (p=0.000 n=10)
EncryptPKCS1v15/2048-4   51.79µ ± 0%   267.68µ ± 0%  +416.90% (p=0.000 n=10)   176.42µ ± 0%  +240.67% (p=0.000 n=10)   39.37µ ± 0%  -23.98% (p=0.000 n=10)
DecryptOAEP/2048-4       1.461m ± 0%    1.613m ± 1%   +10.37% (p=0.000 n=10)    1.415m ± 0%    -3.13% (p=0.000 n=10)   1.371m ± 1%   -6.18% (p=0.000 n=10)
EncryptOAEP/2048-4       54.24µ ± 0%   269.19µ ± 0%  +396.28% (p=0.000 n=10)   177.31µ ± 0%  +226.89% (p=0.000 n=10)   41.17µ ± 1%  -24.10% (p=0.000 n=10)
SignPKCS1v15/2048-4      1.510m ± 0%    1.705m ± 0%   +12.93% (p=0.000 n=10)    1.423m ± 1%    -5.78% (p=0.000 n=10)   1.393m ± 1%   -7.76% (p=0.000 n=10)
VerifyPKCS1v15/2048-4    50.87µ ± 0%   266.41µ ± 1%  +423.71% (p=0.000 n=10)   174.38µ ± 0%  +242.79% (p=0.000 n=10)   38.28µ ± 2%  -24.75% (p=0.000 n=10)
SignPSS/2048-4           1.513m ± 1%    1.709m ± 0%   +12.97% (p=0.000 n=10)    1.461m ± 0%    -3.42% (p=0.000 n=10)   1.413m ± 0%   -6.58% (p=0.000 n=10)
VerifyPSS/2048-4         53.45µ ± 1%   268.56µ ± 0%  +402.48% (p=0.000 n=10)   177.29µ ± 0%  +231.72% (p=0.000 n=10)   43.08µ ± 5%  -19.39% (p=0.000 n=10)
geomean                  514.6µ         1.094m       +112.65%                   801.6µ        +55.77%                  442.1µ       -14.08%

Fixes #63516

Change-Id: If40e596a2e4b3ab7a202ff34591cf9cffecfcc1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/552935
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
4 months agocrypto/rsa: use E = 65537 in benchmarks
Filippo Valsorda [Tue, 26 Dec 2023 22:21:34 +0000 (23:21 +0100)]
crypto/rsa: use E = 65537 in benchmarks

Now, this is embarrassing. For the whole Go 1.20 and Go 1.21 cycles, we
based RSA public key operation (verification and decryption) benchmarks
on the keys in rsa_test.go, which had E = 3. Most keys in use, including
all those generated by GenerateKey, have E = 65537. This significantly
skewed even relative benchmarks, because the new constant-time
algorithms would incur a larger slowdown for larger exponents.

I noticed this only because I got a production profile for an
application that does a lot of RSA verifications, saw ExpShort show up,
made ExpShort faster, and the crypto/rsa profiles didn't move.

We were measuring the wrong thing, and the slowdown was worse than we
thought. My apologies.

(If E had not been parametrized, it would have avoided issues like this
one, too. Grumble. https://words.filippo.io/parameters/#fn9)

goos: darwin
goarch: arm64
pkg: crypto/rsa
                       │ g35222eeb78 │                 new                 │
                       │   sec/op    │   sec/op     vs base                │
DecryptPKCS1v15/2048-8   1.414m ± 2%   1.417m ± 1%        ~ (p=0.971 n=10)
DecryptPKCS1v15/3072-8   4.107m ± 0%   4.160m ± 1%   +1.29% (p=0.000 n=10)
DecryptPKCS1v15/4096-8   9.363m ± 1%   9.305m ± 1%        ~ (p=0.143 n=10)
EncryptPKCS1v15/2048-8   162.8µ ± 2%   212.1µ ± 0%  +30.34% (p=0.000 n=10)
DecryptOAEP/2048-8       1.460m ± 4%   1.413m ± 1%        ~ (p=0.105 n=10)
EncryptOAEP/2048-8       161.7µ ± 0%   213.4µ ± 0%  +31.99% (p=0.000 n=10)
SignPKCS1v15/2048-8      1.419m ± 1%   1.476m ± 1%   +4.05% (p=0.000 n=10)
VerifyPKCS1v15/2048-8    160.6µ ± 0%   212.6µ ± 3%  +32.38% (p=0.000 n=10)
SignPSS/2048-8           1.419m ± 0%   1.477m ± 2%   +4.07% (p=0.000 n=10)
VerifyPSS/2048-8         163.9µ ± 8%   212.3µ ± 0%  +29.50% (p=0.000 n=10)
geomean                  802.5µ        899.1µ       +12.04%

Updates #63516

Change-Id: Iab4a0684d8101ae07dac8462908d8058fe5e9f3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/552895
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
4 months agoruntime: ensure we free unrolled GC bitmaps
Keith Randall [Thu, 11 Jan 2024 20:52:16 +0000 (12:52 -0800)]
runtime: ensure we free unrolled GC bitmaps

CL 555355 has a bug in it - the GC program flag was also used to decide
when to free the unrolled bitmap. After that CL, we just don't free any
unrolled bitmaps, leading to a memory leak.

Use a separate flag to track types that need to be freed when their
corresponding object is freed.

Change-Id: I841b65492561f5b5e1853875fbd8e8a872205a84
Reviewed-on: https://go-review.googlesource.com/c/go/+/555416
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agogo/types, types2: don't lose position info of interface embeddings
Robert Griesemer [Wed, 10 Jan 2024 23:49:33 +0000 (15:49 -0800)]
go/types, types2: don't lose position info of interface embeddings

Accurate position information for embedded types in interfaces is
crucial to identify the corresponding source file, and with that
the Go language version associated with that file. (The position
information is also important for proper error messages.)

Before this CL, the position information for embedded types was
discarded after type set computation, in the assumption that it
was not needed anymore. However, substitutions that update the
interface may lead to repeated type set computations which then
won't have the correct position information.

This CL does preserve the position information for embedded
types until the end of type checking (cleanup phase), and also
copy the position information during a substitution of the
interface.

The respective bug (#64759) doesn't seem to appear in 1.22 (most
likely because it's hidden by some of the changes made with respect
to the file version logic), but the existing code is still wrong.
The backport of this code to 1.21 and 1.20 fixes the issue in those
releases.

For #64759.

Change-Id: I80f4004c9d79cb02eac6739c324c477706615102
Reviewed-on: https://go-review.googlesource.com/c/go/+/555296
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
4 months agocmd/compile: document go:wasmimport directive
Mauri de Souza Meneguzzo [Wed, 10 Jan 2024 21:15:55 +0000 (21:15 +0000)]
cmd/compile: document go:wasmimport directive

Fixes #64972

Change-Id: I784a8728afbdef9736681d56f0a79c82a00609d6
GitHub-Last-Rev: bf158dbeaaa495dc258c590c7a21cf9e25e76ee7
GitHub-Pull-Request: golang/go#64991
Reviewed-on: https://go-review.googlesource.com/c/go/+/554455
Reviewed-by: Achille Roussel <achille.roussel@gmail.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

4 months agoruntime: don't mark unrolled bitmap type as having a gc program
Keith Randall [Thu, 11 Jan 2024 06:59:37 +0000 (22:59 -0800)]
runtime: don't mark unrolled bitmap type as having a gc program

It doesn't have a GC program - the whole point is that it is
the unrolled version of a GC program.

Fortunately, this isn't a bug as (*mspan).typePointersOfUnchecked
ignores the GCProg flag and just uses GCData as a bitmap unconditionally.

Change-Id: I2508af85af4a1806946e54c893120c5cc0cc3da3
Reviewed-on: https://go-review.googlesource.com/c/go/+/555355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
4 months agoos: relax tests and add examples for UserCacheDir and UserConfigDir
Bryan C. Mills [Mon, 8 Jan 2024 22:20:14 +0000 (17:20 -0500)]
os: relax tests and add examples for UserCacheDir and UserConfigDir

Per https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html:
“If, when attempting to write a file, the destination directory is
non-existent an attempt should be made to create it with permission
0700. […] The application should be prepared to handle the case where
the file could not be written […]. In such case it may choose to
present an error message to the user.”

In certain CI environments, these directories have well-defined
locations but do not exist and cannot be created. In that case,
we now choose to log and return from the test without failing it.

To prevent the functions from falling back to being entirely untested,
we still fail the test (and “present an error message to the user”) if
either function returns an empty string without an error, or returns a
path that refers to a non-directory or results in an error other than
ErrNotExist.

In addition, since the tests themselves no longer create subdirectories,
we add examples illustrating the suggested pattern of usage.

Fixes #64990.

Change-Id: Ie72106424f5ebe36eaf9288c22710d74bb14a462
Reviewed-on: https://go-review.googlesource.com/c/go/+/554815
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>

4 months agocmd/compile: use hashed symbol name for go.shape types if too long
Than McIntosh [Tue, 9 Jan 2024 15:06:15 +0000 (15:06 +0000)]
cmd/compile: use hashed symbol name for go.shape types if too long

Shape-based stenciling in the Go compiler's generic instantiation
phase looks up shape types using the underlying type of a given target
type. This has a beneficial effect in most cases (e.g. we can use the
same shape type for two different named types whose underlying type is
"int"), but causes some problems when the underlying type is a very
large structure. The link string for the underlying type of a large
imported struct can be extremely long, since the link string
essentially enumerates the full package path for every field type;
this can produce a "go.shape.struct { ... " symbol name that is
absurdly long.

This patch switches the compiler to use a hash of the underlying type
link string instead of the string itself, which should continue to
provide commoning but keep symbol name lengths reasonable for shape
types based on large imported structs.

Fixes #65030.

Change-Id: I87d602626c43172beb99c186b8ef72327b8227a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/554975
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Than McIntosh <thanm@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 months agonet: add available godoc link
cui fliter [Mon, 6 Nov 2023 14:58:32 +0000 (22:58 +0800)]
net: add available godoc link

Change-Id: Ib7c4baf0247c421954aedabfbb6a6af8a08a8936
Reviewed-on: https://go-review.googlesource.com/c/go/+/540021
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
4 months agoruntime: replace rwmutexR/W with per-rwmutex lock rank
Michael Pratt [Tue, 9 Jan 2024 18:13:45 +0000 (13:13 -0500)]
runtime: replace rwmutexR/W with per-rwmutex lock rank

CL 549536 intended to decouple the internal implementation of rwmutex
from the semantic meaning of an rwmutex read/write lock in the static
lock ranking.

Unfortunately, it was not thought through well enough. The internals
were represented with the rwmutexR and rwmutexW lock ranks. The idea was
that the internal lock ranks need not model the higher-level ordering,
since those have separate rankings. That is incorrect; rwmutexW is held
for the duration of a write lock, so it must be ranked before any lock
taken while any write lock is held, which is precisely what we were
trying to avoid.

This is visible in violations like:

        0 : execW 11 0x0
        1 : rwmutexW 51 0x111d9c8
        2 : fin 30 0x111d3a0
        fatal error: lock ordering problem

execW < fin is modeled, but rwmutexW < fin is missing.

Fix this by eliminating the rwmutexR/W lock ranks shared across
different types of rwmutex. Instead require users to define an
additional "internal" lock rank to represent the implementation details
of rwmutex.rLock. We can avoid an additional "internal" lock rank for
rwmutex.wLock because the existing writeRank has the same semantics for
semantic and internal locking. i.e., writeRank is held for the duration
of a write lock, which is exactly how rwmutex.wLock is used, so we can
use writeRank directly on wLock.

For #64722.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-staticlockranking
Change-Id: Ia572de188a46ba8fe054ae28537648beaa16b12c
Reviewed-on: https://go-review.googlesource.com/c/go/+/555055
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 months agonet/http: clarify the precedence order for Request.FormValue
Jes Cok [Tue, 9 Jan 2024 05:33:53 +0000 (05:33 +0000)]
net/http: clarify the precedence order for Request.FormValue

Fixes #64575

Change-Id: I0eaec642a9dc8ae3b273a6d41131cc7cb8332947
GitHub-Last-Rev: 17aa5170cbfe42cb86d56f1804266850d33c3eb5
GitHub-Pull-Request: golang/go#64578
Reviewed-on: https://go-review.googlesource.com/c/go/+/547855
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agomath/big: fix uint64 overflow in nat.mulRange
Robert Griesemer [Mon, 8 Jan 2024 21:28:59 +0000 (13:28 -0800)]
math/big: fix uint64 overflow in nat.mulRange

Compute median as a + (b-a)/2 instead of (a + b)/2.
Add additional test cases.

Fixes #65025.

Change-Id: Ib716a1036c17f8f33f51e33cedab13512eb7e0be
Reviewed-on: https://go-review.googlesource.com/c/go/+/554617
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
4 months agoio/fs,path/filepath: fix typo in SkipAll/SkipDir doc
Roger Peppe [Fri, 5 Jan 2024 12:47:56 +0000 (12:47 +0000)]
io/fs,path/filepath: fix typo in SkipAll/SkipDir doc

Also make the reference into a doc link.

Change-Id: Ib112307a65b65c8f963abf60aa92cb1942de940c
Reviewed-on: https://go-review.googlesource.com/c/go/+/554295
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agoruntime: fix tests when running with -msan
Mauri de Souza Meneguzzo [Wed, 13 Dec 2023 21:18:07 +0000 (21:18 +0000)]
runtime: fix tests when running with -msan

Currently go test -msan runtime always fails on loong64, arm64
and amd64. Changed the variable name to sz to match the
function prototypes.

For #64256

Change-Id: Ida71197307016520deb39293927850d47845140a
GitHub-Last-Rev: 0ee1e3bb093e682ef325d9860a8fed67570ca345
GitHub-Pull-Request: golang/go#64572
Reviewed-on: https://go-review.googlesource.com/c/go/+/547696
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Keith Randall <khr@golang.org>

4 months agocmd/doc: fix inconsistent receiver name
Mehdi Mostafavi [Mon, 8 Jan 2024 16:58:39 +0000 (16:58 +0000)]
cmd/doc: fix inconsistent receiver name

The ToText method of Package is the only one with a receiver declared
'p'; all the rest have 'pkg'. Fix it to be consistent.

Change-Id: I2b47c719f4f6f8d87336316b7f80deb1b49e17dc
GitHub-Last-Rev: 7d273b4ef0780b7ed8b651c117a28b25bab5bcb1
GitHub-Pull-Request: golang/go#64912
Reviewed-on: https://go-review.googlesource.com/c/go/+/553335
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
4 months ago[release-branch.go1.22] all: merge master (8eaa793) into release-branch.go1.22
Dmitri Shuralyov [Mon, 8 Jan 2024 20:05:45 +0000 (15:05 -0500)]
[release-branch.go1.22] all: merge master (8eaa793) into release-branch.go1.22

Merge List:

+ 2024-01-08 8eaa7935db net: clarify maxListenerBacklog windows implementation
+ 2024-01-08 759849187f log/slog: clarify SetDefault behavior
+ 2024-01-08 10a66d6816 sync: use map[any]any instead of map[interface{}]interface{} in the godoc
+ 2024-01-08 881869dde0 cmd/compile: handle defined iter func type correctly
+ 2024-01-05 1ae729e6d3 doc: s/adjustements/adjustments
+ 2024-01-05 8088b6db23 slices: explicitly discard results of some functions
+ 2024-01-05 c0693f648a cmd/go: run cover tool before swig
+ 2024-01-04 8db131082d github: switch seen/expected order in issue forms
+ 2024-01-04 ead47b0ab3 net/http: respond with 400 Bad Request for empty hex number of chunk length
+ 2024-01-04 1e07c144c3 net/http/cgi: in TestCopyError, check for a Handler.ServeHTTP goroutine instead of a running PID
+ 2024-01-04 15dcdeb5aa cmd/api: fix panic on exported basic type aliases
+ 2024-01-03 6db1102605 pagetrace: fix build when experiment is on
+ 2024-01-03 7d1b82dbf1 net/http: make Request.Clone create fresh copies for matches and otherValues
+ 2024-01-03 aa0a6ad1db doc/go1.22: add links to go/types symbols
+ 2024-01-03 c95fe91d07 runtime: correct scavengeIndex.sysGrow min index handling
+ 2023-12-30 b25f5558c6 all: replace outdated links
+ 2023-12-30 3233542e85 reflect: fix typo in type.go
+ 2023-12-27 988b718f41 doc: fix typo in example in spec
+ 2023-12-27 26ba75fe59 doc: document new iteration variable semantics in spec
+ 2023-12-27 1dddd83c49 doc: document version at which new language features were introduced in spec
+ 2023-12-26 36a2463e7c lib/time: update to 2023d/2023d
+ 2023-12-21 2184a39477 runtime/metrics: godoc link fixes
+ 2023-12-21 9c01ecce48 doc: fix misspelling in go1.22 release notes
+ 2023-12-21 0b56804084 runtime: use racereleasemerge for godebugInc
+ 2023-12-21 f6509cf5cd cmd/compile: handle constant-folding of an out-of-range jump table index
+ 2023-12-20 adec22b9f7 doc/go1.22: document changes to vet loopclosure analyzer
+ 2023-12-20 a2a2c5b947 doc: update unsafe.Pointer rule in spec
+ 2023-12-19 35222eeb78 doc: add html/template release note

Change-Id: I0709455dc512c94d2cbdb15c10d5c91f4bdaaa71

4 months agonet: clarify maxListenerBacklog windows implementation
Mauri de Souza Meneguzzo [Sat, 2 Dec 2023 15:11:36 +0000 (15:11 +0000)]
net: clarify maxListenerBacklog windows implementation

The previous TODO comments were somewhat ambiguous. This aims to
provide a clearer understanding of the behavior on Windows.

Windows does not offer a way to peek at the current backlog length, this
is explicitly stated in the winapi for `listen`.

When set to `syscall.SOMAXCONN`, the OS dynamically adjusts the
backlog to a maximum reasonable value. It goes as far as the dotnet
runtime itself introducing a new version of `listen` that does not accept a
backlog parameter to help eliminate the confusion when comparing the
behavior with UNIXes.

The docs also mention that `SOMAXCONN_HINT(N)` can be used, and that
it clips the final computed value between (200, 65535), which suggests
windows might use a `uint16` to back this number. Either way it does not
matter since windows will adjust this value anyway, so I removed the
wrapping TODO as well.

See https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-listen

Change-Id: I7b2e7cb547467c4bfc572ef0477a58de8c772521
GitHub-Last-Rev: 34e74abffe8792c8709c73db4d7a5fa05f64b1d0
GitHub-Pull-Request: golang/go#63549
Reviewed-on: https://go-review.googlesource.com/c/go/+/535475
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agolog/slog: clarify SetDefault behavior
Jonathan Amsterdam [Mon, 25 Sep 2023 12:41:31 +0000 (08:41 -0400)]
log/slog: clarify SetDefault behavior

Change-Id: I53250ca9e6d1ba69cc667949bebb5be2651a020d
Reviewed-on: https://go-review.googlesource.com/c/go/+/530477
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>

4 months agosync: use map[any]any instead of map[interface{}]interface{} in the godoc
sivchari [Wed, 27 Sep 2023 22:08:51 +0000 (07:08 +0900)]
sync: use map[any]any instead of map[interface{}]interface{} in the godoc

It's shorter and clearer.

Change-Id: Ibfbe5a7f8d70fa884691ba9858a2c9b2122d9c50
Reviewed-on: https://go-review.googlesource.com/c/go/+/531475
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>

4 months agocmd/compile: handle defined iter func type correctly
Cuong Manh Le [Tue, 2 Jan 2024 15:28:49 +0000 (22:28 +0700)]
cmd/compile: handle defined iter func type correctly

Fixed #64930

Change-Id: I916de7f97116fb20cb2f3f0b425ac34409afd494
Reviewed-on: https://go-review.googlesource.com/c/go/+/553436
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>

4 months agodoc: s/adjustements/adjustments
Jes Cok [Fri, 5 Jan 2024 10:20:03 +0000 (10:20 +0000)]
doc: s/adjustements/adjustments

Change-Id: I904b1adee13c63bc7d47d4325b794c1a650eb18d
GitHub-Last-Rev: 8eced8db566c4dea433260f87456902542095970
GitHub-Pull-Request: golang/go#64969
Reviewed-on: https://go-review.googlesource.com/c/go/+/554255
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Jes Cok <xigua67damn@gmail.com>

4 months agoslices: explicitly discard results of some functions
Alan Donovan [Fri, 5 Jan 2024 20:54:03 +0000 (15:54 -0500)]
slices: explicitly discard results of some functions

This will otherwise trigger an "unusedresult" vet check.

Fixes #64978

Change-Id: Ie19aded0f808d394f389452c3ff7f3edc1ed710d
Reviewed-on: https://go-review.googlesource.com/c/go/+/554196
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
4 months agocmd/go: run cover tool before swig
Than McIntosh [Thu, 21 Dec 2023 13:21:59 +0000 (08:21 -0500)]
cmd/go: run cover tool before swig

When building a package, run the cover tool on the collected go/cgo
source files before invoking swig (if swig files are present), as
opposed to running swig and then cover. Running swig adds new Go files
to the "cgo" list, and we want to avoid running those newly generated
files through the cover tool.

Fixes #64661.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Change-Id: I32b6dad5c39fcf5e656c40fb3b44220c69320889
Reviewed-on: https://go-review.googlesource.com/c/go/+/552095
Auto-Submit: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agogithub: switch seen/expected order in issue forms
Sean Liao [Fri, 29 Dec 2023 19:09:16 +0000 (19:09 +0000)]
github: switch seen/expected order in issue forms

Also fixup wording across other templates.

Fixes #64890

Change-Id: I6f9ade440b6702ddfafc21ccb7fbc6cabc2b856e
Reviewed-on: https://go-review.googlesource.com/c/go/+/553155
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
4 months agonet/http: respond with 400 Bad Request for empty hex number of chunk length
Andy Pan [Thu, 4 Jan 2024 07:28:14 +0000 (15:28 +0800)]
net/http: respond with 400 Bad Request for empty hex number of chunk length

Fixes #64517

Change-Id: I78b8a6a83301deee05c3ff052a6adcd1f965aef2
Reviewed-on: https://go-review.googlesource.com/c/go/+/553835
Auto-Submit: Damien Neil <dneil@google.com>
Commit-Queue: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
4 months agonet/http/cgi: in TestCopyError, check for a Handler.ServeHTTP goroutine instead of...
Bryan C. Mills [Thu, 4 Jan 2024 16:41:54 +0000 (11:41 -0500)]
net/http/cgi: in TestCopyError, check for a Handler.ServeHTTP goroutine instead of a running PID

Previously, the test could fail spuriously if the CGI process's PID
happened to be reused in between checks. That sort of reuse is highly
unlikely on platforms that cycle through the PID space sequentially
(such as Linux), but plausible on platforms that use randomized PIDs
(such as OpenBSD).

Also unskip the test on Windows, since it no longer relies on being
able to send signal 0 to an arbitrary PID.

Also change the expected failure mode of the test to a timeout instead
of a call to t.Fatalf, so that on failure we get a useful goroutine
dump for debugging instead of a non-actionable failure message.

Fixes #57369 (maybe).

Change-Id: Ib7e3fff556450b48cb5e6ea120fdf4d53547479b
Reviewed-on: https://go-review.googlesource.com/c/go/+/554075
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
4 months agocmd/api: fix panic on exported basic type aliases
Devon H. O'Dell [Thu, 4 Jan 2024 16:49:17 +0000 (11:49 -0500)]
cmd/api: fix panic on exported basic type aliases

The order of emitting named type and type aliases in the `Walker`'s
`emitType` function is inverted. When the type alias references a basic
type, this causes a panic as the type assertion on `*types.Named` fails.
This change reorders the logic such that type aliases are emitted prior
to this type assertion.

Fixes #64958

Change-Id: I52dbe13999978912ded788d9cf4948103869bcfa
Reviewed-on: https://go-review.googlesource.com/c/go/+/554076
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com>

4 months agopagetrace: fix build when experiment is on
John Howard [Tue, 19 Dec 2023 17:35:32 +0000 (09:35 -0800)]
pagetrace: fix build when experiment is on

due to a recent change, this experiment does not compile at all. This
simply fixes to pass in the new required parameter.

Change-Id: Idce0e72fa436a7acf4923717913deb3a37847fe2
Reviewed-on: https://go-review.googlesource.com/c/go/+/551415
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agonet/http: make Request.Clone create fresh copies for matches and otherValues
Jes Cok [Wed, 3 Jan 2024 04:18:15 +0000 (04:18 +0000)]
net/http: make Request.Clone create fresh copies for matches and otherValues

This change fixes Request.Clone to correctly work with SetPathValue
by creating fresh copies for matches and otherValues so that
SetPathValue for cloned requests doesn't pollute the original request.

While here, also added a doc for Request.SetPathValue.

Fixes #64911

Change-Id: I2831b38e135935dfaea2b939bb9db554c75b65ef
GitHub-Last-Rev: 1981db16475a49fe8d4b874a6bceec64d28a1332
GitHub-Pull-Request: golang/go#64913
Reviewed-on: https://go-review.googlesource.com/c/go/+/553375
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Jes Cok <xigua67damn@gmail.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
4 months agodoc/go1.22: add links to go/types symbols
Alan Donovan [Wed, 3 Jan 2024 16:21:49 +0000 (11:21 -0500)]
doc/go1.22: add links to go/types symbols

Also, join three paragraphs that should have been one.

Change-Id: Ib1c252f88a1e98afe157d477caa5323c0c8365e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/553715
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
4 months agoruntime: correct scavengeIndex.sysGrow min index handling
Joel Sing [Fri, 29 Dec 2023 11:56:58 +0000 (22:56 +1100)]
runtime: correct scavengeIndex.sysGrow min index handling

The backing store for the scavengeIndex chunks slice is allocated on demand
as page allocation occurs. When pageAlloc.grow is called, a range is
allocated from a reserved region, before scavengeIndex.grow is called
to ensure that the chunks needed to manage this new range have a valid
backing store. The valid region for chunks is recorded as the index min
and index max. Any changes need to take the existing valid range into
consideration and ensure that a contiguous valid range is maintained.

However, a bug in the min index handling can currently lead to an existing
part of the chunk slice backing store being zeroed via remapping. Initially,
there is no backing store allocated and both min and max are zero. As soon
as an allocation occurs max will be non-zero, however it is still valid for
min to be zero depending on the base addresses of the page allocations. A
sequence like the following will trigger the bug:

1. A page allocation occurs requiring chunks [0, 512) (after rounding) - a
   sysMap occurs for the backing store, min is set to 0 and max is set
   to 512.

2. A page allocation occurs requiring chunks [512, 1024) - another sysMap
   occurs for this part of the backing store, max is set to 1024, however
   min is incorrectly set to 512, since haveMin == 0 (validly).

3. Another page allocation occurs requiring chunks [0, 512) - since min is
   currently 512 a sysMap occurs for the already mapped and inuse part
   of the backing store from [0, 512), zeroing the chunk data.

Correct this by only updating min when either haveMax == 0 (the
uninitialised case) or when needMin < haveMin (the case where the new
backing store range is actually below the current allocation). Remove
the unnecessary haveMax == 0 check for updating max, as the existing
needMax > haveMax case already covers this.

Fixes #63385

Change-Id: I9deed74c4ffa187c98286fe7110e5d735e81f35f
Reviewed-on: https://go-review.googlesource.com/c/go/+/553135
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>

4 months agoall: replace outdated links
cui fliter [Thu, 14 Dec 2023 08:40:35 +0000 (16:40 +0800)]
all: replace outdated links

Change-Id: I7156e7858e8f06459818e03729c644d64e04d43c
Reviewed-on: https://go-review.googlesource.com/c/go/+/549356
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agoreflect: fix typo in type.go
RenJiangdu [Thu, 28 Dec 2023 09:49:45 +0000 (09:49 +0000)]
reflect: fix typo in type.go

There is no 'of' relationships between float and string. This points to those interfaces with internal type float or string.

Change-Id: I14449f00c192e0d3f8270b433ff508978b7fdf17
GitHub-Last-Rev: f301a8aa5294e7669361627c82b2978652cfc14b
GitHub-Pull-Request: golang/go#64885
Reviewed-on: https://go-review.googlesource.com/c/go/+/552957
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Run-TryBot: qiulaidongfeng <2645477756@qq.com>
Run-TryBot: Jorropo <jorropo.pgm@gmail.com>

4 months agodoc: fix typo in example in spec
Robert Griesemer [Wed, 27 Dec 2023 05:17:04 +0000 (21:17 -0800)]
doc: fix typo in example in spec

Follow-up on CL 551095.

For #56010.

Change-Id: I8913d6ca96c419c81683e88c6286b05ae1323416
Reviewed-on: https://go-review.googlesource.com/c/go/+/552915
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

4 months agodoc: document new iteration variable semantics in spec
Robert Griesemer [Tue, 19 Dec 2023 01:09:18 +0000 (17:09 -0800)]
doc: document new iteration variable semantics in spec

For #56010.

Change-Id: Icca987a03d80587dd0e901f596ff7788584893ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/551095
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

4 months agodoc: document version at which new language features were introduced in spec
Robert Griesemer [Wed, 13 Dec 2023 20:29:32 +0000 (12:29 -0800)]
doc: document version at which new language features were introduced in spec

Add a new section to the Appendix describing what features were
changed or added in which language version.

Add short links with references to the required language version
where relevant.

Fixes #63857.

Change-Id: I5250f856d8688a71602076fcc662aa678d96a5d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/549518
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
4 months agolib/time: update to 2023d/2023d
Dmitri Shuralyov [Fri, 22 Dec 2023 19:03:14 +0000 (14:03 -0500)]
lib/time: update to 2023d/2023d

Commit generated by update.bash.

For #22487.

Change-Id: I4c8a275bb607981c21a0ad5e49b3cae968fc8e64
Reviewed-on: https://go-review.googlesource.com/c/go/+/552575
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agoruntime/metrics: godoc link fixes
Olivier Mengué [Thu, 14 Dec 2023 17:25:21 +0000 (18:25 +0100)]
runtime/metrics: godoc link fixes

Fix rendering of link to runtime/debug.ReadGCStats in package overview:
as the package is not imported we must specify the absolute package
name.

Change-Id: I123db49eee05e6812427e19873e628b4e4feb203
Reviewed-on: https://go-review.googlesource.com/c/go/+/549735
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: qiulaidongfeng <2645477756@qq.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
4 months agodoc: fix misspelling in go1.22 release notes
Manlio Perillo [Wed, 20 Dec 2023 20:02:10 +0000 (21:02 +0100)]
doc: fix misspelling in go1.22 release notes

Found by codespell.

Change-Id: I38254f75a8d342a48bbaf6421c681bef7a262dec
Reviewed-on: https://go-review.googlesource.com/c/go/+/551955
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Jes Cok <xigua67damn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

4 months agoruntime: use racereleasemerge for godebugInc
Cherry Mui [Wed, 20 Dec 2023 19:33:46 +0000 (14:33 -0500)]
runtime: use racereleasemerge for godebugInc

CL 549796 adds race annotations to godebugInc. It uses racerelease
to model a CompareAndSwap. However, a CompareAndSwap is
essentially a load and a store. Modeling it as just racerelease
makes it not synchronized with other racerelease, i.e. other CAS.
For the following execution

thread         A             B
          load, got nil
                        load, got nil
          set *inc
                        set *inc
          racerelease
          CAS success
                        racerelease
                        CAS fail
                        load
                        raceacquire
                        use *inc (from A)

On thread B, the raceacquire synchronizes with the previous
racerelease, which is not synchronized with racerelease on thread
A, so it doesn't know that the use of *inc on thread B is after
the set on thread A, and will report a race.

Change it to use racereleasemerge, which synchronizes with
previous racerelease and racereleasemerge. So in the case above it
knows thread B's CAS is after thread A's.

Also remove stale comment that was more relevant when the code
used atomic store, where CL 549796 changed to CAS.

Updates #64649.

Change-Id: I17671090a19c0699fcb4e6481e2abd98ef2e5542
Reviewed-on: https://go-review.googlesource.com/c/go/+/551856
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
4 months agocmd/compile: handle constant-folding of an out-of-range jump table index
Keith Randall [Wed, 20 Dec 2023 23:38:50 +0000 (15:38 -0800)]
cmd/compile: handle constant-folding of an out-of-range jump table index

The input index to a jump table can be out of range for unreachable code.

Dynamically the compiler ensures that an out-of-range index can never
reach a jump table, but that guarantee doesn't extend to the static
realm.

Fixes #64826

Change-Id: I5829f3933ae5124ffad8337dfd7dd75e67a8ec33
Reviewed-on: https://go-review.googlesource.com/c/go/+/552055
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
4 months agodoc/go1.22: document changes to vet loopclosure analyzer
Tim King [Tue, 19 Dec 2023 18:08:00 +0000 (10:08 -0800)]
doc/go1.22: document changes to vet loopclosure analyzer

cmd/vet no longer reports loopclosure bugs within files built at
GoVersion>=1.22.

For #61422.

Change-Id: I6f29373bb236822ece4e7ae35914859538b8d57b
Reviewed-on: https://go-review.googlesource.com/c/go/+/551376
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Tim King <taking@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

4 months agodoc: update unsafe.Pointer rule in spec
Robert Griesemer [Tue, 19 Dec 2023 21:32:07 +0000 (13:32 -0800)]
doc: update unsafe.Pointer rule in spec

The valid conversions consider the core types of operands, not just
their underlying type.

This also explains the valid arguments for unsafe.Slice which are
explained in terms of unsafe.Pointer conversions.

unsafe.SliceData simply refers to "slice argument" and we use
similar terminology elsewhere in the spec to denote values that
have a core type of slice (or any other type for that matter).
Leaving alone for now.

Fixes #64452.

Change-Id: I0eed3abbc0606f22358835e5d434f026fe0909c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/551379
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>

4 months ago[release-branch.go1.22] go1.22rc1 go1.22rc1
Gopher Robot [Tue, 19 Dec 2023 20:28:47 +0000 (20:28 +0000)]
[release-branch.go1.22] go1.22rc1

Change-Id: Ia3eeb58ffd7acc4dc519a304f3ef934ab9c82175
Reviewed-on: https://go-review.googlesource.com/c/go/+/551536
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
4 months agodoc: add html/template release note
Roland Shoemaker [Tue, 19 Dec 2023 16:14:50 +0000 (08:14 -0800)]
doc: add html/template release note

Updates #61422

Change-Id: Ie86e8545d55cfd0898d21387d8b48d9392f85bf0
Reviewed-on: https://go-review.googlesource.com/c/go/+/551335
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months ago[release-branch.go1.22] all: merge master (0324250) into release-branch.go1.22
Than McIntosh [Tue, 19 Dec 2023 15:57:35 +0000 (10:57 -0500)]
[release-branch.go1.22] all: merge master (0324250) into release-branch.go1.22

Merge List:

+ 2023-12-19 03242506de doc: comment out remaining TODOs in Go 1.22 relnotes (for now)
+ 2023-12-19 9dd1cde9ac doc/go1.22,cmd/go: document that 'go mod init' no longer imports from other vendoring tools
+ 2023-12-19 22284c34f2 doc/go1.22: document removal of 'go get' support in GOPATH mode
+ 2023-12-19 339177aa31 doc: typo fix for net/http.ServeMux
+ 2023-12-19 52dbffeac8 cmd/go/internal/toolchain: revert "make a best effort to parse 'go run' and 'go install' flags"

Change-Id: I102e8267373364d0ad6170d36442d19048268765

4 months agodoc: comment out remaining TODOs in Go 1.22 relnotes (for now)
Than McIntosh [Tue, 19 Dec 2023 15:32:52 +0000 (10:32 -0500)]
doc: comment out remaining TODOs in Go 1.22 relnotes (for now)

This patch comments out the remaining "TODO" items in the Go 1.22
release notes temporarily, so as to have RC1 go out with the notes
in a clean (TODO-less) state.

Change-Id: I88f5fef75860fc78b8077dce704ae71c6194a6a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/551257
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Than McIntosh <thanm@google.com>