]> Cypherpunks repositories - gostls13.git/log
gostls13.git
2 weeks agocmd/compile, simd: capture VAES instructions and fix AVX512VAES feature
Junyang Shao [Thu, 22 Jan 2026 17:44:32 +0000 (17:44 +0000)]
cmd/compile, simd: capture VAES instructions and fix AVX512VAES feature

The code previously filters out VAES-only instructions, this CL added
them back.

This CL added the VAES feature check following the Intel xed data:

  XED_ISA_SET_VAES:              vaes.7.0.ecx.9 # avx.1.0.ecx.28

This CL also found out that the old AVX512VAES feature check is not
checking the correct bits, it also fixes it:

  XED_ISA_SET_AVX512_VAES_128:    vaes.7.0.ecx.9  aes.1.0.ecx.25  avx512f.7.0.ebx.16 avx512vl.7.0.ebx.31
  XED_ISA_SET_AVX512_VAES_256:    vaes.7.0.ecx.9  aes.1.0.ecx.25  avx512f.7.0.ebx.16 avx512vl.7.0.ebx.31
  XED_ISA_SET_AVX512_VAES_512:    vaes.7.0.ecx.9  aes.1.0.ecx.25  avx512f.7.0.ebx.16

It restricts to the most strict common set - includes avx512vl for even
512-bits although it doesn't requires it.

Change-Id: I4e2f72b312fd2411589fbc12f9ee5c63c09c2e9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/738500
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 weeks agoruntime/metrics: fix panic in Read with empty slice
Amol Yadav [Wed, 28 Jan 2026 01:14:53 +0000 (01:14 +0000)]
runtime/metrics: fix panic in Read with empty slice

Calling Read with a nil or empty slice previously caused a panic with
"index out of range" because the function unconditionally accessed the
first element of the slice (via &m[0]) to pass the pointer to the
runtime.

This change adds a check for len(m) == 0 to return early, preventing
the panic when no samples are provided.

Fixes #77231

Change-Id: I442635f5c61de432883c8d0efae9cc6aa1363cc9
GitHub-Last-Rev: 6f24f67b18c77a0b36b92017a3f4ef8aa3aa5229
GitHub-Pull-Request: golang/go#77233
Reviewed-on: https://go-review.googlesource.com/c/go/+/737380
Reviewed-by: Amol Yadav <amolyadav6125@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Commit-Queue: Michael Pratt <mpratt@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
3 weeks agocrypto/tls: check verifiedChains roots when resuming sessions
Roland Shoemaker [Mon, 26 Jan 2026 19:18:45 +0000 (11:18 -0800)]
crypto/tls: check verifiedChains roots when resuming sessions

When resuming TLS sessions, on the server and client verify that the
chains stored in the session state (verifiedChains) are still acceptable
with regards to the Config by checking for the inclusion of the root in
either ClientCAs (server) or RootCAs (client). This prevents resuming
a session with a certificate chain that would be rejected during a full
handshake due to an untrusted root.

Updates #77113
Updates #77217
Updates CVE-2025-68121

Change-Id: I11fe00909ef1961c24ecf80bf5b97f7b1121d359
Reviewed-on: https://go-review.googlesource.com/c/go/+/737700
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Coia Prant <coiaprant@gmail.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
3 weeks agocrypto/tls: add verifiedChains expiration checking during resumption
Roland Shoemaker [Mon, 26 Jan 2026 18:55:32 +0000 (10:55 -0800)]
crypto/tls: add verifiedChains expiration checking during resumption

When resuming a session, check that the verifiedChains contain at least
one chain that is still valid at the time of resumption. If not, trigger
a new handshake.

Updates #77113
Updates #77217
Updates CVE-2025-68121

Change-Id: I14f585c43da17802513cbdd5b10c552d7a38b34e
Reviewed-on: https://go-review.googlesource.com/c/go/+/739321
Reviewed-by: Coia Prant <coiaprant@gmail.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
3 weeks agoRevert "crypto/tls: don't copy auto-rotated session ticket keys in Config.Clone"
Roland Shoemaker [Mon, 26 Jan 2026 18:49:30 +0000 (10:49 -0800)]
Revert "crypto/tls: don't copy auto-rotated session ticket keys in Config.Clone"

This reverts CL 736709 (commit bba24719a4cad5cc8d771fc9cfff5a38019d554a).

Updates #77113
Updates CVE-2025-68121

Change-Id: I0261cb75e9adf9d0ac9890dc91ae8476b8988ba0
Reviewed-on: https://go-review.googlesource.com/c/go/+/739320
Reviewed-by: Coia Prant <coiaprant@gmail.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
3 weeks agocmd/compile: simplify slice/array range loops on loong64
Guoqi Chen [Thu, 22 Jan 2026 02:44:19 +0000 (10:44 +0800)]
cmd/compile: simplify slice/array range loops on loong64

loong64 supports R+R addressing ({st,ld}x.{b,h,w,d} instructions)
and has implemented the relevant lowering rules (only width is 1).

Removes 1616 instructions from the go binary on loong64.

file         before    after      Δ         %
asm          575366    575314    -52     -0.0090%
cgo          489972    489884    -88     -0.0180%
compile     2920418   2920110    -308    -0.0105%
cover        540458    540290    -168    -0.0311%
fix          865840    865668    -172    -0.0199%
link         732858    732662    -196    -0.0267%
preprofile   246022    245978    -44     -0.0179%
vet          839268    839124    -144    -0.0172%
go          1666470   1666114    -356    -0.0214%
gofmt        326526    326438    -88     -0.0270%
total       9203198   9201582    -1616   -0.0176%

Change-Id: If3518547c785764877a6cf987781d43d8b572990
Reviewed-on: https://go-review.googlesource.com/c/go/+/738240
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
3 weeks agocmd/compile: (loong64) optimize float32(abs|sqrt64(float64(x)))
Xiaolin Zhao [Mon, 12 Jan 2026 08:21:54 +0000 (16:21 +0800)]
cmd/compile: (loong64) optimize float32(abs|sqrt64(float64(x)))

Ref: #733621
Updates #75463

Change-Id: Idd8821d1713754097a2fe83a050c25d9ec5b17eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/735540
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 weeks agocmd/compile: remove the NORconst op on mips{,64}
Xiaolin Zhao [Tue, 13 Jan 2026 03:30:21 +0000 (11:30 +0800)]
cmd/compile: remove the NORconst op on mips{,64}

In the mips{,64} instruction sets and their extensions, there is no
NORI instruction.

Change-Id: If008442c792297d011b3d0c1e8501e62e32ab175
Reviewed-on: https://go-review.googlesource.com/c/go/+/735900
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 weeks agoreflect: allow conversions between slices of named {byte,rune} and string
Keith Randall [Tue, 27 Jan 2026 19:06:18 +0000 (11:06 -0800)]
reflect: allow conversions between slices of named {byte,rune} and string

So the reflect behavior matches that of the language.

These conversions are allowed:

[]myByte <-> string
[]myRune <-> string
[]myByte <-> myString
[]myRune <-> myString

And even if the left-hand-side is named, e.g.

myBytes([]myByte) <-> string

Fixes #53523

Change-Id: I6562e72bc233a45dc7b02f75f68020831ad399ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/739680
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 weeks agocmd/link, runtime: remove typelinks
Ian Lance Taylor [Wed, 26 Nov 2025 06:44:11 +0000 (22:44 -0800)]
cmd/link, runtime: remove typelinks

Instead of adding a typelinks section to a Go binary,
mark the start and end of the typelinked type descriptors.
The runtime can then step through the descriptors to find them all,
rather than relying on the extra linker-generated offset list.

The runtime steps through the type descriptors lazily,
as many Go programs don't need the typelinks list at all.

This reduces the size of cmd/go by 15K bytes, which isn't much
but it's not nothing.

A future CL will change the reflect package to use the type pointers
directly rather than converting to offsets and then back to type pointers.

For #6853

Change-Id: Id0af4ce81c5b1cea899fc92b6ff9d2db8ce4c267
Reviewed-on: https://go-review.googlesource.com/c/go/+/724261
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
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>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

3 weeks agoos/exec: document blocking Stdin/Stdout/Stderr
Ian Lance Taylor [Tue, 27 Jan 2026 04:03:30 +0000 (20:03 -0800)]
os/exec: document blocking Stdin/Stdout/Stderr

WaitDelay only handles writes to Stdin and reads from Stdout/Stderr.
If Stdin is set to a blocking Reader, or Stdout/Stderr are set to
a blocking Writer, Wait can hang indefinitely. I don't see any way to
fix this with the current API, as there is no general way that the
os/exec package can interrupt the blocking Read or Write.

This CL documents the limitation and points people toward the
workaround of using StdinPipe/StdoutPipe/StderrPipe and arranging
for their own way to interrupt the blocking Read or Write.

Fixes #77227

Change-Id: I3150ae7af89dccf8d859b41eb43eaf0bbbb55fee
Reviewed-on: https://go-review.googlesource.com/c/go/+/739422
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
3 weeks agocmd/link: remove unused symbol kind SFUNCTAB
Ian Lance Taylor [Mon, 24 Nov 2025 23:33:25 +0000 (15:33 -0800)]
cmd/link: remove unused symbol kind SFUNCTAB

Change-Id: Ica7201dabe7f72b9470d8acbad043a34a20345a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/724121
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
3 weeks agosimd/archsimd: fix typo in the SHA256Message1 documentation string
Neal Patel [Thu, 22 Jan 2026 22:34:17 +0000 (22:34 +0000)]
simd/archsimd: fix typo in the SHA256Message1 documentation string

