65274 Commits

Author SHA1 Message Date
Cherry Mui
d30884ba1f 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>
2025-12-12 17:25:36 -08:00
Ian Lance Taylor
ee0275d15b 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>
2025-12-12 13:23:17 -08:00
Daniel Morsing
63fced531c 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>
2025-12-12 12:26:44 -08:00
Michael Anthony Knyszek
6455afbc6f 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>
2025-12-12 12:02:59 -08:00
Michael Anthony Knyszek
8f45611e78 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>
2025-12-12 12:00:25 -08:00
Cherry Mui
34af879dde 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>
2025-12-12 11:10:29 -08:00
Cherry Mui
8d31244562 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>
2025-12-12 11:09:19 -08:00
Sean Liao
e8a83788a4 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>
2025-12-12 09:04:46 -08:00
Meng Zhuo
927c89bbc5 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>
2025-12-11 15:07:30 -08:00
Michael Anthony Knyszek
245bcdd478 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>
2025-12-11 12:30:44 -08:00
Austin Clements
ae62a1bd36 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>
2025-12-11 11:57:52 -08:00
Michael Anthony Knyszek
89614ad264 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>
2025-12-11 10:37:14 -08:00
Alan Donovan
bb2337f24c 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>
2025-12-11 10:27:56 -08:00
Mark Freeman
2622d2955b 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>
2025-12-11 10:11:13 -08:00
Damien Neil
5818c9d714 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>
2025-12-11 09:37:03 -08:00
Damien Neil
9de6468701 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>
2025-12-11 09:35:35 -08:00
Damien Neil
00642ee23b 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>
2025-12-11 09:34:26 -08:00
Dmitri Shuralyov
7b60d06739 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>
2025-12-11 08:47:56 -08:00
Michael Anthony Knyszek
1de9585be2 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>
2025-12-11 08:36:19 -08:00
Michael Anthony Knyszek
e38c38f0e5 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>
2025-12-11 08:34:39 -08:00
Cherry Mui
c0ba519764 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>
2025-12-11 08:33:07 -08:00
Cherry Mui
f110ba540c 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>
2025-12-11 08:31:43 -08:00
Cherry Mui
1da0c29c2a 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>
2025-12-11 08:30:24 -08:00
Filippo Valsorda
f105dfd048 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>
2025-12-11 08:27:41 -08:00
Roland Shoemaker
af14f67911 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>
2025-12-11 08:21:53 -08:00
Mark Freeman
72c83bcc80 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>
2025-12-11 08:18:30 -08:00
Filippo Valsorda
b2a697bd06 all: update to x/crypto@7dacc380ba
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>
2025-12-10 13:47:24 -08:00
Filippo Valsorda
fc66a5655b 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>
2025-12-10 13:46:04 -08:00
Filippo Valsorda
b130dab792 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>
2025-12-10 13:46:00 -08:00
Filippo Valsorda
c39fe18fea 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>
2025-12-10 13:45:57 -08:00
Filippo Valsorda
db0ab834d6 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>
2025-12-10 13:45:53 -08:00
Filippo Valsorda
cd873cf7e9 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>
2025-12-10 13:41:55 -08:00
Filippo Valsorda
550c0c898b 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>
2025-12-10 13:41:36 -08:00
Daniel McCarney
d349854de6 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>
2025-12-10 13:23:09 -08:00
Ian Lance Taylor
cd9319ff8e 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>
2025-12-10 12:37:45 -08:00
Cherry Mui
0d71bd57c9 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>
2025-12-10 10:57:48 -08:00
cuishuang
36bca3166e 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>
2025-12-09 10:42:20 -08:00
Ian Lance Taylor
b9693a2d9a 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>
2025-12-09 09:33:40 -08:00
Mark Freeman
1274d58dac 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>
2025-12-09 08:51:02 -08:00
Cherry Mui
9e09812308 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
2025-12-08 17:53:31 -05:00
Cherry Mui
c456ab7a30 [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
2025-12-08 17:41:05 -05:00
Cherry Mui
1d8711e126 [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>
2025-12-08 14:40:12 -08:00
cuishuang
a33bbf1988 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>
2025-12-08 14:39:36 -08:00
Ariel Otilibili
a88a96330f cmd/cgo: use doc link for cgo.Handle
Change-Id: If6af9842f563fe9233de0563d356e925a7b912f8
GitHub-Last-Rev: e8422e9a5a
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>
2025-12-08 14:37:14 -08:00
Ian Lance Taylor
276cc4d3db 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>
2025-12-08 14:37:09 -08:00
Cherry Mui
f38e968aba [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>
2025-12-08 14:10:09 -08:00
David Chase
144cf17d2c [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>
2025-12-08 13:57:44 -08:00
Michael Anthony Knyszek
f2d96272cb 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>
2025-12-08 10:58:21 -08:00
Michael Anthony Knyszek
4837bcc92c 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>
2025-12-08 10:56:47 -08:00
Ian Lance Taylor
b5f6816cea 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>
2025-12-08 09:11:14 -08:00