]> git.feebdaed.xyz Git - 0xmirror/go.git/log
0xmirror/go.git
26 hours agotest/codegen: tidy tests for bits master
Joel Sing [Tue, 23 Dec 2025 12:43:15 +0000 (23:43 +1100)]
test/codegen: tidy tests for bits

Use Go idiomatic function names, use a common prefix, attempt to
maintain some consistency, avoid naming functions based upon
machine specific instructions and combine a duplicate test that
likely exists due to this confusion.

Change-Id: I996e9efd7497821edef94c1997d4a310d9d79a71
Reviewed-on: https://go-review.googlesource.com/c/go/+/732200
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Joel Sing <joel@sing.id.au>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
3 days agosimd/archsimd: fix "go generate" command
Cherry Mui [Tue, 23 Dec 2025 16:31:36 +0000 (11:31 -0500)]
simd/archsimd: fix "go generate" command

Correct the generate command for test helpers. There is no longer
a genfiles.go. Also correct the generated file headers to match
the current generator layout.

Change-Id: Ifb9a8c394477359020ff44290dbaabe7a2d59aca
Reviewed-on: https://go-review.googlesource.com/c/go/+/732280
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: David Chase <drchase@google.com>

3 days agosimd/archsimd: guard test helpers with amd64 tag
Cherry Mui [Tue, 23 Dec 2025 18:25:36 +0000 (13:25 -0500)]
simd/archsimd: guard test helpers with amd64 tag

The test helpers load vectors. Currently the load functions are
only available on AMD64, so guard them with the tag. Now

GOEXPERIMENT=simd go test simd/...

doesn't fail on a non-AMD64 machine.

Change-Id: Ie75f1fbb3b91629bc477b3140630bc47a4ef5b63
Reviewed-on: https://go-review.googlesource.com/c/go/+/732380
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
3 days agobytes: improve consistency in split test messages
jjpinto [Tue, 23 Dec 2025 18:11:53 +0000 (18:11 +0000)]
bytes: improve consistency in split test messages

This change improves consistency in the error messages used by TestSplit and TestSplitAfter in bytes_test.go

Change-Id: Idc4e77a516037ce17cbb1bdffe3ac00bcde5de42
GitHub-Last-Rev: 8c4a35186851004251e8eee71c88ca1c822851c1
GitHub-Pull-Request: golang/go#76970
Reviewed-on: https://go-review.googlesource.com/c/go/+/732300
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>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>

3 days agocmd/go: update pkgsite doc command to v0.0.0-20251223195805-1a3bd3c788fe
Michael Matloob [Tue, 23 Dec 2025 20:45:41 +0000 (15:45 -0500)]
cmd/go: update pkgsite doc command to v0.0.0-20251223195805-1a3bd3c788fe

This pulls in a version of the pkgsite doc command that includes CL
729900 which adds support for showing documentation for some of our
experiments

Change-Id: I52aebf06521adc114aa90f99f515f2746a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/732400
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
3 days agotime: skip test that will fail with GO111MODULE=off
Kevin Burke [Tue, 23 Dec 2025 06:07:32 +0000 (22:07 -0800)]
time: skip test that will fail with GO111MODULE=off

The test is designed to ensure that behavior introduced in Go 1.23
to garbage collect async timed channels is working correctly. If
GO111MODULE=off is set (or GODEBUG=asynctimerchan=1) Go reverts to the
Go 1.20 behavior of not garbage collecting these channels, which fails
the test.

Instead of running a test in conditions where we know it will fail,
just skip the test. A more comprehensive test does not make sense
right now because this code may go away soon.

Fixes #76948.

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

3 days agoruntime: improve a log message in TestCleanupLost
Lin Lin [Sat, 20 Dec 2025 15:46:30 +0000 (23:46 +0800)]
runtime: improve a log message in TestCleanupLost

Updates #76929

Change-Id: I3951b14ec979b389773f782a0a89f8277c7b9a59
Reviewed-on: https://go-review.googlesource.com/c/go/+/731680
Reviewed-by: Austin Clements <austin@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>

3 days agoruntime: fix nGsyscallNoP accounting
Michael Anthony Knyszek [Tue, 23 Dec 2025 17:16:17 +0000 (17:16 +0000)]
runtime: fix nGsyscallNoP accounting

CL 726964 has two bugs.

One is fairly obvious. Where there was previous a decrement of
nGsyscallNoP in exitsyscallTryGetP, it added a call to addGSyscallNoP.
Oops.

The other is more subtle. In needm we set isExtraInC to false very
early. This will cause exitsyscall (via cgocallbackg) to decrement
nGsyscallNoP when the thread never had a corresponding increment. (It
could not have, otherwise it would not have called needm, on Linux
anyway.) The fix is simple: increment nGsyscallNoP. CL 726964 actually
removed this increment erroneously. I'm pretty sure I removed it because
the first bug was the real issue, and removing this increment "fixed it"
in the context of the test. I was right that this case was subtle, but
wrong about how.

Fixes #76435.

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

3 days agotest/codegen: codify bit related code generation for riscv64
Joel Sing [Tue, 23 Dec 2025 10:06:49 +0000 (21:06 +1100)]
test/codegen: codify bit related code generation for riscv64

Change-Id: Iba4d3ded15d578e97a978780069e70a51a5e944b
Reviewed-on: https://go-review.googlesource.com/c/go/+/732180
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Joel Sing <joel@sing.id.au>

4 days agoerrors: add a test verifying join does not flatten errors
Damien Neil [Tue, 23 Dec 2025 17:42:37 +0000 (09:42 -0800)]
errors: add a test verifying join does not flatten errors

For #76961

Change-Id: Ib81f3202074bf83a5b204b32706445f051f837a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/732360
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 days agocmd/asm/internal/asm: run riscv64 end-to-end tests for each profile
Joel Sing [Sun, 21 Dec 2025 03:48:18 +0000 (14:48 +1100)]
cmd/asm/internal/asm: run riscv64 end-to-end tests for each profile

Currently, the end-to-end tests are only run for the profile set
via GORISCV64. Run each of the end-to-end tests for each profile,
increasing test coverage. Also rename tests to be RISCV64 specific,
rather than RISCV.

Change-Id: I15a70939064122c79ec5f2edcda1fa2a47c8cc95
Reviewed-on: https://go-review.googlesource.com/c/go/+/731921
Auto-Submit: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
4 days agocmd/asm/internal/asm: abort end to end test if assembly failed
Joel Sing [Sun, 21 Dec 2025 03:39:20 +0000 (14:39 +1100)]
cmd/asm/internal/asm: abort end to end test if assembly failed

If errors are encountered during assembly, do not attempt to perform verification.
In this case the output is unlikely to be correct and all verification fails, which
means the real issue gets lost in the noise.

Change-Id: I62c1bf09fa025b0df4c06f0bfa424fb5d328184b
Reviewed-on: https://go-review.googlesource.com/c/go/+/731920
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 days agoRevert "errors: optimize errors.Join for single unwrappable errors"
Damien Neil [Tue, 23 Dec 2025 00:35:42 +0000 (16:35 -0800)]
Revert "errors: optimize errors.Join for single unwrappable errors"

This reverts CL 635115.

Reason for revert: The new behavior does not match the function documentation.

Fixes #76961

Change-Id: If2450aa4efba28c7a12887a5b306c231a836e740
Reviewed-on: https://go-review.googlesource.com/c/go/+/731981
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
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 days agocmd/compile: handle propagating an out-of-range jump table index
Cuong Manh Le [Mon, 22 Dec 2025 11:49:17 +0000 (18:49 +0700)]
cmd/compile: handle propagating an out-of-range jump table index

For an out-of-range jump table index, the constant facts should not be
propagated to the destinations.

Fixes #76950

Change-Id: Iff29814cb466c7aaa432cec212e5387665c45afc
Reviewed-on: https://go-review.googlesource.com/c/go/+/731860
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 days agodebug/pe: avoid panic in File.ImportedSymbols
Alex Brainman [Tue, 24 Jun 2025 05:18:28 +0000 (15:18 +1000)]
debug/pe: avoid panic in File.ImportedSymbols

This change skips symbols where dt.OriginalFirstThunk is less than
ds.VirtualAddress.