Change-Id: I8bc5fec0475bfaebc0469d0efb2ba89af4b3f150
Reviewed-on: https://go-review.googlesource.com/c/go/+/738640
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 weeks agocmd/link: handle SRODATALRELRO in xcoffUpdateOuterSize
Ian Lance Taylor [Sat, 24 Jan 2026 00:20:43 +0000 (16:20 -0800)]
cmd/link: handle SRODATALRELRO in xcoffUpdateOuterSize

This is a followup to CL 723580. This fixes cgo builds on AIX.

For #76038

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

3 weeks agogo/types, types2: rename Named.finite to Named.varSize
Mark Freeman [Tue, 27 Jan 2026 15:53:21 +0000 (10:53 -0500)]
go/types, types2: rename Named.finite to Named.varSize

Change-Id: I81646c2753c2e44953b116138cb41d41a011ff08
Reviewed-on: https://go-review.googlesource.com/c/go/+/739561
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
3 weeks agointernal/runtime/gc/scan: include package in expandAVX512 symbol names
Michael Pratt [Thu, 22 Jan 2026 16:56:00 +0000 (11:56 -0500)]
internal/runtime/gc/scan: include package in expandAVX512 symbol names

These symbols are part of the scan package, so they should include the
package name in the symbol name for consistency.

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

3 weeks agoruntime: rename aeshashbody to runtime.aeshashbody
Michael Pratt [Thu, 22 Jan 2026 16:47:42 +0000 (11:47 -0500)]
runtime: rename aeshashbody to runtime.aeshashbody

Currently this is a raw symbol name with no package component, which is
confusing when seen in profilers or similar tools.

This function does not follow a Go ABI, and thus should not have a Go
function declaration. go vet requires declaration for standard assembly
functions.

CL 176100 removed the package name as part of making vet pass on package
runtime, but simply making the function static via the <> suffix is
sufficient, there is no need to shorten the symbol name.

Change-Id: I6a6a636c6030f1c9a4b8bb330978733bb336b08e
Reviewed-on: https://go-review.googlesource.com/c/go/+/738521
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
3 weeks agogo/types, types2: add check for map value completeness in IndexExpr
Mark Freeman [Tue, 20 Jan 2026 19:23:19 +0000 (14:23 -0500)]
go/types, types2: add check for map value completeness in IndexExpr

An index expression can also go from map[K]V to V. Since V could be
incomplete (due to some admittedly contrived syntax), we need a
check.

Change-Id: I03ffbfc0e5bcc9129591d60dfbaa5fafcf8fb183
Reviewed-on: https://go-review.googlesource.com/c/go/+/737620
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>

3 weeks agogo/types, types2: replace pendingType with completion check
Mark Freeman [Thu, 8 Jan 2026 21:06:45 +0000 (16:06 -0500)]
go/types, types2: replace pendingType with completion check

This change establishes the invariant that Underlying() cannot observe
a nil RHS for a defined type, unless that type was created by go/types
with an explicitly nil underlying type.

It does so using isComplete, which is a guard to check that a type has
an underlying type. This guard is needed whenever we could produce a
value of a defined type or access some property of a defined type.

Examples include T{}, *x (where x has type *T), T.x, etc. (see CL
734600 for more).

The pendingType mechanism to deeply traverse values of a defined type
is moved to hasVarSize, since this is only truly needed at the site
of a built-in such as unsafe.Sizeof.

This ties cycle detection across value context directly to the syntax,
which seems like the right direction.

Change-Id: Ic47862a2038fb2ba3ae6621e9907265ccbd86ea3
Reviewed-on: https://go-review.googlesource.com/c/go/+/734980
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>

3 weeks agocmd/compile, runtime: avoid improper control transfer instruction hints on riscv64
wangboyao [Thu, 4 Dec 2025 11:06:20 +0000 (19:06 +0800)]
cmd/compile, runtime: avoid improper control transfer instruction hints on riscv64

On RISC-V the JAL and JALR instructions provide Return Address
Stack(RAS) prediction hints based on the registers used (as per section
2.5.1 of the RISC-V ISA manual). When a JALR instruction uses X1 or X5
as the source register, it hints that a pop should occur.

When making a function call, avoid the use of X5 as a source register
since this results in the RAS performing a pop-then-push instead of a
push, breaking call/return pairing and significantly degrading front-end
branch prediction performance.

Based on test result of golang.org/x/benchmarks/json on SpacemiT K1, fix
version has a performance improvement of about 7%

Fixes #76654

Change-Id: I867c8d7cfb54f5decbe176f3ab3bb3d78af1cf64
Reviewed-on: https://go-review.googlesource.com/c/go/+/726760
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
Run-TryBot: Joel Sing <joel@sing.id.au>

3 weeks agocrypto/subtle: add vector implementation of xorBytes for riscv64
Joel Sing [Mon, 3 Feb 2025 12:53:13 +0000 (23:53 +1100)]
crypto/subtle: add vector implementation of xorBytes for riscv64

On a Banana Pi F3:

                                     │   subtle.1    │               subtle.2               │
                                     │    sec/op     │    sec/op     vs base                │
ConstantTimeSelect-8                    4.391n ±  1%   4.390n ±  0%        ~ (p=0.500 n=10)
ConstantTimeByteEq-8                    3.763n ±  0%   3.764n ±  0%        ~ (p=0.549 n=10)
ConstantTimeEq-8                        3.767n ±  1%   3.764n ±  0%   -0.08% (p=0.002 n=10)
ConstantTimeLessOrEq-8                  3.136n ±  0%   3.138n ±  0%   +0.06% (p=0.002 n=10)
XORBytes/8Bytes-8                       53.42n ±  0%   52.28n ±  0%   -2.13% (p=0.000 n=10)
XORBytes/128Bytes-8                     64.79n ±  0%   64.12n ±  0%   -1.03% (p=0.000 n=10)
XORBytes/2048Bytes-8                    479.3n ±  0%   322.0n ±  0%  -32.84% (p=0.000 n=10)
XORBytes/8192Bytes-8                    8.897µ ± 26%   7.734µ ± 12%        ~ (p=0.165 n=10)
XORBytes/32768Bytes-8                   39.17µ ± 17%   35.40µ ± 24%   -9.63% (p=0.029 n=10)
XORBytesAlignment/8Bytes0Offset-8       51.74n ±  0%   54.18n ±  0%   +4.72% (p=0.000 n=10)
XORBytesAlignment/8Bytes1Offset-8       51.51n ±  1%   53.52n ±  0%   +3.92% (p=0.000 n=10)
XORBytesAlignment/8Bytes2Offset-8       51.35n ±  1%   53.58n ±  0%   +4.34% (p=0.000 n=10)
XORBytesAlignment/8Bytes3Offset-8       50.86n ±  0%   53.56n ±  0%   +5.31% (p=0.000 n=10)
XORBytesAlignment/8Bytes4Offset-8       51.62n ±  0%   54.20n ±  0%   +4.98% (p=0.000 n=10)
XORBytesAlignment/8Bytes5Offset-8       51.42n ±  1%   53.48n ±  0%   +4.02% (p=0.000 n=10)
XORBytesAlignment/8Bytes6Offset-8       51.08n ±  1%   53.46n ±  0%   +4.67% (p=0.000 n=10)
XORBytesAlignment/8Bytes7Offset-8       50.83n ±  0%   53.54n ±  0%   +5.33% (p=0.000 n=10)
XORBytesAlignment/128Bytes0Offset-8     63.67n ±  0%   66.04n ±  0%   +3.72% (p=0.000 n=10)
XORBytesAlignment/128Bytes1Offset-8    114.40n ±  0%   67.42n ±  0%  -41.07% (p=0.000 n=10)
XORBytesAlignment/128Bytes2Offset-8    113.85n ±  0%   67.43n ±  0%  -40.78% (p=0.000 n=10)
XORBytesAlignment/128Bytes3Offset-8    114.60n ±  0%   67.31n ±  0%  -41.27% (p=0.000 n=10)
XORBytesAlignment/128Bytes4Offset-8    109.30n ±  0%   67.45n ±  0%  -38.29% (p=0.000 n=10)
XORBytesAlignment/128Bytes5Offset-8    110.70n ±  0%   67.32n ±  1%  -39.19% (p=0.000 n=10)
XORBytesAlignment/128Bytes6Offset-8    110.05n ±  0%   67.45n ±  1%  -38.71% (p=0.000 n=10)
XORBytesAlignment/128Bytes7Offset-8    110.60n ±  0%   67.43n ±  0%  -39.04% (p=0.000 n=10)
XORBytesAlignment/2048Bytes0Offset-8    478.4n ±  0%   335.6n ±  0%  -29.85% (p=0.000 n=10)
XORBytesAlignment/2048Bytes1Offset-8    529.7n ±  0%   349.3n ±  0%  -34.05% (p=0.000 n=10)
XORBytesAlignment/2048Bytes2Offset-8    529.3n ±  0%   349.8n ±  0%  -33.91% (p=0.000 n=10)
XORBytesAlignment/2048Bytes3Offset-8    529.8n ±  0%   349.5n ±  0%  -34.02% (p=0.000 n=10)
XORBytesAlignment/2048Bytes4Offset-8    524.7n ±  0%   349.6n ±  0%  -33.38% (p=0.000 n=10)
XORBytesAlignment/2048Bytes5Offset-8    525.9n ±  0%   349.6n ±  0%  -33.52% (p=0.000 n=10)
XORBytesAlignment/2048Bytes6Offset-8    525.1n ±  0%   349.8n ±  0%  -33.39% (p=0.000 n=10)
XORBytesAlignment/2048Bytes7Offset-8    526.0n ±  0%   349.8n ±  0%  -33.51% (p=0.000 n=10)
geomean                                 120.0n         96.92n        -19.23%

                                     │   subtle.1    │                subtle.2                │
                                     │      B/s      │      B/s        vs base                │
XORBytes/8Bytes-8                      142.8Mi ±  0%    145.9Mi ±  0%   +2.19% (p=0.000 n=10)
XORBytes/128Bytes-8                    1.840Gi ±  0%    1.859Gi ±  0%   +1.05% (p=0.000 n=10)
XORBytes/2048Bytes-8                   3.979Gi ±  0%    5.925Gi ±  0%  +48.89% (p=0.000 n=10)
XORBytes/8192Bytes-8                   879.1Mi ± 35%   1010.2Mi ± 13%        ~ (p=0.165 n=10)
XORBytes/32768Bytes-8                  797.9Mi ± 21%    882.8Mi ± 31%  +10.64% (p=0.029 n=10)
XORBytesAlignment/8Bytes0Offset-8      147.5Mi ±  0%    140.8Mi ±  0%   -4.50% (p=0.000 n=10)
XORBytesAlignment/8Bytes1Offset-8      148.1Mi ±  1%    142.5Mi ±  0%   -3.77% (p=0.000 n=10)
XORBytesAlignment/8Bytes2Offset-8      148.6Mi ±  1%    142.4Mi ±  0%   -4.15% (p=0.000 n=10)
XORBytesAlignment/8Bytes3Offset-8      150.0Mi ±  0%    142.4Mi ±  0%   -5.04% (p=0.000 n=10)
XORBytesAlignment/8Bytes4Offset-8      147.8Mi ±  0%    140.8Mi ±  0%   -4.75% (p=0.000 n=10)
XORBytesAlignment/8Bytes5Offset-8      148.4Mi ±  1%    142.6Mi ±  0%   -3.87% (p=0.000 n=10)
XORBytesAlignment/8Bytes6Offset-8      149.4Mi ±  1%    142.7Mi ±  0%   -4.45% (p=0.000 n=10)
XORBytesAlignment/8Bytes7Offset-8      150.1Mi ±  0%    142.5Mi ±  0%   -5.05% (p=0.000 n=10)
XORBytesAlignment/128Bytes0Offset-8    1.872Gi ±  0%    1.805Gi ±  0%   -3.59% (p=0.000 n=10)
XORBytesAlignment/128Bytes1Offset-8    1.042Gi ±  0%    1.768Gi ±  0%  +69.65% (p=0.000 n=10)
XORBytesAlignment/128Bytes2Offset-8    1.047Gi ±  0%    1.768Gi ±  0%  +68.80% (p=0.000 n=10)
XORBytesAlignment/128Bytes3Offset-8    1.040Gi ±  0%    1.771Gi ±  0%  +70.27% (p=0.000 n=10)
XORBytesAlignment/128Bytes4Offset-8    1.090Gi ±  0%    1.767Gi ±  0%  +62.08% (p=0.000 n=10)
XORBytesAlignment/128Bytes5Offset-8    1.077Gi ±  0%    1.771Gi ±  1%  +64.41% (p=0.000 n=10)
XORBytesAlignment/128Bytes6Offset-8    1.083Gi ±  0%    1.767Gi ±  1%  +63.17% (p=0.000 n=10)
XORBytesAlignment/128Bytes7Offset-8    1.078Gi ±  0%    1.768Gi ±  0%  +64.07% (p=0.000 n=10)
XORBytesAlignment/2048Bytes0Offset-8   3.987Gi ±  0%    5.684Gi ±  0%  +42.55% (p=0.000 n=10)
XORBytesAlignment/2048Bytes1Offset-8   3.601Gi ±  0%    5.459Gi ±  0%  +51.61% (p=0.000 n=10)
XORBytesAlignment/2048Bytes2Offset-8   3.604Gi ±  0%    5.453Gi ±  0%  +51.31% (p=0.000 n=10)
XORBytesAlignment/2048Bytes3Offset-8   3.600Gi ±  0%    5.457Gi ±  0%  +51.56% (p=0.000 n=10)
XORBytesAlignment/2048Bytes4Offset-8   3.635Gi ±  0%    5.456Gi ±  0%  +50.10% (p=0.000 n=10)
XORBytesAlignment/2048Bytes5Offset-8   3.627Gi ±  0%    5.455Gi ±  0%  +50.39% (p=0.000 n=10)
XORBytesAlignment/2048Bytes6Offset-8   3.632Gi ±  0%    5.454Gi ±  0%  +50.14% (p=0.000 n=10)
XORBytesAlignment/2048Bytes7Offset-8   3.626Gi ±  0%    5.453Gi ±  0%  +50.39% (p=0.000 n=10)
geomean                                881.0Mi          1.097Gi        +27.51%

Change-Id: Id7f9d87fe1ea39aa91ea7d3fd1ba20737f0dda3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/649657
Reviewed-by: Julian Zhu <jz531210@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
3 weeks agocmd/compile/internal/reflectdata: fix divide by zero for zero-size array elements
fumiyanokesinn [Sun, 25 Jan 2026 14:59:25 +0000 (23:59 +0900)]
cmd/compile/internal/reflectdata: fix divide by zero for zero-size array elements

When generating equality signatures for arrays with zero-size ASPECIAL
elements (e.g., [3]struct{_ [0]float64}), the compiler crashed with
a divide by zero error when computing the loop unroll factor.

Skip comparison code generation for zero-size elements since they
need no comparison.

Fixes #77303

Change-Id: Ib432cfece22b1cb714de4f0a0b0d1a2d89bb0d33
Reviewed-on: https://go-review.googlesource.com/c/go/+/738841
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
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: Keith Randall <khr@google.com>
3 weeks agodoc/go1.27: document macOS requirements
Dmitri Shuralyov [Mon, 26 Jan 2026 20:31:18 +0000 (15:31 -0500)]
doc/go1.27: document macOS requirements

For #75836.

Change-Id: I07f607178fadbfec95459b2a446f58ae3c5e8932
Reviewed-on: https://go-review.googlesource.com/c/go/+/739380
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
3 weeks agoREADME.vendor: document release cycle considerations
Dmitri Shuralyov [Mon, 26 Jan 2026 17:47:22 +0000 (12:47 -0500)]
README.vendor: document release cycle considerations

Write down a few more things relevant to the process of maintaining
the vendor directory for the std and cmd modules. This includes the
import path of the package containing a tree consistency check, and
some considerations regarding the Go release cycle.

Also mention the updatestd command with enough context so that it's
clear that it is okay to either use it to update everything at once,
or instead update specific modules with individual 'go get' calls,
whichever is a better fit for the task at hand.

For #31806.
For #36905.

Change-Id: I37d391c557d6cf6ebf2751d71ab9c8f7c10d922d
Reviewed-on: https://go-review.googlesource.com/c/go/+/739301
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Alexander <jitsu@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>

3 weeks agocmd/pprof: update vendored github.com/google/pprof
Dmitri Shuralyov [Mon, 26 Jan 2026 16:53:10 +0000 (11:53 -0500)]
cmd/pprof: update vendored github.com/google/pprof

Pull in the latest published version of github.com/google/pprof
as part of the continuous process of keeping Go's dependencies
up to date.

For #36905.

[git-generate]
cd src/cmd
go get github.com/google/pprof@v0.0.0-20260115054156-294ebfa9ad83
go mod tidy
go mod vendor

Change-Id: Ife3c2d40fa9c34e69cdde27b5c7846e499094abf
Reviewed-on: https://go-review.googlesource.com/c/go/+/739300
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>

3 weeks agointernal/reflectlite: remove unused code
khr@golang.org [Thu, 23 Oct 2025 16:40:22 +0000 (09:40 -0700)]
internal/reflectlite: remove unused code

Change-Id: I87ae45657a9bae85b0fbf52692f15552a2987847
Reviewed-on: https://go-review.googlesource.com/c/go/+/738941
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 weeks agocmd/compile: reduce lock/scheduler contention
Daniel Morsing [Mon, 1 Dec 2025 09:40:16 +0000 (09:40 +0000)]
cmd/compile: reduce lock/scheduler contention

During the parallel section of compilation, we limit the amount of
parallelism to prevent scheduler churn. We do this with a worker
scheduler, but it does not have insight on when a compilation is blocked
due to lock contention.

The symbol table was protected with a lock. While most lookups were
quick lock->read->unlock affairs, sometimes there would be
initialization logic involved. This caused every lookup to stall,
waiting for init. Since our worker scheduler couldn't see this, it would
not launch new goroutine to "cover" the gap.

Fix by splitting the symbol lock into 2 cases, initialization and
lookup. If symbols need initialization simultaneously, they will wait
for each other, but the common case of looking up a symbol will be
handled by a syncmap. In practice, I have yet to see this lock being
blocked on.

Additionally, get rid of the scheduler goroutine and have each
compilation goroutine grab work from a central queue. When multiple
compilations finished at the same time, the work scheduler would
sometime not get run immediately. This ended up starving the system of
work.

These 2 changes together cuts -1.37% off the build time of typescriptgo
on systems with a lot of cores (specifically, the c3h88 perf builder).

Updates #73044.