The variable types are uint32, and
(dt.OriginalFirstThunk-ds.VirtualAddress) becomes very large number when
dt.OriginalFirstThunk < ds.VirtualAddress.

Fixes #73548.
Fixes #76721.
Fixes #76724.

Change-Id: I72908bd0896003423aeb754fa0b6c72d452cdb4e
Reviewed-on: https://go-review.googlesource.com/c/go/+/684495
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 days agoruntime: revert entry point on freebsd/arm64
Rob Nichols [Mon, 22 Dec 2025 21:25:08 +0000 (21:25 +0000)]
runtime: revert entry point on freebsd/arm64

CL 706175 unified some arm64 entry points. However, the entry point for
freebsd/arm64 is incorrect and builds now fail. This change reverts the
freebsd/arm64 entry point and adds additional context for the future.

Fixes #76958

Change-Id: Ib9e9b7844706f7b0ef54bd449411fefc8f10bc43
GitHub-Last-Rev: 70064d8126f8ff7e2c0e5e8d4b00177c627f4d76
GitHub-Pull-Request: golang/go#76959
Reviewed-on: https://go-review.googlesource.com/c/go/+/731980
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: 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>

4 days agosimd/archsimd: correct documentation for pairwise operations
Cherry Mui [Mon, 22 Dec 2025 19:52:57 +0000 (14:52 -0500)]
simd/archsimd: correct documentation for pairwise operations

For Add/SubPairs(Saturated?), the documented result element order
is wrong. Corrected.

Also, for 256-bit vectors, this is a grouped operation. So name it
with the Grouped suffix to be clear.

Change-Id: Idfd0975cb4a332b2e28c898613861205d26f75b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/732020
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
5 days agoos/exec: second call to Cmd.Start is always an error
Alan Donovan [Tue, 9 Dec 2025 15:06:23 +0000 (10:06 -0500)]
os/exec: second call to Cmd.Start is always an error

Previously it would return an error only if the first call
resulted in process creation, contra the intent of the
comment at exec.Cmd:

// A Cmd cannot be reused after calling its [Cmd.Start], [Cmd.Run],
// [Cmd.Output], or [Cmd.CombinedOutput] methods.

Also, clear the Cmd.goroutines slice in case of failure to
start a process, so that the closures can be GC'd and their
pipe fds finalized and closed.

Fixes #76746

Change-Id: Ic63a4dced0aa52c2d4be7d44f6dcfc84ee22282c
Reviewed-on: https://go-review.googlesource.com/c/go/+/728642
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
7 days agosimd/archsimd: add HasAVX2() guards to tests that need them
David Chase [Fri, 19 Dec 2025 20:50:57 +0000 (15:50 -0500)]
simd/archsimd: add HasAVX2() guards to tests that need them

This may not be complete, because some 256-bit float operations
may be implemented with integer simd instead (in some cases there
is no float op).  (And some tests may have just been overlooked.)

Fixes #76866.

Change-Id: I90b1dfe039c322c484af916436fc6f6c50a31030
Reviewed-on: https://go-review.googlesource.com/c/go/+/731502
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 days agosimd/archsimd: delete DotProductQuadruple methods for now
Cherry Mui [Fri, 19 Dec 2025 22:05:03 +0000 (17:05 -0500)]
simd/archsimd: delete DotProductQuadruple methods for now

The DotProductQuadruple methods are currently defined on Int8
vectors. There are some problems for that.

1. We defined a DotProductQuadrupleSaturated method, but the dot
product part does not need saturation, as it cannot overflow. It
is the addition part of VPDPBUSDS that does the saturation.
Currently we have optimization rules like

x.DotProductQuadrupleSaturated(y).Add(z) -> VPDPBUSDS

which is incorrect, in that the dot product doesn't do (or need)
saturation, and the Add is a regular Add, but we rewrite it to a
saturated add. The correct rule should be something like

x.DotProductQuadruple(y).AddSaturated(z) -> VPDPBUSDS

2. There are multiple flavors of DotProductQuadruple:
signed/unsigned × signed/unsigned, which cannot be completely
disambiguated by the type. The current naming may preclude adding
all the flavors.

For these reasons, remove the methods for now. We can add them
later with the issues addressed.

Change-Id: I549c0925afaa68c7e2cc956105619f2c1b46b325
Reviewed-on: https://go-review.googlesource.com/c/go/+/731441
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
7 days agosimd/archsimd: add Grouped for 256- and 512-bit SaturateTo(U)Int16Concat, and fix...
Cherry Mui [Fri, 19 Dec 2025 20:21:15 +0000 (15:21 -0500)]
simd/archsimd: add Grouped for 256- and 512-bit SaturateTo(U)Int16Concat, and fix type

They operate on 128-bit groups, so name them Grouped to be clear,
and consistent with other grouped operations. Reword the
documentation, mention the grouping only for grouped versions.

Also, SaturateToUnt16Concat(Grouped) is a signed int32 to unsigned
uint16 saturated conversion. The receiver and the parameter should
be signed. The result remains unsigned.

Change-Id: I30e28bc05e07f5c28214c9c6d9d201cbbb183468
Reviewed-on: https://go-review.googlesource.com/c/go/+/731501
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 days agosimd/archsimd: correct type and instruction for SaturateToUint8
Cherry Mui [Fri, 19 Dec 2025 19:48:59 +0000 (14:48 -0500)]
simd/archsimd: correct type and instruction for SaturateToUint8

It should be defined on unsigned types, not signed types, and use
unsigned conversion instructions.

Change-Id: I49694ccdf1d331cfde88591531c358d9886e83e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/731500
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
7 days agogo/doc: link to struct fields in the same package
Sean Liao [Sun, 14 Dec 2025 18:48:51 +0000 (18:48 +0000)]
go/doc: link to struct fields in the same package

This collects up any struct direct field references
for linking. It does not attempt to do any validation
of embedded field conflicts as in CL 510315.

For #61394

Change-Id: I57dc0a0e8a71ce0bcb4e6c0963f459f76a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/729980
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
8 days agocmd/go/internal/doc: update pkgsite version
matloob [Fri, 19 Dec 2025 18:00:33 +0000 (13:00 -0500)]
cmd/go/internal/doc: update pkgsite version

Fixes #76827
For #36905

Change-Id: I3f855a75efc9272105f0a352c54600cd6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/731460
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
8 days agosimd/archsimd: reword documentation for some operations
Cherry Mui [Wed, 17 Dec 2025 16:20:25 +0000 (11:20 -0500)]
simd/archsimd: reword documentation for some operations

- Min/Max: make it clear it is elementwise.
- RoundToEven: clarify it is rounding tie to even.
- MulEvenWiden: use mathematical form of the index.
- CopySign: use parameter names directly.
- ConcatShiftBytesRight: rename the parameter.

Change-Id: I4cf0773c4daf3e3bf7b26e79d84ac5c2a9145c88
Reviewed-on: https://go-review.googlesource.com/c/go/+/731421
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 days agosimd/archsimd: reword documentation of comparison operations
Cherry Mui [Thu, 18 Dec 2025 04:21:00 +0000 (23:21 -0500)]
simd/archsimd: reword documentation of comparison operations

The wording for the emulated ones are more precise. Use that
everywhere.

Change-Id: Iab64e0bb1fb6b19178ebf30ba8e82360b5882fd3
Reviewed-on: https://go-review.googlesource.com/c/go/+/731420
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 days agointernal/cpu: repair VNNI feature check
David Chase [Thu, 18 Dec 2025 18:18:14 +0000 (13:18 -0500)]
internal/cpu: repair VNNI feature check

This is a pain to test.
Also the original test was never executed, because it was wrong.

It looks like processors that might lack this features
include Intel 11th generation and AMD Zen 4.  These might
or might not have bit 2 set in the 7th cpuid "leaf" (SM4)
which is what the incorrect test was checking; the bug
is triggered by ^VNNI & SM4.  Apparently the SM4 bit is
not usually set, else we would have seen a test failure.

The "Lion Cove" microarchitecture (Arrow Lake, Lunar Lake)
appears to trigger this problem, it's not clear if there are
others.  It was hard to verify this from online information.

Fixes #76881.

Change-Id: I21be6b4f47134d81e89799b0f06f89fcb6563264
Reviewed-on: https://go-review.googlesource.com/c/go/+/731240
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
9 days agosimd/archsimd: reword documentation for conversion ops
Cherry Mui [Wed, 17 Dec 2025 19:32:55 +0000 (14:32 -0500)]
simd/archsimd: reword documentation for conversion ops

Use more compact wording for extension, truncation, and
saturation. Say that we pack the results to the low elements and
zero the high elements if and only if the result has more elements.

Change-Id: Iae98d3c6ea6b5b5fa0acd548471e8d6c70a26d2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/730940
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
9 days agosimd/archsimd: reword documentation of shfit operations
Cherry Mui [Wed, 17 Dec 2025 16:00:36 +0000 (11:00 -0500)]
simd/archsimd: reword documentation of shfit operations

Say the name of the parameter, instead of "the immediate".

Don't say "Emptied bits are zeroed", which is implied by the shift
operation in Go (and perhaps many other languages). For right
shifts, say signed or unsigned shifts instead.

Change-Id: I29c9c0e218bfaeef55b03d92d44762e34f006654
Reviewed-on: https://go-review.googlesource.com/c/go/+/730720
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

9 days agoruntime: keep track of secret allocation size
Daniel Morsing [Tue, 16 Dec 2025 13:50:57 +0000 (13:50 +0000)]
runtime: keep track of secret allocation size

During a naive attempt to test the new runtime/secret package, I tried
wrapping the entire handshake in a secret.Do call. This lead to a panic
because some of the allocator logic had been previously untested.

freeSpecial takes p and size, but they can be misleading. They don't
refer to the pointer and size of the object with the special attached,
but a pointer to the enclosing object and the size of the span element.

The previous code did not take this into account and when passing the
size to memclr would overwrite nearby objects.

Fix by storing the size of the object being cleared inside the special.

Fixes #76865.

Change-Id: Ifae31f1c8d0609a562a37f37c45aec2f369dc6a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/730361
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>
9 days agocmd/go: remove reference to no longer existing -i flag
matloob [Wed, 17 Dec 2025 16:30:52 +0000 (11:30 -0500)]
cmd/go: remove reference to no longer existing -i flag

The flag was removed in CL 416094.

Fixes #76850

Change-Id: Ia219b4d2d8391f08487b4ff1bbec43766a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/730721
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
10 days agocrypto: rename fips140v2.0 to fips140v1.26
Filippo Valsorda [Wed, 17 Dec 2025 16:50:07 +0000 (17:50 +0100)]
crypto: rename fips140v2.0 to fips140v1.26

Turns out we can't use non-v1 versions for the FIPS 140-3 module, so we
decided to match the versioning of the Go release the module is frozen
from.

Change-Id: Ib5c13511a51f9930fcde86cd7e8bd39c6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/730740
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
10 days agosimd/archsimd: reword documentation of As methods
Cherry Mui [Wed, 17 Dec 2025 04:14:43 +0000 (23:14 -0500)]
simd/archsimd: reword documentation of As methods

Change-Id: Ifd6d3e5386383908435dd622e280edb6aa13fdab
Reviewed-on: https://go-review.googlesource.com/c/go/+/730660
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
10 days agoruntime/secret: warn users about allocations, loosen guarantees
Daniel Morsing [Wed, 10 Dec 2025 10:13:05 +0000 (10:13 +0000)]
runtime/secret: warn users about allocations, loosen guarantees

The discussion at #76477 warranted some stronger documentation about
what is expected from users of the secret package. In addition, #76764
presented a problem about when a user can expect their secrets to be
deleted.

Fix by loosening the guarantee to when all allocations from within a
secret function have been deemed unreachable. Provide some guidance for
users to steer them away from situations where allocations live on for
long after the secret function has finished executing

Fixes #76764.
Updates #76477.

Change-Id: I0cef3e7275737f32ec48f71355e588b3be26ea32
Reviewed-on: https://go-review.googlesource.com/c/go/+/728921
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
10 days agocmd/cgo: don't emit C local if it is not used
Ian Lance Taylor [Wed, 17 Dec 2025 00:00:36 +0000 (16:00 -0800)]
cmd/cgo: don't emit C local if it is not used

Fixes #76861

Change-Id: Icc8452e48ed736e8240f8afea18637c33b8e3ef8
Reviewed-on: https://go-review.googlesource.com/c/go/+/730600
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Joe Richey <joerichey@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

10 days agocrypto/internal/fips140only: test fips140=only mode
Filippo Valsorda [Sat, 28 Dec 2024 21:32:59 +0000 (22:32 +0100)]
crypto/internal/fips140only: test fips140=only mode

Fixes #70514
Updates #70878

Change-Id: I6a6a46561d872c8f7e9ea333ff208064b0bd44c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/728506
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
10 days agogo/doc: exclude examples with results
Sean Liao [Sun, 14 Dec 2025 20:02:33 +0000 (20:02 +0000)]
go/doc: exclude examples with results

Fixes #36185

Change-Id: I7634744e62e00023367ed48a4700b61a6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/729902
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
10 days agocrypto/tls: reject trailing messages after client/server hello
Roland Shoemaker [Mon, 24 Nov 2025 22:03:10 +0000 (14:03 -0800)]
crypto/tls: reject trailing messages after client/server hello

For TLS 1.3, after procesesing the server/client hello, if there isn't a
CCS message, reject the trailing messages which were appended to the
hello messages. This prevents an on-path attacker from injecting
plaintext messages into the handshake.

Additionally, check that we don't have any buffered messages before we
switch the read traffic secret regardless, since any buffered messages
would have been under an old key which is no longer appropriate.

We also invert the ordering of setting the read/write secrets so that if
we fail when changing the read secret we send the alert using the
correct write secret.

Fixes #76443
Fixes CVE-2025-61730

Change-Id: If6ba8ad16f48d5cd5db5574824062ad4244a5b52
Reviewed-on: https://go-review.googlesource.com/c/go/+/724120
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Coia Prant <coiaprant@gmail.com>
11 days agocmd/compile: use unsigned constant when folding loads for SIMD ops with constants
Cherry Mui [Tue, 16 Dec 2025 16:16:47 +0000 (11:16 -0500)]
cmd/compile: use unsigned constant when folding loads for SIMD ops with constants

When folding loads into a SIMD op with a constant, in the SSA
rules we use makeValAndOff to create an AuxInt for the constant
and the offset. For the SIMD ops of concern (for now), the
constants are always unsigned. So pass the constant unsigned.

Fixes #76756.

Change-Id: Ia5910e689ff510ce54d3a0c2ed0e950bc54f8862
Reviewed-on: https://go-review.googlesource.com/c/go/+/730420
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

11 days agocmd/dist: preserve existing GOEXPERIMENTs when running tests with additional experiments
qmuntal [Tue, 16 Dec 2025 10:08:35 +0000 (11:08 +0100)]
cmd/dist: preserve existing GOEXPERIMENTs when running tests with additional experiments

Some tests require enabling specific Go experiments via the GOEXPERIMENT
, like "jsonv2", "runtimesecret", or "simd".

When running these tests, we should preserve any existing GOEXPERIMENT
settings, so that multiple experiments can be tested together.

I've found this limitation while working in my own Go fork, where in
some situations I pass additional experiments to the tests that alter
the Go runtime and other core packages.

Change-Id: Ib0324cd93282f6993611dea2f0c57d00ab304a33
Reviewed-on: https://go-review.googlesource.com/c/go/+/730360
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
11 days agocmd/link: set canUsePlugins only on platforms that support plugin
Cherry Mui [Mon, 15 Dec 2025 20:36:23 +0000 (15:36 -0500)]
cmd/link: set canUsePlugins only on platforms that support plugin

If a program imports the plugin package, but the plugin build mode
is not supported on the platform, it still cannot use plugin. Don't
treat it like so.

Updates #76815.

Change-Id: I0fd719427d7c3cc96a94ce1f92d6e4457da92a90
Reviewed-on: https://go-review.googlesource.com/c/go/+/730164
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