Change-Id: I6d4b3be56fd00a4fdd4df132bcbd52e4b2a3e91f
Reviewed-on: https://go-review.googlesource.com/c/go/+/724623
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>

3 weeks agogo/scanner: clear all fields after Scanner reuse
Mateusz Poliwczak [Fri, 23 Jan 2026 08:52:03 +0000 (09:52 +0100)]
go/scanner: clear all fields after Scanner reuse

We were missing s.nlPos = token.NoPos in Init, but while we are here
let's make it less likely to hit this it in future.

Change-Id: Ief4c0ba2cf97bc556d901eabc8e172406a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/738680
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
3 weeks agocmd/compile: simplify AlgType usage
Keith Randall [Fri, 5 Dec 2025 22:52:37 +0000 (14:52 -0800)]
cmd/compile: simplify AlgType usage

Only walk needs to distinguish different sizes of AMEM. Move
the size-distinguishing AlgType there.

Change-Id: I0a725b5bd13795a623b3668325f1068579abd340
Reviewed-on: https://go-review.googlesource.com/c/go/+/727461
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 weeks agocmd/compile: simplify array parsing in equality signatures
Keith Randall [Fri, 5 Dec 2025 22:45:38 +0000 (14:45 -0800)]
cmd/compile: simplify array parsing in equality signatures

Change-Id: I166586a1f75165cd17df371f9af7cd5b6b3ddc32
Reviewed-on: https://go-review.googlesource.com/c/go/+/727502
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
3 weeks agocmd/compile: clean up eq and hash implementations
Keith Randall [Fri, 5 Dec 2025 22:20:00 +0000 (14:20 -0800)]
cmd/compile: clean up eq and hash implementations

Use unsafe.Pointer instead of *any as the argument type.
Now that we're using signatures, we don't have exact types so we
might as well use unsafe.Pointer everywhere.

Simplify hash function choice a bit.

Change-Id: If1a07091031c4b966fde3a1d66295a04fd5a838c
Reviewed-on: https://go-review.googlesource.com/c/go/+/727501
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
3 weeks agocmd/compile: use equality signatures in hash function generation
Keith Randall [Fri, 5 Dec 2025 01:27:02 +0000 (17:27 -0800)]
cmd/compile: use equality signatures in hash function generation

There aren't a huge number of generated hash functions, so this probably
won't save a whole lot of memory. But it means we can clean up a bunch
of code by basing equality and hashing on the same underlying infrastructure.

Change-Id: I36ed1e49044fecb33120d8736f1c0403a4a2554e
Reviewed-on: https://go-review.googlesource.com/c/go/+/727500
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 weeks agocmd/compile: reorg equality functions a bit
Keith Randall [Mon, 1 Dec 2025 23:58:57 +0000 (15:58 -0800)]
cmd/compile: reorg equality functions a bit

Use signature for closure name instead of type.
Use signature instead of type to decide to use a runtime builtin comparator.
Remove trailing skips from signatures.

Change-Id: I73b2dcd3c6e2f1b2857985e14c24b290941b3ca3
Reviewed-on: https://go-review.googlesource.com/c/go/+/725604
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: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
3 weeks agocmd/compile: redo how equality functions are generated
khr@golang.org [Sat, 29 Nov 2025 01:17:24 +0000 (20:17 -0500)]
cmd/compile: redo how equality functions are generated

Instead of generating an equality function for each type that
needs it, generate one per "signature". A "signature" is a
summary of the comparisons needed to check a type for equality.

For instance, the type

type S struct {
    i int32
    j uint32
    s string
    e error
}

Will have the signature "M8SI".

M8 = 8 bytes of regular memory
S = string
I = nonempty interface

This way, potentially many types that have the same signature
can share the same equality function.

The number of generated equality functions in the go binary
is reduced from 634 to 286. The go binary is ~1% smaller.

The generation of equality functions gets simpler (particularly, how
we do inlining of sub-types, unrolling, etc.) and the generated code
is probably a bit more efficient.

The new function names are kind of weird, but will seldom show up
for users. They will appear in cpu profiles, and in tracebacks in the
situation where comparisons panic because an interface somewhere in
the type being compared contains an uncomparable type (e.g. a slice).

Note that this CL only affects generated comparison functions. It does
not generally affect generated code for == (except when that code decides
to call a comparison function as a subtask). Maybe a TODO for the future.

Update #6853

Change-Id: I202bd6424cb6bf7c745a62c9603d4f01dc1a1fc8
Reviewed-on: https://go-review.googlesource.com/c/go/+/725380
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
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: Keith Randall <khr@google.com>
3 weeks agoencoding/json: fix typo in package doc.
David Symonds [Thu, 22 Jan 2026 00:25:18 +0000 (11:25 +1100)]
encoding/json: fix typo in package doc.

Change-Id: Id5520757e4d73e56e533e4de4f5f303105c4339e
Reviewed-on: https://go-review.googlesource.com/c/go/+/738180
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: David Symonds <dsymonds@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: David Symonds <dsymonds@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 weeks agocmd/compile: fix loopvar version detection with line directives
xieyuschen [Wed, 21 Jan 2026 06:57:14 +0000 (14:57 +0800)]
cmd/compile: fix loopvar version detection with line directives

The Go loop variable semantics changed in Go 1.22: loop variables are now
created per-iteration instead of per-loop. The compiler decides which
semantics to use based on the Go version in go.mod.

When go.mod specifies go 1.21 and the code is built with a Go 1.22+
compiler, the per-loop(compatible behavior) semantics should be used.

However, when a line directive is present in the source file,
go.mod 1.21 and go1.22+ compiler outputs a per-iteration semantics.

For example, the file below wants output 333 but got 012.

    -- go.mod --
    module test
    go 1.21
    -- main.go --
    //line main.go:1
    func main() {
            var fns []func()
            for i := 0; i < 3; i++ {
                    fns = append(fns, func() { fmt.Print(i) })
            }
            for _, fn := range fns {
                    fn()
            }
    }

The distinctVars function uses stmt.Pos().Base() to look up the file
version in FileVersions. Base() returns the file name after line
directives are applied (e.g., "main.go" for "//line main.go:1"), not
the actual source file path. This causes the version lookup to fail
for files with line directives.

This CL fixes the bug by using stmt.Pos().FileBase() instead. FileBase()
returns the actual file path before line directives are applied, ensuring
the correct version information is retrieved from the original source file.

Fixes: #77248
Change-Id: Idacc0816d112ee393089262468a02acfe40e4b72
Reviewed-on: https://go-review.googlesource.com/c/go/+/737820
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
3 weeks agoruntime: speed up cheaprand and cheaprand64
Gavin Lam [Fri, 23 Jan 2026 03:44:50 +0000 (03:44 +0000)]
runtime: speed up cheaprand and cheaprand64

The current cheaprand performs 128-bit multiplication on 64-bit numbers
and truncate the result to 32 bits, which is inefficient.

A 32-bit specific implementation is more performant because it performs
64-bit multiplication on 32-bit numbers instead.

The current cheaprand64 involves two cheaprand calls.
Implementing it as 64-bit wyrand is significantly faster.

Since cheaprand64 discards one bit, I have preserved this behavior.
The underlying uint64 function is made available as cheaprandu64.

               │    old      │                new           │
               │   sec/op    │   sec/op     vs base         │
Cheaprand-8      1.358n ± 0%   1.218n ± 0%  -10.31% (n=100)
Cheaprand64-8    2.424n ± 0%   1.391n ± 0%  -42.62% (n=100)
Blocksampled-8   8.347n ± 0%   2.022n ± 0%  -75.78% (n=100)

Fixes #77149

Change-Id: Ib0b5da4a642cd34d0401b03c1d343041f8230d11
GitHub-Last-Rev: 549d8d407e2bbcaecdee0b52cbf3a513dda637fb
GitHub-Pull-Request: golang/go#77150
Reviewed-on: https://go-review.googlesource.com/c/go/+/735480
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
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>

3 weeks agocmd/compile: on amd64 use 32bits copies for 64bits copies of 32bits values
Jorropo [Sat, 20 Dec 2025 13:11:35 +0000 (14:11 +0100)]
cmd/compile: on amd64 use 32bits copies for 64bits copies of 32bits values

Fixes #76449

This saves a single byte for the REX prefix per OpCopy it triggers on.

Change-Id: I1eab364d07354555ba2f23ffd2f9c522d4a04bd0
Reviewed-on: https://go-review.googlesource.com/c/go/+/731640
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 weeks agocmd/compile: cleanup noLimit in prove
Jorropo [Sun, 7 Dec 2025 03:08:28 +0000 (04:08 +0100)]
cmd/compile: cleanup noLimit in prove