11 days agocmd/link: don't create __x86.get_pc_thunk symbol if it already exists
Cherry Mui [Mon, 15 Dec 2025 18:45:28 +0000 (13:45 -0500)]
cmd/link: don't create __x86.get_pc_thunk symbol if it already exists

On 386, in some build modes we need to create the __x86.get_pc_thunk
symbols, to support PC-relative addressing. In some situation
the thunk symbols may already exist, e.g. loaded from a C object
in internal linking mode. In this case, we should use the exiting
symbol instead of making a new one. The current code updates the
symbol content in place but also adds a duplicated entry to Textp,
which breaks the address sorting order.

Fixes #76815.

Change-Id: Iab11106ce592dc5219b7a0e07cfafcd270661a2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/730161
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

12 days agotext/template: fix slice builtin for pointers to arrays
Nathan Nguyen [Fri, 5 Dec 2025 20:50:24 +0000 (15:50 -0500)]
text/template: fix slice builtin for pointers to arrays

The slice function now properly handles pointers to arrays by calling
indirect() to dereference pointers, matching the behavior of the index
function.

Fixes #39596

Change-Id: Id4920edbfd8fd3df3a181b59a61733f88b0f104d
Reviewed-on: https://go-review.googlesource.com/c/go/+/727400
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
12 days agoarchive/tar, compress/bzip2: base64 some troublesome testdata files
Ian Lance Taylor [Fri, 12 Dec 2025 22:18:13 +0000 (14:18 -0800)]
archive/tar, compress/bzip2: base64 some troublesome testdata files

This avoids complaints from scanners that look for and open
tar and bz2 files, and complain if they look weird.
In this case, they do look weird, because they are intentionally strange.
This kind of thing shouldn't be necessary, but we already have the machinery
to do it so it's easy enough.

Fixes #76799

Change-Id: Ib302b3aef30108a1325f91fcb2d166f8e1863792
Reviewed-on: https://go-review.googlesource.com/c/go/+/729780
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
12 days agocmd/go: show comparable in go doc interface output
Nathan Nguyen [Fri, 5 Dec 2025 08:25:33 +0000 (03:25 -0500)]
cmd/go: show comparable in go doc interface output

The go doc command now displays the comparable constraint when embedded
in an interface, matching the existing behavior for the error type.

Previously, when an interface embedded comparable, it was not shown in
the documentation and incorrectly triggered the "Has unexported methods"
message even when no unexported methods existed.

Fixes #76125

Change-Id: Idaae07fcb1dfc79b1fae374f9fc68df0052ff38e
Reviewed-on: https://go-review.googlesource.com/c/go/+/727100
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

2 weeks agosimd/archsimd: skip tests if AVX is not available
Cherry Mui [Sat, 13 Dec 2025 03:33:57 +0000 (22:33 -0500)]
simd/archsimd: skip tests if AVX is not available

The simd operations require AVX. If AVX is not available, skip the
tests.

Change-Id: I3c384ba07e1e6c2c198dfb27bc84a2e27f825680
Reviewed-on: https://go-review.googlesource.com/c/go/+/729820
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2 weeks agocmd/dist: test GOEXPERIMENT=simd on AMD64
Cherry Mui [Fri, 12 Dec 2025 18:31:45 +0000 (13:31 -0500)]
cmd/dist: test GOEXPERIMENT=simd on AMD64

Change-Id: Iaf8bb811cd8c674c801d8e068fcc753e889ac672
Reviewed-on: https://go-review.googlesource.com/c/go/+/729721
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2 weeks agoruntime, cmd/link: tighten search for stackObjectRecord
Ian Lance Taylor [Wed, 10 Dec 2025 02:56:45 +0000 (18:56 -0800)]
runtime, cmd/link: tighten search for stackObjectRecord

A stackObjectRecord should always be in funcdata, between gofunc
and the end of pclntab, except for the special case of
methodValueCallFrameObjs, which should always be in noptrbss.
Adjust the two loops that look for the moduledata corresponding
to a stackObjectRecord to search more precisely, rather than
relying on datap.end.

Closely based on a patch by Michael Stapelberg.

For #76038

Change-Id: I751801d8fd030af751825a67905b2a343280e7d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/728840
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 weeks agoruntime/secret: restore goroutine behavior to proposal
Daniel Morsing [Wed, 10 Dec 2025 10:07:56 +0000 (10:07 +0000)]
runtime/secret: restore goroutine behavior to proposal

During review of CL 704615, a suggestion was made that spawning a
goroutine inside a call to secret.Do result in a panic. I agreed with
this at the time, but had missed that this had been extensively
discussed on the proposal. Revert the behavior back to what was agreed
upon.

Change-Id: Ifaa9e24bd03ecbd870ae2217137d1a9527c96842
Reviewed-on: https://go-review.googlesource.com/c/go/+/728920
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2 weeks agoruntime: dropg after emitting trace event in preemptPark
Michael Anthony Knyszek [Thu, 11 Dec 2025 19:23:19 +0000 (19:23 +0000)]
runtime: dropg after emitting trace event in preemptPark

Because we dropg before emitting a trace event in preemptPark, we end up
failing to emit a status for the goroutine if this happens to be the
first event for it in the generation. We only really see this with
multiple subscribers in TestSubscribers.

This is for two reasons:
1. If we are missing a status event for a non-initial generation then
   the trace parser won't validate that (an oversight, but we can only
   enforce that for new traces because of this bug), and
2. If we're starting the tracer fresh, then we have a STW which
   effectively guarantees that the first event for a goroutine cannot
   come from preemptPark.

Therefore, we cannot observe this situation unless the first generation
manifests the bug, but prior to having flight recording and/or multiple
subscribers being able to "cut" the trace data at any point, this was
impossible.

The fix is simple: dropg only after emitting the trace event. This is
also safe, because the tracer doesn't care. The tracer will also start
taking a stack trace of the goroutine in this circumstance, but that is
also safe, since we are able to generally unwind the stack of
asynchronously preempted goroutines, and here we're at the very, very
end of asynchronous preemption where all the state to do so is already
set up.

Fixes #75665.

Change-Id: I7ee1142697d0a53b62d4c5647aa53775d2f6976a
Reviewed-on: https://go-review.googlesource.com/c/go/+/729400
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 weeks agoruntime/pprof: deflake TestGoroutineLeakProfileConcurrency
Michael Anthony Knyszek [Thu, 11 Dec 2025 17:19:19 +0000 (17:19 +0000)]
runtime/pprof: deflake TestGoroutineLeakProfileConcurrency

Issue #76540 reports failures in this test from the leaked goroutine
count being too small. The test makes an effort to wait for the
goroutines to leak, but there's no guarantee.

This change instead changes TestGoroutineLeakProfileConcurrency to wait
for the number of leaked goroutines to reach at least the minimum
expected before proceeding. This deflakes this particular issue.

The downside of this change is that a failure to detect leaked
goroutines due to a bug will lead to a timeout instead of an instant
failure, but this change makes an effort to log and report that it was
waiting for the goroutines to leak and timed out for that reason, so at
least the failure is more obvious.

Overall, this is still better than random flakes.

While we're here, I also make some minor stylistic changes and document
the helper functions a little more. I also noticed that checkFrames was
using the wrong *testing.T, so this change fixes that too.

Fixes #76540.

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

2 weeks agocmd/link: add new linknames to blocked linkname list
Cherry Mui [Fri, 12 Dec 2025 18:00:54 +0000 (13:00 -0500)]
cmd/link: add new linknames to blocked linkname list

Update the blocklist with new linknames added in Go 1.26.

Some goroutine leak profile symbols were manually added but they
did not match the actual symbol names. Corrected.

runtime.freegc is not itself push-linknamed, so there is no need
to explicitly add it to blocklist. Keep the test, to ensure one
cannot linkname-pull freegc.

Change-Id: Ie5fd6bc191e9afa164fa79055cc39e6fa9ed4c7f
Reviewed-on: https://go-review.googlesource.com/c/go/+/729720
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2 weeks agoruntime/secret: guard files with goexperiment
Cherry Mui [Thu, 11 Dec 2025 19:15:08 +0000 (14:15 -0500)]
runtime/secret: guard files with goexperiment

So if the goexperiment is not enabled, we don't expose an empty
package.

Change-Id: I57c1edac92f51b307d789d8d9bb3b505769af589
Reviewed-on: https://go-review.googlesource.com/c/go/+/729361
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2 weeks agogo/doc: reuse import name logic for examples
Sean Liao [Mon, 8 Dec 2025 20:48:09 +0000 (20:48 +0000)]
go/doc: reuse import name logic for examples

Examples resolved imports based on just the path name,
but this doesn't work for go-name or modules on v2+.

Updates #12794
Fixes #45110
Fixes #56740
Fixes #62059

Change-Id: I8c71b1e5311df04bccbdf319d759d3176a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/728280
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2 weeks agocmd/compile: update ABI document for riscv64
Meng Zhuo [Wed, 10 Dec 2025 13:08:01 +0000 (21:08 +0800)]
cmd/compile: update ABI document for riscv64

The duff device has been dropped on riscv64, we can
remove related documentation now.

Change-Id: Iffe5093bde6854bca236e290b91ab9f48d3f8c06
Reviewed-on: https://go-review.googlesource.com/c/go/+/728901
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2 weeks agoruntime: add extra subtest layer to TestFinalizerOrCleanupDeadlock
Michael Anthony Knyszek [Wed, 10 Dec 2025 02:35:15 +0000 (02:35 +0000)]
runtime: add extra subtest layer to TestFinalizerOrCleanupDeadlock

Currently TestFinalizerOrCleanupDeadlock runs a bunch of tests for both
cleanups and finalizers. However, it doesn't actually distinguish these
two cases in the subtest names. This change adds another layer of
subtest to distinguish them.

For #76523.

Change-Id: I18c2857e970cde43c18cbbcbc44e4d4ada3b2628
Reviewed-on: https://go-review.googlesource.com/c/go/+/728821
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>

2 weeks agoRevert "database/sql: allow drivers to override Scan behavior"
Austin Clements [Thu, 11 Dec 2025 18:55:33 +0000 (13:55 -0500)]
Revert "database/sql: allow drivers to override Scan behavior"

This reverts CL 588435.

This new API is difficult to use correctly, and in many cases cannot
be used efficiently. We're going to work on this problem a bit more.

The release notes are removed by CL 729340, since they were moved to
the x/website repository since the original CL was made.

Reopens #67546.

Change-Id: I2a2bd25f2fce5f02e4d28cd33a9cc651bf35ab50
Reviewed-on: https://go-review.googlesource.com/c/go/+/729360
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
2 weeks agoruntime/trace: fix broken TestSubscribers
Michael Anthony Knyszek [Thu, 11 Dec 2025 18:02:36 +0000 (18:02 +0000)]
runtime/trace: fix broken TestSubscribers

Currently we don't break out of the loop on a failure. This is
leading to timeouts trying to parse a broken trace over and over,
forever.

But there's another issue where when we try to dump the trace, we pass
only the unread portion of the bytes.Buffer.

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

2 weeks agocmd/go: set GOOS in vet_asm test
Alan Donovan [Thu, 11 Dec 2025 14:45:33 +0000 (09:45 -0500)]
cmd/go: set GOOS in vet_asm test

Not every OS (e.g. aix) supports ARCH=amd64.

Fixes #76792

Change-Id: Id92cd247f1e36574192a6079990c686f9ab55910
Reviewed-on: https://go-review.googlesource.com/c/go/+/729220
Commit-Queue: Alan Donovan <adonovan@google.com>
TryBot-Bypass: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Alan Donovan <adonovan@google.com>

2 weeks agogo/types, types2: remove indirection of Named.finite
Mark Freeman [Wed, 10 Dec 2025 19:13:00 +0000 (14:13 -0500)]
go/types, types2: remove indirection of Named.finite

This field is now guarded by a state bit. The "unknown" state is hence
indicated by absence of that bit.

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

2 weeks agoencoding/json/jsontext: add symbolic Kind constants
Damien Neil [Mon, 8 Dec 2025 22:22:12 +0000 (14:22 -0800)]
encoding/json/jsontext: add symbolic Kind constants

Add constants for each possible Kind value (KindNull, KindTrue, etc.).
Leave the values unchanged ('n', 't', etc.).
Update documentation to reference the symbols.

Fixes #71756

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

2 weeks agojson/jsontext: normalize all invalid Kinds to 0
Damien Neil [Mon, 8 Dec 2025 21:54:15 +0000 (13:54 -0800)]
json/jsontext: normalize all invalid Kinds to 0

For #75431

Change-Id: Iafefe952d3c1837e2f4c8c24cae96945d9e5abbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/728380
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2 weeks agoencoding/json: report true from v2 Decoder.More when an error is pending
Damien Neil [Mon, 8 Dec 2025 21:09:05 +0000 (13:09 -0800)]
encoding/json: report true from v2 Decoder.More when an error is pending

Historically, Decoder.More reports true when the next read will
return an error. Adjust the v2 Decoder to follow this behavior.

Fixes #76467

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

2 weeks agolib/time: update to 2025c/2025c
Dmitri Shuralyov [Thu, 11 Dec 2025 16:03:35 +0000 (11:03 -0500)]
lib/time: update to 2025c/2025c

Commit generated by update.bash.

For #22487.

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

2 weeks agoruntime: prevent calls to GOMAXPROCS while clearing P trace state
Michael Anthony Knyszek [Thu, 11 Dec 2025 02:51:27 +0000 (02:51 +0000)]
runtime: prevent calls to GOMAXPROCS while clearing P trace state

Currently, between the forEachP that ensures every P has a status in the
trace and readying dead Ps for the next generation, there's a big window
where GOMAXPROCS could run and change the number of Ps. In such
circumstances, P state will not get properly prepared for the next
generation, and we may fail to emit a status for a P.

This change addresses the problem by holding worldsema across both
operations. It also moves the status emission and state clearing to
before the generation transition because that makes the code *much*
clearer.

Currently we do both these things after the generation transition
targeting the next-next generation. The reason for this is to avoid an
extra forEachP (because we already handle P status in the STW for
enabling tracing to begin with) but approach is just plain harder to
reason about. Preparing the next generation before transitioning to it,
like we do for goroutines, is much clearer. Furthermore, we also need to
set up the dead P state even if we're stopping the trace, which would
mean duplicating code into both branches (if stopping the trace, then we
go non-preemptible, otherwise we do it under worldsema) which is also
less clear.

Note that with this change we no longer need to emit the P statuses
during the STW, which was probably the worse choice anyway, since
holding up the STW for an O(P) operation is worse than a forEachP we're
going to do anyway. So, this change does away with that too.

Fixes #76572.

Change-Id: Ie7908adff43a8a372cae432bcc2f4e0d6a87d7bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/729023
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2 weeks agointernal/trace: correctly handle GoUndetermined for GoroutineSummary
Michael Anthony Knyszek [Wed, 10 Dec 2025 02:50:56 +0000 (02:50 +0000)]
internal/trace: correctly handle GoUndetermined for GoroutineSummary

Currently the trace summarization incorrectly handles GoUndetermined by
treating it too much like GoNotExist. In particular, it should be
accumulating all the time since the start of the trace in a particular
bucket, but it doesn't, so that instead gets counted as "unknown time"
because the "creation time" is at the start of the trace.

This change fixes the problem by simply doing the accumulation. It's
very straightforward. It also side-steps some other inaccuracies, like
associating a goroutine that is being named with the current task. I
don't think this can ever actually happen in practice, but splitting up
the two cases, GoUndetermined and GoNotExist, fixes it.

Fixes #76716.

Change-Id: I3ac1557044f99c92bada2cb0e124b2192b1d6ebb
Reviewed-on: https://go-review.googlesource.com/c/go/+/728822
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Nick Ripley <nick.ripley@datadoghq.com>
2 weeks agosimd/archsimd: rename Mask.AsIntMxN to Mask.ToIntMxN
Cherry Mui [Wed, 10 Dec 2025 18:45:54 +0000 (13:45 -0500)]
simd/archsimd: rename Mask.AsIntMxN to Mask.ToIntMxN

To be more consistent with vector.ToMask and mask.ToBits.

Cherry-pick CL 729022 from the dev.simd branch, for Go 1.26.