- make it immutable
- calculate it rather than using hardcoded value
  (it all is inlined and constant folded away into noLimit's callers)

Change-Id: Ica12442df4d03e99123e62c0fe561c1078e35d75
Reviewed-on: https://go-review.googlesource.com/c/go/+/727181
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
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>

3 weeks agocmd/compile: improve PopCount's limits modeling and add bruteforce tests
Jorropo [Sun, 7 Dec 2025 02:19:47 +0000 (03:19 +0100)]
cmd/compile: improve PopCount's limits modeling and add bruteforce tests

This make PopCount perfect within the limitations limits can represent.

Change-Id: Ia52e5d79064ad8109117f009c5390a6eba8ccd98
Reviewed-on: https://go-review.googlesource.com/c/go/+/727782
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
3 weeks agocmd/compile: add limits bruteforce tests for bitlen
Jorropo [Sun, 7 Dec 2025 02:07:46 +0000 (03:07 +0100)]
cmd/compile: add limits bruteforce tests for bitlen

This ensure BitLen is perfect within the limitations limits can represent.

Change-Id: I5c1770b4a9f6408fd68fe77b4ef2b2cdd52e26cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/727781
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
3 weeks agocmd/compile: improve Ctz's limits modeling and add bruteforce tests
Jorropo [Sun, 7 Dec 2025 02:01:17 +0000 (03:01 +0100)]
cmd/compile: improve Ctz's limits modeling and add bruteforce tests

This make Ctz perfect within the limitations limits can represent.

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

3 weeks agocmd/compile: cleanup isUnsignedPowerOfTwo
Jorropo [Thu, 4 Dec 2025 05:46:19 +0000 (06:46 +0100)]
cmd/compile: cleanup isUnsignedPowerOfTwo

Merge the signed and unsigned generic functions.
The only implementation difference between the two is:
n > 0 vs n != 0 check.

For unsigned numbers n > 0 == n != 0 and we infact optimize
the first to the second.

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

3 weeks agonet: fix some ineffectual assignments reported by ineffassign
Lin Lin [Sat, 6 Dec 2025 01:35:22 +0000 (01:35 +0000)]
net: fix some ineffectual assignments reported by ineffassign

Updates #35136

Change-Id: I5422a50dde51c0a57f135c83f4963053285a9bc2
GitHub-Last-Rev: 6db1a88da60fce3e4fd6697d5db75d55d53b2b49
GitHub-Pull-Request: golang/go#76704
Reviewed-on: https://go-review.googlesource.com/c/go/+/727080
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
3 weeks agoall: update vendored dependencies
Nicholas S. Husin [Fri, 23 Jan 2026 03:48:46 +0000 (22:48 -0500)]
all: update vendored dependencies

This CL does the following:

1. Bundles up golang.org/x/net/internal/httpsfv since h2_bundle.go now
relies on it.
2. Modifies h2_bundle.go import mapping to account for httpsfv package.
3. Updates all vendored dependencies using
golang.org/x/build/cmd/updatestd.

For #75500

Change-Id: Ia2f41ad606092fe20b62f946266190502b146977
Reviewed-on: https://go-review.googlesource.com/c/go/+/738621
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 weeks agointernal/buildcfg: disable sizespecializedmalloc by default
Michael Anthony Knyszek [Fri, 23 Jan 2026 16:38:50 +0000 (16:38 +0000)]
internal/buildcfg: disable sizespecializedmalloc by default

We're finding some regressions in overall icache footprint at scale and
we should figure out how to deal with those before rolling this out to
everybody.

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

3 weeks agocmd/compile: fix typos in types2 api_test.go
goto1134 [Wed, 10 Dec 2025 17:52:23 +0000 (17:52 +0000)]
cmd/compile: fix typos in types2 api_test.go

Change-Id: Ifee1b0f590ebb6671efd61a289c8884a225f5d6b
GitHub-Last-Rev: 175ae95847b0108949459b881c2cd2144e74353e
GitHub-Pull-Request: golang/go#76782
Reviewed-on: https://go-review.googlesource.com/c/go/+/728980
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
3 weeks agocmd/go/internal/vcs: support git worktrees
Josh Bleecher Snyder [Wed, 14 Jan 2026 00:45:30 +0000 (16:45 -0800)]
cmd/go/internal/vcs: support git worktrees

Fixes golang/go#58218

Change-Id: Ia155b26514557cf822caf37e727e5a410b0a36a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/736260
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 weeks agogo/types, types: flip field/method selection logic inside out (cleanup)
Robert Griesemer [Wed, 21 Jan 2026 23:11:13 +0000 (15:11 -0800)]
go/types, types: flip field/method selection logic inside out (cleanup)

By selecting on *Var/*Func first, the field/method selection logic
becomes a bit cleaner, clearer, and a little bit simpler.

No functional changes.

Change-Id: I9860f98d52779b0f7ce4484ea77e74a3667d9e6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/738080
Reviewed-by: Alan Donovan <adonovan@google.com>
Commit-Queue: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>

3 weeks agocmd/compile: avoid extending when already sufficiently shifted on loong64
Xiaolin Zhao [Mon, 1 Dec 2025 06:46:23 +0000 (14:46 +0800)]
cmd/compile: avoid extending when already sufficiently shifted on loong64

This reduces 744 instructions from the go toolchain binary on loong64.

file         before      after      Δ       %
asm          599282      599222   -60    -0.0100%
cgo          513606      513534   -72    -0.0140%
compile      2939250     2939146  -104   -0.0035%
cover        564136      564056   -80    -0.0142%
fix          895622      895546   -76    -0.0085%
link         759460      759376   -84    -0.0111%
preprofile   264960      264916   -44    -0.0166%
vet          869964      869888   -76    -0.0087%
go           1712990     1712890  -100   -0.0058%
gofmt        346416      346368   -48    -0.0139%
total        9465686     9464942  -744   -0.0079%

Change-Id: I32dfa7506d0458ca0b6de83b030c330cd2b82176
Reviewed-on: https://go-review.googlesource.com/c/go/+/725720
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
3 weeks agomath/pow10: remove overlapping boundary (n=0)
mohanson [Mon, 15 Dec 2025 07:06:48 +0000 (15:06 +0800)]
math/pow10: remove overlapping boundary (n=0)

Both the first and second conditions include n=0, creating an
implicit logic that relies on order of evaluation.

Change-Id: Iefbc25a676242fabf272203a3e845363585bff56
Reviewed-on: https://go-review.googlesource.com/c/go/+/730060
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>

3 weeks agocmd/compile/internal/pgo: error parsing profile (for pgo) after scaling
Ryan Diep [Fri, 28 Nov 2025 08:27:09 +0000 (03:27 -0500)]
cmd/compile/internal/pgo: error parsing profile (for pgo) after scaling

If a valid profile is scaled such that the samples/counts become 0,
an empty graph in which the compiler complain that we never saw a start line
since the graph has no nodes which is a misleading error message.

src/cmd/internal/pgo/pprof.go was modified to check if the graph is empty
return an empty profile.

GitHub-Pull-Request: golang/go#73640
Change-Id: If3f7ab8af6fcf77b2e29ae1df154f87bee377ab0
Reviewed-on: https://go-review.googlesource.com/c/go/+/725120
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>

3 weeks agoruntime: remove logical stack sentinel for runtime lock stacks
Nick Ripley [Tue, 2 Dec 2025 19:46:39 +0000 (19:46 +0000)]
runtime: remove logical stack sentinel for runtime lock stacks

When CL 533258 added frame pointer support for the block and mutex
profiles, it deferred skipping/inline expansion, similar to the
execution tracer. The first frame indicated whether this expansion was
needed by holding either the number of frames to skip (implying inline
expansion) or the logicalStackSentinel placeholder to indicate that no
extra handling is needed. However, CL 598515 switched to doing the
skipping/inline expansion at sample time. After this, the sentinel value
is unused. This CL removes the sentinel from runtime lock profiling,
correcting an oversight from that CL. This didn't cause any problems
since post-processing would just ignore the bogus sentinel value; this
is just a cleanup.

Change-Id: Idbec11f57ac7a57426cd8a064782c4fe6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/726040
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
3 weeks agomath: use shared signMask constant
mohanson [Tue, 23 Dec 2025 02:44:51 +0000 (10:44 +0800)]
math: use shared signMask constant

In abs.go and copysign.go, magic numbers and local constants are
used for the sign bit mask (1 << 63), even though a shared constant
signMask already exists in bits.go.

Change-Id: Ic3aeb9b52674538443cbe074acfeb373a3c74a8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/732060
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
3 weeks agoruntime: remove unused mutexevent linkname
Nick Ripley [Tue, 13 Jan 2026 21:29:52 +0000 (16:29 -0500)]
runtime: remove unused mutexevent linkname

CL 29650 added a sync.event linkname for mutexevent, but that does not
appear to have ever been used. This linkname isn't in the "hall of
shame", so we can just remove it.

Change-Id: I778b53ca089b5afda6c6074be9e43e3a6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/736220
Reviewed-by: 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>
3 weeks agocmd/link: put type descriptors in .go.type section
Ian Lance Taylor [Mon, 24 Nov 2025 04:47:50 +0000 (20:47 -0800)]
cmd/link: put type descriptors in .go.type section

This change rewrites and simplifies the relro handling.
We eliminate the separate relro SymKind values and the complex
shifting of symbol kinds. Instead, we put the possible relro data
into their own sections, and make those sections relro when appropriate.

We put type descriptors and their associated data into a
new .go.type section. As part of this we change the runtime.etypes
symbol to be the end of the new section, rather than the end of
rodata as it was before.

We put function descriptors into a new .go.func section.

Ordinary rodata relro stays in the .data.rel.ro section.

We stop making the typelink section relro, as it only contains
offsets and never has dynamic relocations.

We drop the typerel:* and go:funcdescrel symbols.

For #76038

Change-Id: I7aab7cfad3f2623ff06c09a70b756fe1e43f4169
Reviewed-on: https://go-review.googlesource.com/c/go/+/723580
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

3 weeks agogo/types, types2: remove support for gotypesalias GODEBUG flag
Robert Griesemer [Thu, 15 Jan 2026 00:10:00 +0000 (16:10 -0800)]
go/types, types2: remove support for gotypesalias GODEBUG flag

For #76472.

Change-Id: Ia51b41639637b1de916625e73c26f625382be305
Reviewed-on: https://go-review.googlesource.com/c/go/+/736441
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Commit-Queue: Robert Griesemer <gri@google.com>

3 weeks agocmd/compile: ensure ops have the expected argument widths
Keith Randall [Thu, 18 Dec 2025 20:29:39 +0000 (12:29 -0800)]
cmd/compile: ensure ops have the expected argument widths

The generic SSA representation uses explicit extension and
truncation operations to change widths of values. The map
intrinsics were playing somewhat fast and loose with this
requirement. Fix that, and add a check to make sure we
don't regress.

I don't think there is a triggerable bug here, but I ran into
this with some prove pass modifications, where
cmd/compile/internal/ssa/prove.go:isCleanExt (and/or its uses)
is actually wrong when this invariant is not maintained.

Change-Id: Idb7be6e691e2dbf6d7af6584641c3227c5c64bf5
Reviewed-on: https://go-review.googlesource.com/c/go/+/731300
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
3 weeks agocmd/compile: optimize small constant-sized MemEq
Alexander Musman [Sun, 13 Jul 2025 08:09:58 +0000 (11:09 +0300)]
cmd/compile: optimize small constant-sized MemEq

Add optimization patterns for MemEq with small constant sizes
(3-32 bytes). These patterns help to avoid runtime calls for
small sizes.

For sizes 3-16, combine two chunks loading and comparison.
For sizes 17-32, combine a 16-byte comparison with the remaining bytes.
This change may increase binary size slightly due to inline expansion,
but improves performance for code with many small memequals,
e.g. DecodehealingTracker benchmark on arm64:

shortname: minio
pkg: github.com/minio/minio/cmd
                               │  Orig.res   │              Uexp.res              │
                               │   sec/op    │   sec/op     vs base               │
DecodehealingTracker-4           842.5n ± 1%   794.0n ± 3%  -5.75% (p=0.000 n=10)
AppendMsgResyncTargetsInfo-4     8.472n ± 0%   8.472n ± 0%       ~ (p=0.582 n=10)
DataUpdateTracker-4              2.856µ ± 2%   2.804µ ± 3%       ~ (p=0.210 n=10)
MarshalMsgdataUsageCacheInfo-4   131.2n ± 1%   131.6n ± 2%       ~ (p=0.494 n=10)
geomean                          227.4n        223.2n       -1.86%

                             │   Orig.res   │              Uexp.res               │
                             │     B/s      │     B/s       vs base               │
DecodehealingTracker-4         352.0Mi ± 1%   373.5Mi ± 3%  +6.10% (p=0.000 n=10)
AppendMsgResyncTargetsInfo-4   1.099Gi ± 0%   1.099Gi ± 0%       ~ (p=0.183 n=10)
DataUpdateTracker-4            341.8Ki ± 3%   351.6Ki ± 3%       ~ (p=0.286 n=10)
geomean                        50.95Mi        52.46Mi       +2.96%

Change-Id: If3d7e7395656d5f36e3ab303a71044293d17bc3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/688195
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
3 weeks agoencoding/json: remove unneeded unsafe import
khr@golang.org [Tue, 23 Dec 2025 15:41:47 +0000 (09:41 -0600)]
encoding/json: remove unneeded unsafe import

Followon for CL 721160.

Change-Id: I9c22c5e99c9084e24047c77d20717c5b46165cde
Reviewed-on: https://go-review.googlesource.com/c/go/+/732220
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 weeks agonet/http: Add Server.DisableClientPriority field
Nicholas S. Husin [Thu, 22 Jan 2026 21:29:18 +0000 (16:29 -0500)]
net/http: Add Server.DisableClientPriority field

The DisableClientPriority field is currently still a no-op, and will
only take effect once golang.org/x/net is bundled up into h2_bundle.go
again.

For #75500

Change-Id: I9e2135bed50b7f201aea93467e3f5f5f6c81cb1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/738620
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
3 weeks agoall: update to Unicode 17
Russ Cox [Sat, 17 Jan 2026 14:55:10 +0000 (09:55 -0500)]
all: update to Unicode 17

Process:
- Disable unicode TestProperties.
- Run UNICODE_VERSION=17.0.0 go -C ../src/golang.org/x/text generate
- Run go generate strconv
- Update unicode TestProperties by hand to add missing test cases.

This will break x/text using the main repo until the corresponding
x/text CL is submitted. It should not break anything else.

For #77266.

Change-Id: Ia3ffb5a81e212b991714eef70eebfca98a0c8aab
Reviewed-on: https://go-review.googlesource.com/c/go/+/737420
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Bypass: Russ Cox <rsc@golang.org>

3 weeks agosyscall: document Sendfile semantics
Bill Morgan [Sun, 18 Jan 2026 14:11:05 +0000 (14:11 +0000)]
syscall: document Sendfile semantics

syscall.Sendfile behavior differs significantly between operating
systems.

Document the platform-specific behavior for the offset argument and
partial write reporting on Linux versus BSD-derived systems.

Fixes #64044

Change-Id: I93f740c3e2df911a10bf0884ffab218d4bb4e5fc
GitHub-Last-Rev: a11b898bb98f2a136caaba875033f1c155c1c872
GitHub-Pull-Request: golang/go#77224
Reviewed-on: https://go-review.googlesource.com/c/go/+/737122
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 weeks agodebug/elf: return FormatError when reading short files
Mark F [Thu, 15 Jan 2026 12:19:10 +0000 (13:19 +0100)]
debug/elf: return FormatError when reading short files

NewFile returns the raw error from ReadAt when failing to read the
ELF identifier, typically io.EOF for empty or short files. This breaks
the API contract that all parsing failures should return *FormatError.

Wrap the error in FormatError for consistency with other error paths.

Fixes #76338

Change-Id: Ic4ed77316fcc459ce8cbe9e9506d7cf8e9286623
Reviewed-on: https://go-review.googlesource.com/c/go/+/736600
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

3 weeks agosimd/archsimd/_gen/simdgen: fix typos in error messages
jjpinto [Sat, 27 Dec 2025 14:09:40 +0000 (14:09 +0000)]
simd/archsimd/_gen/simdgen: fix typos in error messages

simdgen: fix typos in error messages

Change-Id: I921eea63c4847b2af43a1d5a1ea075e86f58aa77
GitHub-Last-Rev: 8c9dae51fd906aee04f52a5d44c6d4c923fc52d0
GitHub-Pull-Request: golang/go#77012
Reviewed-on: https://go-review.googlesource.com/c/go/+/732880
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
3 weeks agotest: use lower-case error message in heapsampling.go
jjpinto [Fri, 26 Dec 2025 14:48:24 +0000 (14:48 +0000)]
test: use lower-case error message in heapsampling.go

According to Go style guidelines, error strings should not be capitalized.

Change-Id: Iacfb3f5192b7be40da99b6b7e4801f1ae1169efc
GitHub-Last-Rev: 440396e0946edb18c422442ea235b5c57c2899af
GitHub-Pull-Request: golang/go#76999
Reviewed-on: https://go-review.googlesource.com/c/go/+/732760
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
3 weeks agocmd/compile: speedup large init function compile time
Cuong Manh Le [Wed, 21 Jan 2026 11:11:29 +0000 (18:11 +0700)]
cmd/compile: speedup large init function compile time

Fixes #77153

Change-Id: Ia3906e4d686281be78b65daf7a7a4fd1b2b2483d
Reviewed-on: https://go-review.googlesource.com/c/go/+/737880
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>

3 weeks agointernal/runtime: remove math.Mul64
Gavin Lam [Thu, 15 Jan 2026 04:22:13 +0000 (04:22 +0000)]
internal/runtime: remove math.Mul64

internal/runtime/math.Mul64 is a copy of math/bits.Mul64 and redundant.

Change-Id: I4dd2ab531a32da97839c6b45cf90df6430811967
GitHub-Last-Rev: 1a73e16049ee346ccfa8f052856e49e10e202d70
GitHub-Pull-Request: golang/go#77187
Reviewed-on: https://go-review.googlesource.com/c/go/+/736500
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
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>

3 weeks agosyscall: return early on error in Recvmsg
Tobias Klauser [Sat, 10 Jan 2026 14:56:01 +0000 (15:56 +0100)]
syscall: return early on error in Recvmsg

Currently, Recvmsg may access the rsa buffer even if the underlying syscall
returns an error.

Following the same change done for x/sys/unix.Recvmsg in CL 734740.

For golang/go#76848

Change-Id: I2a145d822442a2033a76f4717317a39010b17bd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/735121
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
3 weeks agocmd/compile: allow Bswap{64,32,16} on loong64
Guoqi Chen [Wed, 21 Jan 2026 09:32:49 +0000 (17:32 +0800)]
cmd/compile: allow Bswap{64,32,16} on loong64

On Loong64, Bswap{64,32,16} has been implemented with REVB{2H, 2W,V} instruction

Change-Id: Ia7f40ef3b1a85bfb0b20563098cb792b00cec498
Reviewed-on: https://go-review.googlesource.com/c/go/+/737841
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
3 weeks agocmd/go/internal/vcs: use 0o for octal
Josh Bleecher Snyder [Thu, 8 Jan 2026 22:50:45 +0000 (14:50 -0800)]
cmd/go/internal/vcs: use 0o for octal

Change-Id: I011cd7e1c2c614e2c5c4a0fadf062ac9be2266aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/736440
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 weeks agocmd/cgo: add test for sanitizing smuggled doc comment code
Neal Patel [Thu, 15 Jan 2026 18:14:32 +0000 (13:14 -0500)]
cmd/cgo: add test for sanitizing smuggled doc comment code

Updates #76697

Change-Id: If24eec2bc2f8bfd903a4cc8f5499e77ea2f255c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/736780
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 weeks agostrings: use bytealg.LastIndexRabinKarp on strings.LastIndex
jiahua wang [Thu, 2 Nov 2023 03:51:46 +0000 (11:51 +0800)]
strings: use bytealg.LastIndexRabinKarp on strings.LastIndex

Change-Id: I7eae15bf0b4d556763e1754e17031c880035d69c
Reviewed-on: https://go-review.googlesource.com/c/go/+/538737
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
3 weeks agonet/http: use math/rand/v2 instead of math/rand
1911860538 [Mon, 24 Nov 2025 12:17:25 +0000 (12:17 +0000)]
net/http: use math/rand/v2 instead of math/rand

math/rand/v2 provides a more modern, performant, and secure random number API.

Change-Id: Ic0c30ae40623508e3ed65c435be3c208704b5655
GitHub-Last-Rev: a8fa520b39cb5cc56042b74f6c40163bf8115247
GitHub-Pull-Request: golang/go#76433
Reviewed-on: https://go-review.googlesource.com/c/go/+/723680
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
3 weeks agoruntime: guard unexpected return pc gp.m dereference
Michael Pratt [Wed, 3 Dec 2025 20:42:03 +0000 (15:42 -0500)]
runtime: guard unexpected return pc gp.m dereference

If stack scanning reaches here while scanning a waiting goroutine, gp.m
will be nil. We are going to crash anyway because the stack is corrupt,
but we still want to reach the print below for context rather than dying
with a SIGSEGV here.

For #64030.

Change-Id: I6a6a636c378669dc45972e1eb8e06401a0fed223
Reviewed-on: https://go-review.googlesource.com/c/go/+/726522
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>
3 weeks agocmd/compile: reserve less memory for bitvectors
Keith Randall [Wed, 14 Jan 2026 17:33:10 +0000 (09:33 -0800)]
cmd/compile: reserve less memory for bitvectors

We only need 4 per block, not 7. That's almost 50% savings.

Update #77170

Change-Id: I6229a1137e7a03769e30bd4081078817de9a4f84
Reviewed-on: https://go-review.googlesource.com/c/go/+/736340
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Keith Randall <khr@golang.org>

3 weeks agoencoding/json/v2: remove issue reference in Duration formatting error
Joe Tsai [Fri, 9 Jan 2026 01:27:59 +0000 (17:27 -0800)]
encoding/json/v2: remove issue reference in Duration formatting error

The json/v2 working group decided to commit to no default representation
for time.Duration for the foreseeable future.
Thus, we can remove the issue reference in the error message.

If JavaScript (TC39) formally adopts the Temporal.Duration type,
which uses ISO 8601 as the JSON representation for a duration,
we may consider changing the default.

Switching from no default to some default in the future
is generally a compatible change.

Updates #71631

Change-Id: I6f71a0fa97dcefba56aab0c0ddf445d9d38f6e58
Reviewed-on: https://go-review.googlesource.com/c/go/+/735080
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 weeks agocmd/compile: remove unnecessary code in keepAliveAt
Cuong Manh Le [Wed, 21 Jan 2026 08:20:27 +0000 (15:20 +0700)]
cmd/compile: remove unnecessary code in keepAliveAt

TypeWord and SrcRType are only needed for interface expression
conversion. Since CL 725180, the kept alive nodes are passed directly to
runtime.KeepAlive, so there's no interface conversion anymore.

Change-Id: I37ad8016bf76a1bf8ba36efea043fc71341b33c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/737840
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
3 weeks agocmd/compile: fix mis-compilation for static array initialization
Cuong Manh Le [Wed, 21 Jan 2026 07:39:20 +0000 (14:39 +0700)]
cmd/compile: fix mis-compilation for static array initialization

The bug was first introduced when the compiler is still written in C,
with CL 2254041. The static array was laid out with the wrong context,
causing a stack pointer will be stored in global object.

Fixes #61730
Fixes #77193

Change-Id: I22c8393314d251beb53db537043a63714c84f36a
Reviewed-on: https://go-review.googlesource.com/c/go/+/737821
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>

3 weeks agocmd/compile: refactor preserveStmt
Cuong Manh Le [Wed, 10 Dec 2025 16:16:24 +0000 (23:16 +0700)]
cmd/compile: refactor preserveStmt

By breaking it into smaller functions with duplicated logic removed.

Change-Id: I710414e8d13d91c19fb4bf4da1a31b00ee88ccee
Reviewed-on: https://go-review.googlesource.com/c/go/+/728961
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>

3 weeks agocmd/compile: better name for BloopWalk
Cuong Manh Le [Wed, 10 Dec 2025 10:46:07 +0000 (17:46 +0700)]
cmd/compile: better name for BloopWalk

Use bloop.Walk instead of BloopWalk for better naming.

Change-Id: I60fb7abf8cdab2c7641c69d1cc06c1d6bef1600b
Reviewed-on: https://go-review.googlesource.com/c/go/+/728960
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
3 weeks agogo/types, types2: better error when selecting field on type rather than value
Robert Griesemer [Wed, 21 Jan 2026 22:40:04 +0000 (14:40 -0800)]
go/types, types2: better error when selecting field on type rather than value

Fixes #6814.

Change-Id: I659670998f8e89400d03d40189e8c54f7e705cdc
Reviewed-on: https://go-review.googlesource.com/c/go/+/738040
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
3 weeks agodoc/next: initialize
Carlos Amedee [Wed, 21 Jan 2026 19:52:52 +0000 (14:52 -0500)]
doc/next: initialize

Initialize the doc/next directory for the next release by copying the
contents of doc/initial into it.

For #76474.

Change-Id: I52c826cf42aa93f1dea8bf8f7f386a77265bf31a
Reviewed-on: https://go-review.googlesource.com/c/go/+/737961
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Carlos Amedee <carlos@golang.org>
TryBot-Bypass: Carlos Amedee <carlos@golang.org>

3 weeks agointernal/goversion: update Version to 1.27
Carlos Amedee [Wed, 21 Jan 2026 19:40:43 +0000 (14:40 -0500)]
internal/goversion: update Version to 1.27

Go 1.27 is in the process of being opened for development (to be
eventually released). This change marks the very beginning of its
development cycle, updating the Version value accordingly.

For #40705.
For #76474.

Change-Id: Id64ac75e6727715c32a842501b4318281dd8998f
Reviewed-on: https://go-review.googlesource.com/c/go/+/737960
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
4 weeks agoruntime: remove the unused scanIdx from mspan
Youlin Feng [Sat, 17 Jan 2026 06:20:22 +0000 (14:20 +0800)]
runtime: remove the unused scanIdx from mspan

After CL 700496, mspan.scanIdx is never used, this CL just remove it.

Change-Id: I41ce9902957c0cfa6fbf26b66a2a7787b179376a
Reviewed-on: https://go-review.googlesource.com/c/go/+/737220
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 weeks agocmd/compile/internal/staticinit: fix bug in global new(expr)
Alan Donovan [Tue, 20 Jan 2026 21:18:59 +0000 (16:18 -0500)]
cmd/compile/internal/staticinit: fix bug in global new(expr)

The StaticInit pass asserts that the operand of &v is a global,
but this is not so for the &autotemp desugaring of new(expr).

(The variable has by that point escaped to the heap, so
the object code calls runtime.newobject. A future optimization
would be to statically allocate the variable when it is safe
and advantageous to do so.)

Thanks to khr for suggesting the fix.

+ static test

Fixes #77237

Change-Id: I71b34a1353fe0f3e297beab9851f8f87d765d8f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/737680
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 weeks agostrconv: don't call internal Atoi twice in Atoi
Daniel Müllner [Mon, 19 Jan 2026 08:18:05 +0000 (09:18 +0100)]
strconv: don't call internal Atoi twice in Atoi

Change-Id: I89a41bbc83fdf473399527a933d57794ce83f68a
Reviewed-on: https://go-review.googlesource.com/c/go/+/737261
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
4 weeks agodoc: fix urlmaxqueryparams typos
Michael Pratt [Fri, 16 Jan 2026 17:20:39 +0000 (12:20 -0500)]
doc: fix urlmaxqueryparams typos

Updates #77101.

Change-Id: I6a6a636cd58e1bd01943066368cb1424db6c6a92
Reviewed-on: https://go-review.googlesource.com/c/go/+/737040
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 weeks agogo/types,cmd/compile/internal/types2: better diagnostic for type shadowing
Alan Donovan [Thu, 18 Dec 2025 17:27:11 +0000 (12:27 -0500)]
go/types,cmd/compile/internal/types2: better diagnostic for type shadowing

This change causes the "x is not a type" diagnostic to describe
x's actual kind, helping to reveal when shadowing is at work.

(The kind description could improve other errors too.)

Fixes #76877

Change-Id: Ia3484998bb384ff570c20b6792cf8461c60aa38c
Reviewed-on: https://go-review.googlesource.com/c/go/+/731180
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>

4 weeks agoarchive/zip: reduce CPU usage in index construction
Damien Neil [Wed, 5 Nov 2025 01:00:33 +0000 (17:00 -0800)]
archive/zip: reduce CPU usage in index construction

Constructing the zip index (which is done once when first opening
a file in an archive) can consume large amounts of CPU when
processing deeply-nested directory paths.

Switch to a less inefficient algorithm.

Thanks to Jakub Ciolek for reporting this issue.

goos: darwin
goarch: arm64
pkg: archive/zip
cpu: Apple M4 Pro
                          │  /tmp/bench.0  │            /tmp/bench.1            │
                          │     sec/op     │   sec/op     vs base               │
ReaderOneDeepDir-14         25983.62m ± 2%   46.01m ± 2%  -99.82% (p=0.000 n=8)
ReaderManyDeepDirs-14          16.221 ± 1%    2.763 ± 6%  -82.96% (p=0.000 n=8)
ReaderManyShallowFiles-14      130.3m ± 1%   128.8m ± 2%   -1.20% (p=0.003 n=8)
geomean                         3.801        253.9m       -93.32%

Fixes #77102
Fixes CVE-2025-61728

Change-Id: I2c9c864be01b2a2769eb67fbab1b250aeb8f6c42
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3060
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Neal Patel <nealpatel@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/736713
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
4 weeks agonet/url: add urlmaxqueryparams GODEBUG to limit the number of query parameters
Damien Neil [Mon, 3 Nov 2025 22:28:47 +0000 (14:28 -0800)]
net/url: add urlmaxqueryparams GODEBUG to limit the number of query parameters

net/url does not currently limit the number of query parameters parsed by
url.ParseQuery or URL.Query.

When parsing a application/x-www-form-urlencoded form,
net/http.Request.ParseForm will parse up to 10 MB of query parameters.
An input consisting of a large number of small, unique parameters can
cause excessive memory consumption.

We now limit the number of query parameters parsed to 10000 by default.
The limit can be adjusted by setting GODEBUG=urlmaxqueryparams=<n>.
Setting urlmaxqueryparams to 0 disables the limit.

Thanks to jub0bs for reporting this issue.

Fixes #77101
Fixes CVE-2025-61726

Change-Id: Iee3374c7ee2d8586dbf158536d3ade424203ff66
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3020
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Neal Patel <nealpatel@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/736712
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 weeks agocmd/go/internal/work: sanitize flags before invoking 'pkg-config'
Neal Patel [Thu, 4 Dec 2025 17:30:39 +0000 (12:30 -0500)]
cmd/go/internal/work: sanitize flags before invoking 'pkg-config'

The addition of CgoPkgConfig allowed execution with flags not
matching the safelist. In order to prevent potential arbitrary
code execution at build time, ensure that flags are validated
prior to invoking the 'pkg-config' binary.

Thank you to RyotaK (https://ryotak.net) of GMO Flatt Security Inc.
for reporting this issue.

Fixes CVE-2025-61731
Fixes #77100

Change-Id: Ic51b41f1f7e697ab98c9c32c6fae35f217f7f364
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3240
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/736711
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 weeks agocmd/go: update VCS commands to use safer flag/argument syntax
Roland Shoemaker [Wed, 10 Dec 2025 13:13:07 +0000 (08:13 -0500)]
cmd/go: update VCS commands to use safer flag/argument syntax

In various situations, the toolchain invokes VCS commands. Some of these
commands take arbitrary input, either provided by users or fetched from
external sources. To prevent potential command injection vulnerabilities
or misinterpretation of arguments as flags, this change updates the VCS
commands to use various techniques to separate flags from positional
arguments, and to directly associate flags with their values.

Additionally, we update the environment variable for Mercurial to use
`HGPLAIN=+strictflags`, which is the more explicit way to disable user
configurations (intended or otherwise) that might interfere with command
execution.

We also now disallow version strings from being prefixed with '-' or
'/', as doing so opens us up to making the same mistake again in the
future. As far as we know there are currently ~0 public modules affected
by this.

While I was working on cmd/go/internal/vcs, I also noticed that a
significant portion of the commands being implemented were dead code.
In order to reduce the maintenance burden and surface area for potential
issues, I removed the dead code for unused commands.

We should probably follow up with a more structured change to make it
harder to accidentally re-introduce these issues in the future, but for
now this addresses the issue at hand.

Thanks to splitline (@splitline) from DEVCORE Research Team for
reporting this issue.

Fixes CVE-2025-68119
Fixes #77099

Change-Id: I9d9f4ee05b95be49fe14edf71a1b8e6c0784378e
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3260
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/736710
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 weeks agocrypto/tls: don't copy auto-rotated session ticket keys in Config.Clone
Roland Shoemaker [Tue, 6 Jan 2026 22:36:01 +0000 (14:36 -0800)]
crypto/tls: don't copy auto-rotated session ticket keys in Config.Clone

Once a tls.Config is used, it is not safe to mutate. We provide the
Clone method in order to allow users to copy and modify a Config that
is in use.

If Config.SessionTicketKey is not populated, and if
Config.SetSessionTicketKeys has not been called, we automatically
populate and rotate session ticket keys. Clone was previously copying
these keys into the new Config, meaning that two Configs could share
the same auto-rotated session ticket keys. This could allow sessions to
be resumed across different Configs, which may have completely different
configurations.

This change updates Clone to not copy the auto-rotated session ticket
keys.

Additionally, when resuming a session, check that not just that the leaf
certificate is unexpired, but that the entire certificate chain is still
unexpired.

Fixes #77113
Fixes CVE-2025-68121

Change-Id: I011df7329de83068d11b3f0c793763692d018a98
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3300
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/736709
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 weeks agosort: improve comment readability for Stable function
Prateik Lohani [Thu, 15 Jan 2026 08:05:23 +0000 (08:05 +0000)]
sort: improve comment readability for Stable function

Change-Id: I3bc9f906f85e2b5f3d4ba6484e3c125065e36b57
GitHub-Last-Rev: 5d637c132533691d5a56fd00845bdb1d349642a3
GitHub-Pull-Request: golang/go#77190
Reviewed-on: https://go-review.googlesource.com/c/go/+/736501
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
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>
5 weeks agocrypto/internal/fips140test: add ML-DSA to FIPS 140-3 functional tests
Filippo Valsorda [Fri, 19 Dec 2025 22:14:05 +0000 (23:14 +0100)]
crypto/internal/fips140test: add ML-DSA to FIPS 140-3 functional tests

Change-Id: I568d28d27d2bc55bbadcc678a2fcf9d36a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/731540
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 weeks agosimd/archsimd: 128- and 256-bit FMA operations do not require AVX-512
Austin Clements [Tue, 13 Jan 2026 19:18:14 +0000 (14:18 -0500)]
simd/archsimd: 128- and 256-bit FMA operations do not require AVX-512

Currently, all FMA operations are marked as requiring AVX512, even on
smaller vector widths. This is happening because the narrower FMA
operations are marked as extension "FMA" in the XED. Since this
extension doesn't start with "AVX", we filter them out very early in
the XED process. However, this is just a quirk of naming: the FMA
feature depends on the AVX feature, so it is part of AVX, even if it
doesn't say so on the tin.

Fix this by accepting the FMA extension and adding FMA to the table of
CPU features. We also tweak internal/cpu slightly do it correctly
enforces that the logical FMA feature depends on both the FMA and AVX
CPUID flags.

This actually *deletes* a lot of generated code because we no longer
need the AVX-512 encoding of these 128- and 256-bit operations.

Change-Id: I744a18d0be888f536ac034fe88b110347622be7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/736160
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/736201
Reviewed-by: Austin Clements <austin@google.com>
5 weeks agosimd/archsimd/_gen/simdgen: feature implications
Austin Clements [Tue, 13 Jan 2026 14:34:53 +0000 (09:34 -0500)]
simd/archsimd/_gen/simdgen: feature implications

This simplifies our handling of XED features, adds a table of which
features imply which other features, and adds this information to the
documentation of the CPU features APIs.

As part of this we fix an issue around the "AVXAES" feature. AVXAES is
defined as the combination of the AVX and AES CPUID flags. Several
other features also work like this, but have hand-written logic in
internal/cpu to compute logical feature flags from the underlying
CPUID bits. For these, we expose a single feature check function from
the SIMD API.

AVXAES currently doesn't work like this: it requires the user to check
both features. However, this forces the SIMD API to expose an "AES"
feature check, which really has nothing to do with SIMD. To make this
consistent, we introduce an AVXAES feature check function and use it
in feature requirement docs. Unlike the others combo features, this is
implemented in the simd package, but the difference is invisible to
the user.

Change-Id: I2985ebd361f0ecd45fd428903efe4c981a5ec65d
Reviewed-on: https://go-review.googlesource.com/c/go/+/736100
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/736200
Reviewed-by: Austin Clements <austin@google.com>
5 weeks agoruntime: rename mallocTiny* to mallocgcTinySize*
Michael Matloob [Mon, 12 Jan 2026 19:37:39 +0000 (14:37 -0500)]
runtime: rename mallocTiny* to mallocgcTinySize*

This makes it easier to identify which functions are used for memory
allocation by looking for functions that start with mallocgc. The Size
suffix is added so that the isSpecializedMalloc function in
cmd/compile/internal/ssa can distinguish between the generated functions
and the mallocgcTiny function called by mallocgc, similar to the SC
suffixes for the mallocgcSmallNoScanSC* and mallocgcSmallScanNoHeaderSC*
functons.

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

5 weeks agoall: fix misspellings in comments
cuishuang [Wed, 7 Jan 2026 05:46:43 +0000 (13:46 +0800)]
all: fix misspellings in comments

Change-Id: I121847e7f68c602dd8e9ecddfc41b547f8a86f10
Reviewed-on: https://go-review.googlesource.com/c/go/+/734361
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>