Change-Id: I4ea4dfd0059d256f39a93d1fe2ce1de158049800
Reviewed-on: https://go-review.googlesource.com/c/go/+/729223
Auto-Submit: David Chase <drchase@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

2 weeks agosimd/archsimd: define ToMask only on integer vectors
Cherry Mui [Wed, 10 Dec 2025 17:05:45 +0000 (12:05 -0500)]
simd/archsimd: define ToMask only on integer vectors

The ToMask method is for converting an AVX2-style mask
represented in a vector to the Mask type. The AVX2-style mask is
a (signed) integer, so define ToMask only on integer vectors.

Cherry-pick CL 729020 from the dev.simd branch, for Go 1.26.

Change-Id: I0c541eb28e945bfaebf2a2feb940bdd438fb6e99
Reviewed-on: https://go-review.googlesource.com/c/go/+/729222
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: David Chase <drchase@google.com>

2 weeks agosimd/archsimd: add package doc
Cherry Mui [Tue, 9 Dec 2025 00:54:11 +0000 (19:54 -0500)]
simd/archsimd: add package doc

Cherry-pick CL 728560 from the dev.simd branch, for Go 1.26.

Change-Id: I9d353769861b35cc808458aa66d243240c235c9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/729221
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: David Chase <drchase@google.com>
Reviewed-by: David Chase <drchase@google.com>
2 weeks agolib/fips140: freeze v1.1.0-rc1 FIPS 140 module zip file
Filippo Valsorda [Wed, 10 Dec 2025 21:49:31 +0000 (22:49 +0100)]
lib/fips140: freeze v1.1.0-rc1 FIPS 140 module zip file

Fixes #76769

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Change-Id: I16b0e9463e2e10ee5a6f20967fb6377b6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/729180
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2 weeks agoruntime: make goroutines inherit DIT state, don't lock to OS thread
Roland Shoemaker [Wed, 3 Dec 2025 22:19:25 +0000 (14:19 -0800)]
runtime: make goroutines inherit DIT state, don't lock to OS thread

When we first implemented DIT (crypto/subtle.WithDataIndependentTiming),
we made it so that enabling DIT on a goroutine would lock that goroutine
to its current OS thread. This was done to ensure that the DIT state
(which is per-thread) would not leak to other goroutines. We also did
not make goroutines inherit the DIT state.

This change makes goroutines inherit the DIT state from their parent
at creation time. It also removes the OS thread locking when enabling
DIT on a goroutine. Instead, we now set the DIT state on the OS thread
in the scheduler whenever we switch to a goroutine that has DIT enabled,
and we unset it when switching to a goroutine that has DIT disabled.

We add a new field to G and M, ditEnabled, to track whether the G wants
DIT enabled, and whether the M currently has DIT enabled, respectively.
When the scheduler executes a goroutine, it checks these fields and
enables/disables DIT on the thread as needed.

Additionally, cgocallbackg is updated to check if DIT is enabled when
being called from C, and sets the G and M fields accordingly. This
ensures that if DIT was enabled/disabled in C, the correct state will be
reflected in the Go runtime.

The behavior as it currently stands is as follows:
- The function passed to crypto/subtle.WithDataIndependentTiming
  will have DIT enabled.
- Any goroutine created within that function will inherit DIT enabled
  for its lifetime. Any goroutine created from subquent goroutines will
  also inherit DIT enabled for their lifetimes.
- Calling into a C function within from a goroutine with DIT enabled
  will have DIT enabled.
- If the C code disables DIT, the goroutine will have DIT re-enabled
  when returning to Go.
- If the C code enables DIT, the goroutine will have DIT disabled
  when returning to Go if it was not previously enabled.
- Calling back into Go code from C will have DIT enabled if it was
  enabled when calling into C, or if the C code enabled it.

Change-Id: I8e91e6df13bb88e56e1036e0e0e5f04efd8eebd3
Reviewed-on: https://go-review.googlesource.com/c/go/+/726382
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2 weeks agogo/types, types2: put Named.finite behind Named.mu
Mark Freeman [Wed, 10 Dec 2025 18:29:01 +0000 (13:29 -0500)]
go/types, types2: put Named.finite behind Named.mu

This change adds another leaf state to named types which indicates
whether the type's size finiteness is known.

Without this, writes to Named.finite can result in a clobbered value.
While benign in terms of functionality, it triggers the race detector.

Fixes #76773

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

2 weeks agoall: update to x/crypto@7dacc380ba00
Filippo Valsorda [Mon, 8 Dec 2025 22:52:18 +0000 (23:52 +0100)]
all: update to x/crypto@7dacc380ba00

This brings in CL 728480 for fips140only support in
x/crypto/chacha20poly1305.

This brings in also CL 726280 due to the lockstep x/ dependencies.

Updates #70514

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

2 weeks agocrypto: clean up subprocess-spawning tests
Filippo Valsorda [Tue, 9 Dec 2025 13:46:57 +0000 (14:46 +0100)]
crypto: clean up subprocess-spawning tests

Consistently use testenv.Command and testenv.Executable, avoid redundant
testenv.Must, use testenv.CleanCmdEnv where the output is parsed, always
log the output with a preceding newline, invoke tests with -v, and
always use cmd.Environ() to preserve existing env.

Change-Id: I647ff1a8b7d162e5e8df9424030fac446a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/728641
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2 weeks agocrypto/hpke: apply fips140.WithoutEnforcement to ML-KEM+X25519 hybrid
Filippo Valsorda [Tue, 9 Dec 2025 00:04:16 +0000 (01:04 +0100)]
crypto/hpke: apply fips140.WithoutEnforcement to ML-KEM+X25519 hybrid

Since it uses an Approved KEM (ML-KEM), the overall hybrid KEM is
Approved, even if X25519 is not.

Updates #70514
Updates #74630

Change-Id: I2bb60c36fcf570baa3c389e2daa3698e6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/728505
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2 weeks agocrypto/mlkem/mlkemtest: error out in fips140=only mode
Filippo Valsorda [Mon, 8 Dec 2025 23:39:54 +0000 (00:39 +0100)]
crypto/mlkem/mlkemtest: error out in fips140=only mode

Updates #70514

Change-Id: I1d1a0b4a2c7ee4cb6e8e0700dd3463a46a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/728502
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2 weeks agocrypto/hpke: don't corrupt enc's excess capacity in DHKEM decap
Filippo Valsorda [Thu, 9 Jan 2025 15:56:37 +0000 (16:56 +0100)]
crypto/hpke: don't corrupt enc's excess capacity in DHKEM decap

Caught because the one-shop APIs put the ciphertext after enc in a
single slice, so Recipient.Open would corrupt the ciphertext.

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

2 weeks agocrypto/internal/fips140/aes/gcm: don't panic on bad nonces out of FIPS 140-3 mode
Filippo Valsorda [Mon, 8 Dec 2025 23:47:26 +0000 (00:47 +0100)]
crypto/internal/fips140/aes/gcm: don't panic on bad nonces out of FIPS 140-3 mode

The enforcement is good beyond compliance if it is correct, but I am
more nervous about accidental DoS due to mismatches between how the
caller calculates a nonce and how the enforcement expects it to be
calculated.

We need to have this enforcement in FIPS 140-3 mode, but no need to blow
ourselves up when it's off.

If all goes well, this code is unreachable anyway.

Change-Id: If73ec59ebbd283b0e5506354961a87a06a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/728504
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2 weeks agocrypto/hpke: use new gcm.NewGCMForHPKE for FIPS 140-3 compliance
Filippo Valsorda [Mon, 8 Dec 2025 23:41:59 +0000 (00:41 +0100)]
crypto/hpke: use new gcm.NewGCMForHPKE for FIPS 140-3 compliance

It does the exact same thing, but we can document it as an allowed and
enforced nonce scheme in the Security Policy.

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

2 weeks agocrypto/internal: ACVP test data migrated to Geomys repo
Daniel McCarney [Mon, 1 Dec 2025 20:09:33 +0000 (15:09 -0500)]
crypto/internal: ACVP test data migrated to Geomys repo

The cpu/go-acvp repository holding trimmed ACVP test server vectors and
validated expected results was always meant to be a temporary home. It
has now been migrated to geomys/acvp-testdata where it will continue to
be maintained by Geomys along with the FIPS module.

This commit updates acvp_test.go to use the new module location.

Change-Id: I888b125356afd0b4073cb38645486c258dea3c54
Reviewed-on: https://go-review.googlesource.com/c/go/+/725620
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

2 weeks agoruntime: use correct function name in methodValueCallFrameObjs comment
Ian Lance Taylor [Mon, 27 Oct 2025 23:21:13 +0000 (16:21 -0700)]
runtime: use correct function name in methodValueCallFrameObjs comment

Change-Id: I029531695ae252ee912c5ab9bbb688b6ae3dc02d
Reviewed-on: https://go-review.googlesource.com/c/go/+/715520
Auto-Submit: Austin Clements <austin@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2 weeks agoruntime: VZEROUPPER at the end of FilterNilAVX512
Cherry Mui [Tue, 9 Dec 2025 16:48:41 +0000 (11:48 -0500)]
runtime: VZEROUPPER at the end of FilterNilAVX512

VZEROUPPER at the end of FilterNilAVX512 as we're leaving AVX
context. Also explicitly zero Z15, as the high bits are not
guaranteed zero as of CL 728240.

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

2 weeks agocmd: fix some issues in the comments
cuishuang [Mon, 8 Dec 2025 04:18:59 +0000 (12:18 +0800)]
cmd: fix some issues in the comments

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

2 weeks agoruntime: on AIX check isarchive before calling libpreinit
Ian Lance Taylor [Sun, 7 Dec 2025 06:00:20 +0000 (22:00 -0800)]
runtime: on AIX check isarchive before calling libpreinit

On AIX, all externally linked programs call _rt0_ppc64_aix_lib,
as seen in runtime/cgo/gcc_aix_ppc64.c. The idea is that we
only do the library initialization is isarchive is set.
However, before this CL, AIX programs would call libpreinit
before checking isarchive. The effect was that signals were
initialized twice. That caused the signal code to record that
all signals had an existing forwarding address, namely the
Go signal handler that was always installed. This caused signal
forwarding to enter an infinite loop. This caused, for example,
"go test os" to hang forever when running TestStdPipe.

Fixes #76081

Change-Id: I5555f8c5e299d45549f5ce601568dc6b3cff4ecc
Reviewed-on: https://go-review.googlesource.com/c/go/+/727820
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2 weeks agogo/types, types2: add check for finite size at value observance
Mark Freeman [Wed, 3 Dec 2025 20:14:22 +0000 (15:14 -0500)]
go/types, types2: add check for finite size at value observance

Each type must be representable by a finite amount of Go source code
after replacing all alias type names, value names, and embedded
interfaces (per #56103) with the RHS from their respective declarations
("expansion"); otherwise the type is invalid.

Furthermore, each type must have a finite size.

Checking for finite source after expansion is handled in decl.go.
Checking for finite size is handled in validtype.go and is delayed to
the end of type checking (unless used in unsafe.Sizeof, in which case
it is computed eagerly).

We can only construct values of valid types. Thus, while a type is
pending (on the object path and thus not yet valid), it cannot construct
a value of its own type (directly or indirectly).

This change enforces the indirect case by validating each type at value
observance (and hence upholding the invariant that values of only valid
types are created). Validation is cached on Named types to avoid
duplicate work.

As an example, consider:

  type A [unsafe.Sizeof(B{})]int
  type B A

Clearly, since there are no aliases, A and B have finite source. At the
site of B{}, B will be checked for finite size, recursing down the
values of B, at which point A is seen. Since A is on the object path,
there is a cycle preventing B from being proven valid before B{},
violating our invariant.

Note that this change also works for generic types.

Fixes #75918
Fixes #76478

Change-Id: I76d493b5da9571780fed4b3c76803750ec184818
Reviewed-on: https://go-review.googlesource.com/c/go/+/726580
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>

2 weeks agoall: REVERSE MERGE dev.simd (c456ab7) into master
Cherry Mui [Mon, 8 Dec 2025 22:53:31 +0000 (17:53 -0500)]
all: REVERSE MERGE dev.simd (c456ab7) into master

This commit is a REVERSE MERGE.
It merges dev.simd back into its parent branch, master.
This marks the end of development on dev.simd.

Merge List:

+ 2025-12-08 c456ab7a30 [dev.simd] all: merge master (a33bbf1) into dev.simd
+ 2025-12-08 1d8711e126 [dev.simd] internal/buildcfg: don't enable SIMD experiment by default
+ 2025-12-08 f38e968aba [dev.simd] cmd/compile: zero only low 128-bit of X15
+ 2025-12-08 144cf17d2c [dev.simd] simd, cmd/compile: move "simd" to "simd/archsimd"
+ 2025-12-08 3417b48b17 [dev.simd] simd: add carryless multiply
+ 2025-12-05 f51ee08905 [dev.simd] simd: replace checking loops with call to slice-checker
+ 2025-12-03 2b91d96941 [dev.simd] internal/buildcfg: turn GOEXPERIMENT=simd back on

Change-Id: Ife3f2ca4f6d8ce131335c0f868358db6a6a1a534

2 weeks ago[dev.simd] all: merge master (a33bbf1) into dev.simd
Cherry Mui [Mon, 8 Dec 2025 22:41:04 +0000 (17:41 -0500)]
[dev.simd] all: merge master (a33bbf1) into dev.simd

Merge List:

+ 2025-12-08 a33bbf1988 weak: fix weak pointer test to correctly iterate over weak pointers after GC
+ 2025-12-08 a88a96330f cmd/cgo: use doc link for cgo.Handle
+ 2025-12-08 276cc4d3db cmd/link: fix AIX builds after recent linker changes
+ 2025-12-08 f2d96272cb runtime/trace: update TestSubscribers to dump traces
+ 2025-12-08 4837bcc92c internal/trace: skip tests for alloc/free experiment by default
+ 2025-12-08 b5f6816cea cmd/link: generate DWARF for moduledata
+ 2025-12-08 44a39c9dac runtime: only run TestNotInGoMetricCallback when building with cgo
+ 2025-12-08 3a6a034cd6 runtime: disable TestNotInGoMetricCallback on FreeBSD + race
+ 2025-12-08 4122d3e9ea runtime: use atomic C types with atomic C functions
+ 2025-12-08 34397865b1 runtime: deflake TestProfBufWakeup
+ 2025-12-08 d4972f6295 runtime: mark getfp as nosplit
+ 2025-12-05 0d0d5c9a82 test/codegen: test negation with add/sub on riscv64
+ 2025-12-05 2e509e61ef cmd/go: convert some more tests to script tests
+ 2025-12-05 c270e71835 cmd/go/internal/vet: skip -fix on pkgs from vendor or non-main mod
+ 2025-12-05 745349712e runtime: don't count nGsyscallNoP for extra Ms in C
+ 2025-12-05 f3d572d96a cmd/go: fix race applying fixes in fix and vet -fix modes
+ 2025-12-05 76345533f7 runtime: expand Pinner documentation
+ 2025-12-05 b133524c0f cmd/go/testdata/script: skip vet_cache in short mode
+ 2025-12-05 96e142ba2b runtime: skip TestArenaCollision if we run out of hints
+ 2025-12-05 fe4952f116 runtime: relax threadsSlack in TestReadMetricsSched
+ 2025-12-05 8947f092a8 runtime: skip mayMoreStackMove in goroutine leak tests
+ 2025-12-05 44cb82449e runtime/race: set missing argument frame for ppc64x atomic And/Or wrappers
+ 2025-12-05 435e61c801 runtime: reject any goroutine leak test failure that failed to execute
+ 2025-12-05 54e5540014 runtime: print output in case of segfault in goroutine leak tests
+ 2025-12-05 9616c33295 runtime: don't specify GOEXPERIMENT=greenteagc in goroutine leak tests
+ 2025-12-05 2244bd7eeb crypto/subtle: add speculation barrier after DIT
+ 2025-12-05 f84f8d86be cmd/compile: fix mis-infer bounds in slice len/cap calculations
+ 2025-12-05 a70addd3b3 all: fix some comment issues
+ 2025-12-05 93b49f773d internal/runtime/maps: clarify probeSeq doc comment
+ 2025-12-04 91267f0a70 all: update vendored x/tools
+ 2025-12-04 a753a9ed54 cmd/internal/fuzztest: move fuzz tests out of cmd/go test suite
+ 2025-12-04 1681c3b67f crypto: use rand.IsDefaultReader instead of comparing to boring.RandReader
+ 2025-12-04 7b67b68a0d cmd/compile: use isUnsignedPowerOfTwo rather than isPowerOfTwo for unsigneds
+ 2025-12-03 2b62144069 all: REVERSE MERGE dev.simd (9ac524a) into master

Change-Id: Ia0cdf06cdde89b6a4db30ed15ed8e0bcbac6ae30

2 weeks ago[dev.simd] internal/buildcfg: don't enable SIMD experiment by default
Cherry Mui [Mon, 8 Dec 2025 22:12:35 +0000 (17:12 -0500)]
[dev.simd] internal/buildcfg: don't enable SIMD experiment by default

Preparing for merge to the main branch. Will reenable on the
branch.

Change-Id: I460dff3a5ceffb073f296098e76a35a90473de2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/728241
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
2 weeks agoweak: fix weak pointer test to correctly iterate over weak pointers after GC
cuishuang [Mon, 24 Nov 2025 06:38:30 +0000 (14:38 +0800)]
weak: fix weak pointer test to correctly iterate over weak pointers after GC

This change fixes a bug in the weak pointer test where the loop was
attempting to iterate over a nil slice (bt) instead of the weak
pointer slice (wt).

After setting bt to nil and running GC, the test should iterate over
the weak pointers to verify they've been cleared, not attempt to
iterate over the now-nil strong references.

Change-Id: Ic0425f59da132257770ed87d1bcea5d2c0a54e07
Reviewed-on: https://go-review.googlesource.com/c/go/+/723600
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
2 weeks agocmd/cgo: use doc link for cgo.Handle
Ariel Otilibili [Sun, 7 Dec 2025 00:39:34 +0000 (00:39 +0000)]
cmd/cgo: use doc link for cgo.Handle

Change-Id: If6af9842f563fe9233de0563d356e925a7b912f8
GitHub-Last-Rev: e8422e9a5aa9ca3140c96f7abfa4fa4482d709ab
GitHub-Pull-Request: golang/go#76727
Reviewed-on: https://go-review.googlesource.com/c/go/+/727581
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>

2 weeks agocmd/link: fix AIX builds after recent linker changes
Ian Lance Taylor [Tue, 2 Dec 2025 00:25:56 +0000 (16:25 -0800)]
cmd/link: fix AIX builds after recent linker changes

This updates XCOFF-specific code for the recent addition
of funcdata to pclntab.

Because XCOFF puts separate symbols into separate csects,
each with their own alignment, it's important to tell the
external linker the expected alignment of each part of pclntab.
Otherwise the offsets within pclntab may change as the external
linker aligns symbols. This CL sets the correct alignment for
each pclntab child symbol, and sets pclntab's alignment to the
max of that of its children.

Tested on the GCC compile farm.

Fixes #76486

Change-Id: I77d8a90c4b4b79d80ca11ede8d9a2aa9cc89f53f
Reviewed-on: https://go-review.googlesource.com/c/go/+/725603
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2 weeks ago[dev.simd] cmd/compile: zero only low 128-bit of X15
Cherry Mui [Mon, 8 Dec 2025 17:14:24 +0000 (12:14 -0500)]
[dev.simd] cmd/compile: zero only low 128-bit of X15

Zeroing the upper part of X15 may make the CPU think it is
"dirty" and slow down SSE operations. For now, just not zeroing
the upper part, and construct a zero value on the fly if we need
a 256- or 512-bit zero value. Maybe VZEROUPPER works better than
explicitly zeroing X15, but we need to evaluate.

Long term, we probably want to move more things from SSE to AVX.

This essentially undoes CL 698237 and CL 698238, except keeping
using X15 for 128-bit zeroing for SIMD.

Change-Id: I1564e6332c4c57f9721397c92c7c734c5497534c
Reviewed-on: https://go-review.googlesource.com/c/go/+/728240
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2 weeks ago[dev.simd] simd, cmd/compile: move "simd" to "simd/archsimd"
David Chase [Mon, 8 Dec 2025 18:24:12 +0000 (13:24 -0500)]
[dev.simd] simd, cmd/compile: move "simd" to "simd/archsimd"

Also removes a few leftover TODOs and scraps of commented-out code
from simd development.

Updated etetest.sh to make it behave whether amd64 implies the
experiment, or not.

Fixes #76473.

Change-Id: I6d9792214d7f514cb90c21b101dbf7d07c1d0e55
Reviewed-on: https://go-review.googlesource.com/c/go/+/728220
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 weeks agoruntime/trace: update TestSubscribers to dump traces
Michael Anthony Knyszek [Mon, 8 Dec 2025 17:56:26 +0000 (17:56 +0000)]
runtime/trace: update TestSubscribers to dump traces

CL 710755 missed this test suite.

For #75665.

Change-Id: Id2f1ab2eae2c20ea5056e893951a73c0b851f0eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/728200
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>

2 weeks agointernal/trace: skip tests for alloc/free experiment by default
Michael Anthony Knyszek [Mon, 8 Dec 2025 17:48:53 +0000 (17:48 +0000)]
internal/trace: skip tests for alloc/free experiment by default

These tests are just too flaky and I don't have the time to fix them
right now. I also am thinking to just change how trace experiments work,
so it may not be worth taking the time to fix them.

For #70838.

Change-Id: Ia896215a0cbeccac99b73fefc836088f43530849
Reviewed-on: https://go-review.googlesource.com/c/go/+/728122
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>

2 weeks agocmd/link: generate DWARF for moduledata
Ian Lance Taylor [Sat, 6 Dec 2025 23:06:11 +0000 (15:06 -0800)]
cmd/link: generate DWARF for moduledata

Fixes #76731

Change-Id: I5c686c91af8543b57880a89d30393912ef1958ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/727760
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

2 weeks agoruntime: only run TestNotInGoMetricCallback when building with cgo
Michael Anthony Knyszek [Mon, 8 Dec 2025 16:17:15 +0000 (16:17 +0000)]
runtime: only run TestNotInGoMetricCallback when building with cgo

It seems like some platforms don't build with cgo at all, like
linux/ppc64.

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

2 weeks agoruntime: disable TestNotInGoMetricCallback on FreeBSD + race
Michael Anthony Knyszek [Mon, 8 Dec 2025 16:05:53 +0000 (16:05 +0000)]
runtime: disable TestNotInGoMetricCallback on FreeBSD + race

cgo + race is not supported on FreeBSD.

Change-Id: I38abeccaaabfcc104d1d5a077fb99646dc4be792
Reviewed-on: https://go-review.googlesource.com/c/go/+/728120
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 weeks agoruntime: use atomic C types with atomic C functions
Joel Sing [Mon, 8 Dec 2025 13:11:55 +0000 (00:11 +1100)]
runtime: use atomic C types with atomic C functions

Mark types as _Atomic - fixes breakage introduced in CL 726964
across most LLVM based platforms/builders.

Change-Id: I5e64b9ccb0cf5244977a787a52ee124bc03c10de
Reviewed-on: https://go-review.googlesource.com/c/go/+/728040
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 weeks agoruntime: deflake TestProfBufWakeup
Nick Ripley [Sat, 6 Dec 2025 15:09:38 +0000 (10:09 -0500)]
runtime: deflake TestProfBufWakeup

If CI infrastructure is oversubscribed, the profile buffer reader can be
blocked long enough for the status in the traceback to be something like
"[syscall, 3 minutes]", rather than the "[syscall]" we are looking for.
Tweak the regexp to look for the expected state at the beginning of the
status in the brackets.

While we're here, clarify the possible "race" in the test, which has
more to do with failing to catch a buggy implementation rather than
failing for a correct implementation. Ideally if the implementation is
buggy, we should see the t.Errorf at least some of the time, even if we
don't see it in every run.

Change-Id: Iebd5229d338dc3f973349cea6dd84c506a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/727660
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>