]> Cypherpunks repositories - gostls13.git/log
gostls13.git
2 months ago[dev.simd] simd/_gen: fix sorting ops slices
Alexander Musman [Wed, 29 Oct 2025 13:49:28 +0000 (16:49 +0300)]
[dev.simd] simd/_gen: fix sorting ops slices

Fix sorting slices to avoid panic when there are more opsDataImm than
opsData (the problem occurs when generating only a subset of instructions
but it may be better to keep them sorted by their own names anyway).

Change-Id: Iea7fe61259e8416f16c46158d87c84b1d7a3076d
Reviewed-on: https://go-review.googlesource.com/c/go/+/716121
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Junyang Shao <shaojunyang@google.com>

2 months ago[dev.simd] cmd/compile: enhance inlining for closure-of-SIMD
David Chase [Tue, 28 Oct 2025 17:32:56 +0000 (13:32 -0400)]
[dev.simd] cmd/compile: enhance inlining for closure-of-SIMD

We noticed some hand-translated code that used
nested functions as the translation of asm macros,
and they were too big to inline, and the resulting
performance was underwhelming.  Any such closures
really need to be inlined.

Because Gerrit removed votes from a previous patch
set, and because in offline discussion we realized
that this was actually a hard-to-abuse inlining hack,
I decided to turn it up some more, and also add a
"this one goes to 11" joke.  The number is utterly
unprincipled, only "simd is supposed to go fast,
and this is a natural use of closures, and we don't
want there to be issues where it doesn't go fast."

The test verifies that the inlining occurs for a
function that exceeds the current inlining threshold.
Inspection of the generated code shows that it has
the desired effect.

Change-Id: I7a8b57c07d6482e6d98cedaf9622c960f956834d
Reviewed-on: https://go-review.googlesource.com/c/go/+/715740
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2 months ago[dev.simd] test: add some trickier cases to ternary-boolean simd test
David Chase [Fri, 24 Oct 2025 21:25:46 +0000 (17:25 -0400)]
[dev.simd] test: add some trickier cases to ternary-boolean simd test

These new tests check a hypothesis about interactions
between CPU features and common subexpressions.  Happily,
they hypothesis was not (yet) correct and the test did not
fail.

These are probably good to have in the corpus in case we
decide to tinker with the rewrite in the future, or if
someone wants to write a fuzzer and needs a little
inspiration.

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

2 months ago[dev.simd] cmd/compile, simd: add rewrite to convert logical expression trees into...
David Chase [Thu, 9 Oct 2025 19:12:47 +0000 (15:12 -0400)]
[dev.simd] cmd/compile, simd: add rewrite to convert logical expression trees into TERNLOG instructions

includes tests of both rewrite application and
rewrite correctness

Change-Id: I7983ccf87a8408af95bb6c447cb22f01beda9f61
Reviewed-on: https://go-review.googlesource.com/c/go/+/710697
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2 months ago[dev.simd] cmd/compile, simd: add SHA features
Junyang Shao [Thu, 16 Oct 2025 16:07:32 +0000 (16:07 +0000)]
[dev.simd] cmd/compile, simd: add SHA features

This CL also fixed some bugs left in CL 712181.

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

2 months ago[dev.simd] simd/_gen: parse SHA features from XED
Junyang Shao [Wed, 15 Oct 2025 19:17:35 +0000 (19:17 +0000)]
[dev.simd] simd/_gen: parse SHA features from XED

To parse SHA feature instructions from XED, this CL added some utility
to decode fixed reg operands.

SHA512 parsing will be in next CL as we don't have SHA512 cpu features
in src/internal/cpu/cpu.go yet.

Change-Id: Id14cced57eab2ca9e75693a201f4ce7c04981587
Reviewed-on: https://go-review.googlesource.com/c/go/+/712181
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2 months ago[dev.simd] simd: added String() method to SIMD vectors.
David Chase [Tue, 14 Oct 2025 16:25:07 +0000 (12:25 -0400)]
[dev.simd] simd: added String() method to SIMD vectors.

this required a little plumbing to get access
to the "good" floating point formatting.

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

2 months ago[dev.simd] cmd/compile, simd: add definitions for VPTERNLOG[DQ]
David Chase [Fri, 3 Oct 2025 18:44:59 +0000 (14:44 -0400)]
[dev.simd] cmd/compile, simd: add definitions for VPTERNLOG[DQ]

This includes an non-public intrinsic for testing,
and a test.  Optimizations using this instruction
will follow in another CL.

Change-Id: I7f7a93212249a16a30bd1379c717f8a7f9915daf
Reviewed-on: https://go-review.googlesource.com/c/go/+/708995
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2 months ago[dev.simd] simd: add AES feature check
Tom Thorogood [Sun, 19 Oct 2025 01:21:16 +0000 (11:51 +1030)]
[dev.simd] simd: add AES feature check

CL 706055 added AES support but chose to not generate feature checks for
composite features. Intel lists AES as AVXAES which gets manually mapped
to the composite feature AVX, AES. With the previous writeSIMDFeatures
code ignoring composite features, and there being no other references to
AES, we neglected to generate a feature check at all.

To resolve this, we instead split composite features into their
constituent parts and ensure that each feature has a check generated.

Currently AVXAES is the only composite feature.

Updates #73787

Change-Id: Ic8e9d8a3c9c0854fc717512c2ce092d81cb6b66c
Reviewed-on: https://go-review.googlesource.com/c/go/+/712880
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 months ago[dev.simd] simd: clean up mask load comments
Junyang Shao [Tue, 14 Oct 2025 16:15:38 +0000 (16:15 +0000)]
[dev.simd] simd: clean up mask load comments

Addressing a comment from CL 710915.

Change-Id: Id65f525130b5b626ea7017aebc93a4b3b0c93d84
Reviewed-on: https://go-review.googlesource.com/c/go/+/711780
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
3 months ago[dev.simd] cmd/compile, simd: update DotProd to DotProduct
Junyang Shao [Fri, 10 Oct 2025 19:18:01 +0000 (19:18 +0000)]
[dev.simd] cmd/compile, simd: update DotProd to DotProduct

API naming changes.

This CL also remove AddDotProductPairsSaturated.

Change-Id: I02e6d45268704f3ed4eaf62f0ecb7dc936b42124
Reviewed-on: https://go-review.googlesource.com/c/go/+/710935
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
3 months ago[dev.simd] cmd/compile: peephole simd mask load/stores from bits
Junyang Shao [Fri, 10 Oct 2025 19:10:31 +0000 (19:10 +0000)]
[dev.simd] cmd/compile: peephole simd mask load/stores from bits

The added test are manually checked that the peepholes are triggered.

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

3 months ago[dev.simd] cmd/compile, simd: remove mask load and stores
Junyang Shao [Fri, 10 Oct 2025 17:42:59 +0000 (17:42 +0000)]
[dev.simd] cmd/compile, simd: remove mask load and stores

We have convert mask to bits already, the API of mask load and stores
are inconsistent with them, also mask load and stores could just be
hidden behind peepholes. So this CL removes them, the next CL will add
the peephole for them.

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

3 months ago[dev.simd] simd/_gen: add mem peephole with feat mismatches
Junyang Shao [Mon, 13 Oct 2025 18:30:05 +0000 (18:30 +0000)]
[dev.simd] simd/_gen: add mem peephole with feat mismatches

This CL attempts to add peepholes for Op -> Opload where the Opload has
a different CPU feature than Op. However the new simdgen changes doesn't
do anything because such peepholes do not exist.

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

3 months ago[dev.simd] cmd/compile: more support for cpufeatures
David Chase [Thu, 9 Oct 2025 18:39:59 +0000 (14:39 -0400)]
[dev.simd] cmd/compile: more support for cpufeatures

add hasFeature, also record maximum feature for a function

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

3 months ago[dev.simd] simd: add emulated Not method
David Chase [Thu, 9 Oct 2025 18:44:25 +0000 (14:44 -0400)]
[dev.simd] simd: add emulated Not method

this is to help match other SIMD architectures and to
simplify processing of logical expressions for rewriting
to ternary-logical simd instructions.

Change-Id: I3c83afbb399d32ba2ade5f8ef288d4a07e1f3948
Reviewed-on: https://go-review.googlesource.com/c/go/+/710696
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 months ago[dev.simd] cmd/compile: track which CPU features are in scope
David Chase [Fri, 5 Sep 2025 23:05:18 +0000 (19:05 -0400)]
[dev.simd] cmd/compile: track which CPU features are in scope

analysis for

- is this block only reached through feature checks?
- does the function signature imply AVX-something?
- is there an instruction in this block which implies AVX-something?

and keep track of which features those are.  Features =
AVX, AVX2, AVX512, etc.

Has a test.

Change-Id: I0b6f2e87d01ec587818db11cf71fac1e4d500650
Reviewed-on: https://go-review.googlesource.com/c/go/+/706337
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
3 months ago[dev.simd] cmd/compile: inliner tweaks to favor simd-handling functions
David Chase [Mon, 22 Sep 2025 19:06:42 +0000 (15:06 -0400)]
[dev.simd] cmd/compile: inliner tweaks to favor simd-handling functions

this is partly to ensure that emulations get inlined

Change-Id: I14f1a591081a4c39b61e48957a1474217ed0a399
Reviewed-on: https://go-review.googlesource.com/c/go/+/705975
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
3 months ago[dev.simd] all: merge master (adce7f1) into dev.simd
Cherry Mui [Fri, 3 Oct 2025 14:11:20 +0000 (10:11 -0400)]
[dev.simd] all: merge master (adce7f1) into dev.simd

Conflicts:

- src/internal/goexperiment/flags.go
- src/runtime/export_test.go

Merge List:

+ 2025-10-03 adce7f196e cmd/link: support .def file with MSVC clang toolchain
+ 2025-10-03 d5b950399d cmd/cgo: fix unaligned arguments typedmemmove crash on iOS
+ 2025-10-02 53845004d6 net/http/httputil: deprecate ReverseProxy.Director
+ 2025-10-02 bbdff9e8e1 net/http: update bundled x/net/http2 and delete obsolete http2inTests
+ 2025-10-02 4008e07080 io/fs: move path name documentation up to the package doc comment
+ 2025-10-02 0e4e2e6832 runtime: skip TestGoroutineLeakProfile under mayMoreStackPreempt
+ 2025-10-02 f03c392295 runtime: fix aix/ppc64 library initialization
+ 2025-10-02 707454b41f cmd/go: update `go help mod edit` with the tool and ignore sections
+ 2025-10-02 8c68a1c1ab runtime,net/http/pprof: goroutine leak detection by using the garbage collector
+ 2025-10-02 84db201ae1 cmd/compile: propagate len([]T{}) to make builtin to allow stack allocation
+ 2025-10-02 5799c139a7 crypto/tls: rm marshalEncryptedClientHelloConfigList dead code
+ 2025-10-01 633dd1d475 encoding/json: fix Decoder.InputOffset regression in goexperiment.jsonv2
+ 2025-10-01 8ad27fb656 doc/go_spec.html: update date
+ 2025-10-01 3f451f2c54 testing/synctest: fix inverted test failure message in TestContextAfterFunc
+ 2025-10-01 be0fed8a5f cmd/go/testdata/script/test_fuzz_fuzztime.txt: disable
+ 2025-09-30 eb1c7f6e69 runtime: move loong64 library entry point to os-agnostic file
+ 2025-09-30 c9257151e5 runtime: unify ppc64/ppc64le library entry point
+ 2025-09-30 4ff8a457db test/codegen: codify handling of floating point constants on arm64
+ 2025-09-30 fcb893fc4b cmd/compile/internal/ssa: remove redundant "type:" prefix check
+ 2025-09-30 19cc1022ba mime: reduce allocs incurred by ParseMediaType
+ 2025-09-30 08afc50bea mime: extend "builtinTypes" to include a more complete list of common types
+ 2025-09-30 97da068774 cmd/compile: eliminate nil checks on .dict arg
+ 2025-09-30 300d9d2714 runtime: initialise debug settings much earlier in startup process
+ 2025-09-30 a846bb0aa5 errors: add AsType
+ 2025-09-30 7c8166d02d cmd/link/internal/arm64: support Mach-O ARM64_RELOC_SUBTRACTOR in internal linking
+ 2025-09-30 6e95748335 cmd/link/internal/arm64: support Mach-O ARM64_RELOC_POINTER_TO_GOT in internal linking
+ 2025-09-30 742f92063e cmd/compile, runtime: always enable Wasm signext and satconv features
+ 2025-09-30 db10db6be3 internal/poll: remove operation fields from FD
+ 2025-09-29 75c87df58e internal/poll: pass the I/O mode instead of an overlapped object in execIO
+ 2025-09-29 fc88e18b4a crypto/internal/fips140/entropy: add CPU jitter-based entropy source
+ 2025-09-29 db4fade759 crypto/internal/fips140/mlkem: make CAST conditional
+ 2025-09-29 db3cb3fd9a runtime: correct reference to getStackMap in comment
+ 2025-09-29 690fc2fb05 internal/poll: remove buf field from operation
+ 2025-09-29 eaf2345256 cmd/link: use a .def file to mark exported symbols on Windows
+ 2025-09-29 4b77733565 internal/syscall/windows: regenerate GetFileSizeEx
+ 2025-09-29 4e9006a716 crypto/tls: quote protocols in ALPN error message
+ 2025-09-29 047c2ab841 cmd/link: don't pass -Wl,-S on Solaris
+ 2025-09-29 ae8eba071b cmd/link: use correct length for pcln.cutab
+ 2025-09-29 fe3ba74b9e cmd/link: skip TestFlagW on platforms without DWARF symbol table
+ 2025-09-29 d42d56b764 encoding/xml: make use of reflect.TypeAssert
+ 2025-09-29 6d51f93257 runtime: jump instead of branch in netbsd/arm64 entry point
+ 2025-09-28 5500cbf0e4 debug/elf: prevent offset overflow
+ 2025-09-27 34e67623a8 all:  fix typos
+ 2025-09-27 af6999e60d cmd/compile: implement jump table on loong64
+ 2025-09-26 63cd912083 os/user: simplify go:build
+ 2025-09-26 53009b26dd runtime: use a smaller arena size on Wasm
+ 2025-09-26 3a5df9d2b2 net/http: add HTTP2Config.StrictMaxConcurrentRequests
+ 2025-09-26 16be34df02 net/http: add more tests of transport connection pool
+ 2025-09-26 3e4540b49d os/user: use getgrouplist on illumos && cgo
+ 2025-09-26 15fbe3480b internal/poll: simplify WriteMsg and ReadMsg on Windows
+ 2025-09-26 16ae11a9e1 runtime: move TestReadMetricsSched to testprog
+ 2025-09-26 459f3a3adc cmd/link: don't pass -Wl,-S on AIX
+ 2025-09-26 4631a2d3c6 cmd/link: skip TestFlagW on AIX
+ 2025-09-26 0f31d742cd cmd/compile: fix ICE with new(<untyped expr>)
+ 2025-09-26 7d7cd6e07b internal/poll: don't call SetFilePointerEx in Seek for overlapped handles
+ 2025-09-26 41cba31e66 mime/multipart: percent-encode CR and LF in header values to avoid CRLF injection
+ 2025-09-26 dd1d597c3a Revert "cmd/internal/obj/loong64: use the MOVVP instruction to optimize prologue"
+ 2025-09-26 45d6bc76af runtime: unify arm64 entry point code
+ 2025-09-25 fdea7da3e6 runtime: use common library entry point on windows amd64/386
+ 2025-09-25 e8a4f508d1 lib/fips140: re-seal v1.0.0
+ 2025-09-25 9b7a328089 crypto/internal/fips140: remove key import PCTs, make keygen PCTs fatal
+ 2025-09-25 7f9ab7203f crypto/internal/fips140: update frozen module version to "v1.0.0"
+ 2025-09-25 fb5719cbda crypto/internal/fips140/ecdsa: make TestingOnlyNewDRBG generic
+ 2025-09-25 56067e31f2 std: remove unused declarations

Change-Id: Iecb28fd62c69fbed59da557f46d31bae55889e2c

3 months agocmd/link: support .def file with MSVC clang toolchain
Cherry Mui [Thu, 2 Oct 2025 22:24:12 +0000 (18:24 -0400)]
cmd/link: support .def file with MSVC clang toolchain

lld-link supports .def file, but requires a "-def:" (or "/def:")
flag. (MinGW linker, on the other hand, requires no flag.) Pass
the flag when using MSVC-based toolchain.

CL originally authored by Chressie Himpel.

Change-Id: I8c327ab48d36b0bcbb1d127cff544ffdb06be38e
Reviewed-on: https://go-review.googlesource.com/c/go/+/708716
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Chressie Himpel <chressie@google.com>
3 months agocmd/cgo: fix unaligned arguments typedmemmove crash on iOS
Tim Cooijmans [Tue, 30 Sep 2025 21:53:11 +0000 (21:53 +0000)]
cmd/cgo: fix unaligned arguments typedmemmove crash on iOS

Irregularly typedmemmove and bulkBarrierPreWrite crashes on unaligned
arguments. By aligning the arguments this is fixed.

Fixes #46893

Change-Id: I7beb9fdc31053fcb71bee6c6cb906dea31718c56
GitHub-Last-Rev: 46ae8b96889644aab60ea4284cf447a740354c6a
GitHub-Pull-Request: golang/go#74868
Reviewed-on: https://go-review.googlesource.com/c/go/+/692935
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
3 months agonet/http/httputil: deprecate ReverseProxy.Director
Damien Neil [Thu, 2 Oct 2025 16:42:57 +0000 (09:42 -0700)]
net/http/httputil: deprecate ReverseProxy.Director

The Director function has been superseded by Rewrite.
Rewrite avoids fundamental security issues with hop-by-hop header
handling in the Director API and has better default handling
of X-Forwarded-* headers.

Fixes #73161

Change-Id: Iadaf3070e0082458f79fb892ade51cb7ce832802
Reviewed-on: https://go-review.googlesource.com/c/go/+/708615
Reviewed-by: Nicholas Husin <husin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
3 months agonet/http: update bundled x/net/http2 and delete obsolete http2inTests
Nicholas S. Husin [Thu, 2 Oct 2025 16:41:25 +0000 (12:41 -0400)]
net/http: update bundled x/net/http2 and delete obsolete http2inTests

http2inTests is no longer needed after go.dev/cl/708135 and should be
deleted. To prevent errors in future vendored dependency updates,
h2_bundle.go is also updated together in this change.

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

3 months agoio/fs: move path name documentation up to the package doc comment
Damien Neil [Thu, 2 Oct 2025 17:45:01 +0000 (10:45 -0700)]
io/fs: move path name documentation up to the package doc comment

Perhaps surprisingly to users, io/fs path names are slash-separated.
Move the documentation for path names up to the top of the package
rather than burying it in the ValidPath documentation.

Change-Id: Id338df07c74a16be74c687ac4c45e0513ee40a8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/708616
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Damien Neil <dneil@google.com>

3 months agoruntime: skip TestGoroutineLeakProfile under mayMoreStackPreempt
Michael Anthony Knyszek [Thu, 2 Oct 2025 19:15:34 +0000 (19:15 +0000)]
runtime: skip TestGoroutineLeakProfile under mayMoreStackPreempt

This may be the long-term fix, but we first need to understand if this
just makes the tests flaky, or if it's revealing an actual underlying
issue. I'm leaning toward the former. If it is the former, ideally we
just make the tests robust (wait longer, maybe?).

For now, this change will make the longtest builders OK again.

For #75729.

Change-Id: If9b30107d04a8e5af5670850add3a53f9471eec6
Reviewed-on: https://go-review.googlesource.com/c/go/+/708715
Reviewed-by: Roland Shoemaker <roland@golang.org>
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>
Reviewed-by: Carlos Amedee <carlos@golang.org>
3 months agoruntime: fix aix/ppc64 library initialization
qmuntal [Wed, 1 Oct 2025 08:59:53 +0000 (10:59 +0200)]
runtime: fix aix/ppc64 library initialization

AIX sets the argc and argv parameters in R14 and R15, but
_rt0_ppc64x_lib expects them to be in R3 and R4. Also, call reginit in
_rt0_ppc64x_lib.

These issues were oversights from CL 706395 which went unnoticed because
there if no LUCI aix/ppc64 builder (see #67299).

Change-Id: I93a2798739935fbcead3e6162b4b90db7e740aa5
Reviewed-on: https://go-review.googlesource.com/c/go/+/708255
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Paul Murphy <paumurph@redhat.com>
3 months agocmd/go: update `go help mod edit` with the tool and ignore sections
Daniel Martí [Sat, 30 Aug 2025 20:13:12 +0000 (21:13 +0100)]
cmd/go: update `go help mod edit` with the tool and ignore sections

The types were added to the docs, but not the fields in GoMod.
While here, I was initially confused about what is the top-level type
given that `type Module` comes first. Move `type GoMod` to the top
as it is the actual top-level type.

Change-Id: I1270154837501f5c7f5b21959b2841fd4ac808d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/700116
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
3 months agoruntime,net/http/pprof: goroutine leak detection by using the garbage collector
Vlad Saioc [Thu, 2 Oct 2025 11:57:58 +0000 (11:57 +0000)]
runtime,net/http/pprof: goroutine leak detection by using the garbage collector

Proposal #74609

Change-Id: I97a754b128aac1bc5b7b9ab607fcd5bb390058c8
GitHub-Last-Rev: 60f2a192badf415112246de8bc6c0084085314f6
GitHub-Pull-Request: golang/go#74622
Reviewed-on: https://go-review.googlesource.com/c/go/+/688335
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: t hepudds <thepudds1460@gmail.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
3 months agocmd/compile: propagate len([]T{}) to make builtin to allow stack allocation
Mateusz Poliwczak [Fri, 26 Sep 2025 18:47:45 +0000 (20:47 +0200)]
cmd/compile: propagate len([]T{}) to make builtin to allow stack allocation

Updates #75620

Change-Id: I6a6a6964af4512e30eb4806e1dc7b0fd0835744f
Reviewed-on: https://go-review.googlesource.com/c/go/+/707255
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
3 months agocrypto/tls: rm marshalEncryptedClientHelloConfigList dead code
Daniel McCarney [Mon, 29 Sep 2025 18:31:38 +0000 (14:31 -0400)]
crypto/tls: rm marshalEncryptedClientHelloConfigList dead code

This package internal function has no call sites.

Change-Id: I262058199fd2f387ef3b5e21099421720cc5413e
Reviewed-on: https://go-review.googlesource.com/c/go/+/707815
TryBot-Bypass: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Auto-Submit: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
3 months agoencoding/json: fix Decoder.InputOffset regression in goexperiment.jsonv2
Joe Tsai [Mon, 15 Sep 2025 19:56:11 +0000 (12:56 -0700)]
encoding/json: fix Decoder.InputOffset regression in goexperiment.jsonv2

The Decoder.InputOffset method was always ambiguous about the exact
offset returned since anything between the end of the previous token
to the start of the next token could be a valid result.

Empirically, it seems that the behavior was to report
the end of the previous token unless Decoder.More is called,
in which case it reports the start of the next token.

This is an odd semantic since a relatively side-effect free method
like More is not quite so side-effect free.
However, our goal is to preserve historical v1 semantic when possible
regardless of whether it made sense.

Note that jsontext.Decoder.InputOffset consistently always reports
the end of the previous token. Users can explicitly choose the
exact position they want by inspecting the UnreadBuffer.

Fixes #75468

Change-Id: I1e946e83c9d29dfc09f2913ff8d6b2b80632f292
Reviewed-on: https://go-review.googlesource.com/c/go/+/703856
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
3 months agodoc/go_spec.html: update date
Alan Donovan [Wed, 1 Oct 2025 19:07:57 +0000 (15:07 -0400)]
doc/go_spec.html: update date

(addressing comment from review of CL 704737)

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

3 months agotesting/synctest: fix inverted test failure message in TestContextAfterFunc
Frédéric G. MARAND [Wed, 1 Oct 2025 12:46:16 +0000 (12:46 +0000)]
testing/synctest: fix inverted test failure message in TestContextAfterFunc

Fixes #75685

Change-Id: I5592becfde6aaca3d7f0e2f09bc7a9785228523e
GitHub-Last-Rev: 0ff7bd31ecfc23222dae70194621397330f3c2da
GitHub-Pull-Request: golang/go#75687
Reviewed-on: https://go-review.googlesource.com/c/go/+/708275
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
3 months agocmd/go/testdata/script/test_fuzz_fuzztime.txt: disable
Alan Donovan [Tue, 30 Sep 2025 19:11:58 +0000 (15:11 -0400)]
cmd/go/testdata/script/test_fuzz_fuzztime.txt: disable

This test features a 5s timeout, which is far too close
to the natural variance in scheduling on an overloaded
CI builder machine to make a reliable test. Skipping.

Updates #72104

Change-Id: I52133a2d101808c923e316e0c7fdce9edbb31b10
Reviewed-on: https://go-review.googlesource.com/c/go/+/708075
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
3 months agoruntime: move loong64 library entry point to os-agnostic file
qmuntal [Wed, 24 Sep 2025 08:34:25 +0000 (10:34 +0200)]
runtime: move loong64 library entry point to os-agnostic file

The library entry point for loong64 is agnostic to the OS, so move it to
asm_loong64.s. This is similar to what we do for other architectures.

Cq-Include-Trybots: luci.golang.try:gotip-linux-loong64
Change-Id: I6915eb76d3ea72a779e05e78d85f24793169c61f
Reviewed-on: https://go-review.googlesource.com/c/go/+/706416
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 months agoruntime: unify ppc64/ppc64le library entry point
qmuntal [Wed, 24 Sep 2025 06:58:30 +0000 (08:58 +0200)]
runtime: unify ppc64/ppc64le library entry point

Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64le_power10
Change-Id: Ifd7861488b1b47a5d30163552b51838f2bef7248
Reviewed-on: https://go-review.googlesource.com/c/go/+/706395
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 months agotest/codegen: codify handling of floating point constants on arm64
Joel Sing [Mon, 15 Sep 2025 10:10:05 +0000 (20:10 +1000)]
test/codegen: codify handling of floating point constants on arm64

While here, reorder Float32ConstantStore/Float64ConstantStore for
consistency.

Change-Id: Ic1b3e9f9474965d15bc94518d78d1a4a7bda93f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/703756
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Joel Sing <joel@sing.id.au>
Reviewed-by: Keith Randall <khr@google.com>
3 months agocmd/compile/internal/ssa: remove redundant "type:" prefix check
Youlin Feng [Fri, 5 Sep 2025 14:48:48 +0000 (22:48 +0800)]
cmd/compile/internal/ssa: remove redundant "type:" prefix check

Remove redundant "type:" prefix check on symbol names in isFixedLoad,
also refactor some duplicate code into methods.

Change-Id: I8358422596eea8c39d1a30a554bd0aae8b570038
Reviewed-on: https://go-review.googlesource.com/c/go/+/701275
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
3 months agomime: reduce allocs incurred by ParseMediaType
Julien Cretel [Mon, 22 Sep 2025 18:05:12 +0000 (18:05 +0000)]
mime: reduce allocs incurred by ParseMediaType

This change is mostly gardening. It simplifies ParseMediaType and its
helper functions and reduces the amount of allocations they incur.

Here are some benchmark results:

goos: darwin
goarch: amd64
pkg: mime
cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
                      â”‚     old     â”‚                new                 â”‚
                      â”‚   sec/op    â”‚   sec/op     vs base               â”‚
ParseMediaType-8        55.26µ Â± 1%   54.54µ Â± 1%  -1.30% (p=0.000 n=20)
ParseMediaTypeBogus-8   3.551µ Â± 0%   3.427µ Â± 0%  -3.48% (p=0.000 n=20)
geomean                 14.01µ        13.67µ       -2.39%

                      â”‚     old      â”‚                 new                 â”‚
                      â”‚     B/op     â”‚     B/op      vs base               â”‚
ParseMediaType-8        38.48Ki Â± 0%   37.38Ki Â± 0%  -2.85% (p=0.000 n=20)
ParseMediaTypeBogus-8   2.531Ki Â± 0%   2.469Ki Â± 0%  -2.47% (p=0.000 n=20)
geomean                 9.869Ki        9.606Ki       -2.66%

                      â”‚    old     â”‚                new                 â”‚
                      â”‚ allocs/op  â”‚ allocs/op   vs base                â”‚
ParseMediaType-8        457.0 Â± 0%   425.0 Â± 0%   -7.00% (p=0.000 n=20)
ParseMediaTypeBogus-8   25.00 Â± 0%   21.00 Â± 0%  -16.00% (p=0.000 n=20)
geomean                 106.9        94.47       -11.62%

Change-Id: I51198b40396afa51531794a57c50aa88975eae1d
GitHub-Last-Rev: c44e2a2577386d1d776498d29e31821326e20b92
GitHub-Pull-Request: golang/go#75565
Reviewed-on: https://go-review.googlesource.com/c/go/+/705715
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Emmanuel Odeke <emmanuel@orijtech.com>

3 months agomime: extend "builtinTypes" to include a more complete list of common types
Aidan Welch [Thu, 25 Sep 2025 21:00:45 +0000 (21:00 +0000)]
mime: extend "builtinTypes" to include a more complete list of common types

Implement all agreed upon types, using IANA's listed media types to decide
when there is a disagreement in type.  Except in the case of `.wav` where
`audio/wav` is used.

Fixes #69530

Change-Id: Iec99a6ceb534073be83c8390f48799bec3e4cfc7
GitHub-Last-Rev: e314c5ec6d9aba753dca5f6dbb9d1741bac43227
GitHub-Pull-Request: golang/go#69533
Reviewed-on: https://go-review.googlesource.com/c/go/+/614376
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
3 months agocmd/compile: eliminate nil checks on .dict arg
Jake Bailey [Mon, 8 Sep 2025 05:21:15 +0000 (22:21 -0700)]
cmd/compile: eliminate nil checks on .dict arg

The first arg of a generic function is the dictionary. This dictionary
is never nil, but it gets a nil check becuase the dict arg is treated as
a slice during construction.

cmp.Compare[go.shape.int] was:

00006 (+41) TESTB AX, (AX)
00007 (+52) CMPQ CX, BX
00008 (52) JGT 14
00009 (+55) JGE 12
00010 (+56) MOVL $1, AX
00011 (56) RET
00012 (+58) XORL AX, AX
00013 (58) RET
00014 (+53) MOVQ $-1, AX
00015 (53) RET

Note how the function begins with a TESTB that loads the dict to perform
the nil check.

This CL eliminates that nil check.

For most generic functions, this doesn't matter too much, but not
infrequently are generic functions written which never actually use the
dictionary (like cmp.Compare), so I suspect this might help in hot code
to avoid repeatedly touching the dictionary in memory, and in cases
where the generic function is not inlined (and thus the dict dropped).

compilecmp shows these changes (deduped):

cmp.Compare[go.shape.float64] 73 -> 72  (-1.37%)
cmp.Compare[go.shape.int] 26 -> 24  (-7.69%)
cmp.Compare[go.shape.int32] 25 -> 23  (-8.00%)
cmp.Compare[go.shape.int64] 26 -> 24  (-7.69%)
cmp.Compare[go.shape.string] 142 -> 141  (-0.70%)
cmp.Compare[go.shape.uint16] 26 -> 24  (-7.69%)
cmp.Compare[go.shape.uint] 26 -> 24  (-7.69%)
cmp.Compare[go.shape.uint32] 25 -> 23  (-8.00%)
cmp.Compare[go.shape.uint64] 26 -> 24  (-7.69%)
cmp.Compare[go.shape.uint8] 25 -> 23  (-8.00%)
cmp.Compare[go.shape.uintptr] 26 -> 24  (-7.69%)
cmp.Less[go.shape.float64] 35 -> 34  (-2.86%)
cmp.Less[go.shape.int32] 8 -> 6  (-25.00%)
cmp.Less[go.shape.int64] 9 -> 7  (-22.22%)
cmp.Less[go.shape.int] 9 -> 7  (-22.22%)
cmp.Less[go.shape.string] 112 -> 110  (-1.79%)
cmp.Less[go.shape.uint16] 9 -> 7  (-22.22%)
cmp.Less[go.shape.uint32] 8 -> 6  (-25.00%)
cmp.Less[go.shape.uint64] 9 -> 7  (-22.22%)
internal/synctest.Associate[go.shape.struct 114 -> 113  (-0.88%)
internal/trace.(*dataTable[go.shape.uint64,go.shape.string]).insert 805 -> 791  (-1.74%)
internal/trace.(*dataTable[go.shape.uint64,go.shape.struct 858 -> 852  (-0.70%)
main.(*gState[go.shape.int64]).stop 2111 -> 2085  (-1.23%)
main.(*gState[go.shape.int64]).unblock 941 -> 923  (-1.91%)
runtime.fmax[go.shape.float32] 85 -> 83  (-2.35%)
runtime.fmax[go.shape.float64] 89 -> 87  (-2.25%)
runtime.fmin[go.shape.float32] 85 -> 83  (-2.35%)
runtime.fmin[go.shape.float64] 89 -> 87  (-2.25%)
slices.BinarySearch[go.shape.[]string,go.shape.string] 346 -> 337  (-2.60%)
slices.Concat[go.shape.[]uint8,go.shape.uint8] 462 -> 453  (-1.95%)
slices.ContainsFunc[go.shape.[]*cmd/vendor/github.com/google/pprof/profile.Sample,go.shape.*uint8] 170 -> 169  (-0.59%)
slices.ContainsFunc[go.shape.[]*debug/dwarf.StructField,go.shape.*uint8] 170 -> 169  (-0.59%)
slices.ContainsFunc[go.shape.[]*go/ast.Field,go.shape.*uint8] 170 -> 169  (-0.59%)
slices.ContainsFunc[go.shape.[]string,go.shape.string] 186 -> 181  (-2.69%)
slices.Contains[go.shape.[]*cmd/compile/internal/syntax.BranchStmt,go.shape.*cmd/compile/internal/syntax.BranchStmt] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]cmd/compile/internal/syntax.Type,go.shape.interface 223 -> 219  (-1.79%)
slices.Contains[go.shape.[]crypto/tls.CurveID,go.shape.uint16] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]crypto/tls.SignatureScheme,go.shape.uint16] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]*go/ast.BranchStmt,go.shape.*go/ast.BranchStmt] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]go/types.Type,go.shape.interface 223 -> 219  (-1.79%)
slices.Contains[go.shape.[]int,go.shape.int] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]string,go.shape.string] 223 -> 219  (-1.79%)
slices.Contains[go.shape.[]uint16,go.shape.uint16] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]uint8,go.shape.uint8] 44 -> 42  (-4.55%)
slices.Insert[go.shape.[]string,go.shape.string] 1189 -> 1170  (-1.60%)
slices.medianCmpFunc[go.shape.struct 1118 -> 1113  (-0.45%)
slices.medianCmpFunc[go.shape.struct 1214 -> 1209  (-0.41%)
slices.medianCmpFunc[go.shape.struct 889 -> 887  (-0.22%)
slices.medianCmpFunc[go.shape.struct 901 -> 874  (-3.00%)
slices.order2Ordered[go.shape.float64] 89 -> 87  (-2.25%)
slices.order2Ordered[go.shape.uint16] 75 -> 70  (-6.67%)
slices.partialInsertionSortOrdered[go.shape.string] 1115 -> 1110  (-0.45%)
slices.partialInsertionSortOrdered[go.shape.uint16] 358 -> 352  (-1.68%)
slices.partitionEqualOrdered[go.shape.int] 208 -> 203  (-2.40%)
slices.partitionEqualOrdered[go.shape.int32] 208 -> 198  (-4.81%)
slices.partitionEqualOrdered[go.shape.int64] 208 -> 203  (-2.40%)
slices.partitionEqualOrdered[go.shape.uint32] 208 -> 198  (-4.81%)
slices.partitionEqualOrdered[go.shape.uint64] 208 -> 203  (-2.40%)
slices.partitionOrdered[go.shape.float64] 538 -> 533  (-0.93%)
slices.partitionOrdered[go.shape.int] 437 -> 427  (-2.29%)
slices.partitionOrdered[go.shape.int64] 437 -> 427  (-2.29%)
slices.partitionOrdered[go.shape.uint16] 447 -> 442  (-1.12%)
slices.partitionOrdered[go.shape.uint64] 437 -> 427  (-2.29%)
slices.rotateCmpFunc[go.shape.struct 1045 -> 1029  (-1.53%)
slices.rotateCmpFunc[go.shape.struct 1205 -> 1163  (-3.49%)
slices.rotateCmpFunc[go.shape.struct 1226 -> 1176  (-4.08%)
slices.rotateCmpFunc[go.shape.struct 1322 -> 1272  (-3.78%)
slices.rotateCmpFunc[go.shape.struct 1419 -> 1400  (-1.34%)
slices.rotateCmpFunc[go.shape.*uint8] 549 -> 538  (-2.00%)
slices.rotateLeft[go.shape.string] 603 -> 588  (-2.49%)
slices.rotateLeft[go.shape.uint8] 255 -> 250  (-1.96%)
slices.siftDownOrdered[go.shape.int] 181 -> 171  (-5.52%)
slices.siftDownOrdered[go.shape.int32] 181 -> 171  (-5.52%)
slices.siftDownOrdered[go.shape.int64] 181 -> 171  (-5.52%)
slices.siftDownOrdered[go.shape.string] 614 -> 592  (-3.58%)
slices.siftDownOrdered[go.shape.uint32] 181 -> 171  (-5.52%)
slices.siftDownOrdered[go.shape.uint64] 181 -> 171  (-5.52%)
time.parseRFC3339[go.shape.string] 1774 -> 1758  (-0.90%)
unique.(*canonMap[go.shape.struct 280 -> 276  (-1.43%)
unique.clone[go.shape.struct 311 -> 293  (-5.79%)
weak.Make[go.shape.6880e4598856efac32416085c0172278cf0fb9e5050ce6518bd9b7f7d1662440] 136 -> 134  (-1.47%)
weak.Make[go.shape.struct 136 -> 134  (-1.47%)
weak.Make[go.shape.uint8] 136 -> 134  (-1.47%)

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

3 months agoruntime: initialise debug settings much earlier in startup process
Steve Muir [Thu, 18 Sep 2025 14:54:57 +0000 (07:54 -0700)]
runtime: initialise debug settings much earlier in startup process

This is necessary specifically to set the value of `debug.decoratemappings`
sufficiently early in the startup sequence that all memory ranges allocated
can be named appropriately using the new Linux-specific naming API
introduced in #71546.

Example output (on ARM64):
https://gist.github.com/9muir/3667654b9c3f52e8be92756219371672

Fixes: #75324
Change-Id: Ic0b16233f54a45adef1660c4d0df59af2f5af86a
Reviewed-on: https://go-review.googlesource.com/c/go/+/703476
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
3 months ago[dev.simd] cmd/compile, simd: add AES instructions
Junyang Shao [Tue, 23 Sep 2025 05:16:30 +0000 (05:16 +0000)]
[dev.simd] cmd/compile, simd: add AES instructions

AVXAES is a composite feature set, Intel did listed it as "AVXAES" in
the XED data instead of separating them.

The tests will be in the next CL.

Change-Id: I89c97261f2228b2fdafb48f63e82ef6239bdd5ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/706055
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
3 months agoerrors: add AsType
Julien Cretel [Mon, 29 Sep 2025 16:57:53 +0000 (16:57 +0000)]
errors: add AsType

Fixes #51945

Change-Id: Icda169782e796578eba728938134a85b5827d3b6
GitHub-Last-Rev: c6ff335ee1ffb6b7975141795a4632a55247299d
GitHub-Pull-Request: golang/go#75621
Reviewed-on: https://go-review.googlesource.com/c/go/+/707235
Reviewed-by: Carlos Amedee <carlos@golang.org>
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>
3 months agocmd/link/internal/arm64: support Mach-O ARM64_RELOC_SUBTRACTOR in internal linking
qmuntal [Fri, 12 Sep 2025 14:31:01 +0000 (16:31 +0200)]
cmd/link/internal/arm64: support Mach-O ARM64_RELOC_SUBTRACTOR in internal linking

ARM64_RELOC_SUBTRACTOR is the arm64 version of X86_64_RELOC_SUBTRACTOR, which
has been recently implemented in CL 660715.

The standard library still doesn't need it, but I've found it necessary
when statically linking against a library I own.

Change-Id: I138281b12f2304e3673f7dc92f7137e48bf68fdd
Reviewed-on: https://go-review.googlesource.com/c/go/+/703316
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 months agocmd/link/internal/arm64: support Mach-O ARM64_RELOC_POINTER_TO_GOT in internal linking
qmuntal [Fri, 12 Sep 2025 14:23:40 +0000 (16:23 +0200)]
cmd/link/internal/arm64: support Mach-O ARM64_RELOC_POINTER_TO_GOT in internal linking

ARM64_RELOC_POINTER_TO_GOT is the arm64 version of X86_64_RELOC_GOT, which has been support
for many years now.

The standard library still doesn't need it, but I've found it necessary
when statically linking against a library I own.

Change-Id: I8eb7bf3c74aed663a1fc00b5dd986057130f7f7a
Reviewed-on: https://go-review.googlesource.com/c/go/+/703315
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 months agocmd/compile, runtime: always enable Wasm signext and satconv features
Cherry Mui [Mon, 29 Sep 2025 20:14:24 +0000 (16:14 -0400)]
cmd/compile, runtime: always enable Wasm signext and satconv features

These features have been standardized since at least Wasm 2.0.
Always enable them.

The corresponding GOWASM settings are now no-op.

Change-Id: I0e59f21696a69a4e289127988aad629a720b002b
Reviewed-on: https://go-review.googlesource.com/c/go/+/707855
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
3 months agointernal/poll: remove operation fields from FD
qmuntal [Tue, 16 Sep 2025 12:12:25 +0000 (14:12 +0200)]
internal/poll: remove operation fields from FD

Use a sync.Pool to reuse the overlapped object passed to the different
Windows syscalls instead of keeping two of them in the FD struct.

This reduces the size of the FD struct from 248 to 152 bytes.

While here, pin the overlapped object for the duration of the overlapped
IO operation to comply with the memory safety rules.

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-amd64-race
Change-Id: I0161d163f681fe94b822c0c885aaa42c449e5342
Reviewed-on: https://go-review.googlesource.com/c/go/+/704235
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
3 months agointernal/poll: pass the I/O mode instead of an overlapped object in execIO
qmuntal [Tue, 16 Sep 2025 08:52:49 +0000 (10:52 +0200)]
internal/poll: pass the I/O mode instead of an overlapped object in execIO

execIO callers should be agnostic to the fact that it uses an overlapped
object. This will unlock future optimizations and simplifications.

Change-Id: I0a58d992101fa74ac75e3538af04cbc44156f0d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/704175
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
3 months agocrypto/internal/fips140/entropy: add CPU jitter-based entropy source
Filippo Valsorda [Thu, 11 Sep 2025 19:04:05 +0000 (21:04 +0200)]
crypto/internal/fips140/entropy: add CPU jitter-based entropy source

Heavily inspired by the BoringSSL implementation.

Change-Id: I6a6a6964b22826d54700c8b3d555054163cef5fe
Co-authored-by: Daniel Morsing <daniel.morsing@gmail.com>
Cq-Include-Trybots: luci.golang.try:gotip-linux-s390x,gotip-linux-ppc64_power10,gotip-linux-ppc64le_power10,gotip-linux-ppc64le_power8,gotip-linux-arm,gotip-darwin-arm64_15,gotip-windows-arm64,gotip-freebsd-amd64
Reviewed-on: https://go-review.googlesource.com/c/go/+/703015
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: Cherry Mui <cherryyz@google.com>
3 months agocrypto/internal/fips140/mlkem: make CAST conditional
Filippo Valsorda [Mon, 22 Sep 2025 12:05:23 +0000 (14:05 +0200)]
crypto/internal/fips140/mlkem: make CAST conditional

It taks north of 130µs on my machine, which is enough to be worth
shaving off at init time.

Change-Id: I6a6a696463de228bc3e7b9ca10c12ddbaabdf384
Reviewed-on: https://go-review.googlesource.com/c/go/+/707695
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
3 months agoruntime: correct reference to getStackMap in comment
Ian Lance Taylor [Mon, 29 Sep 2025 04:22:09 +0000 (21:22 -0700)]
runtime: correct reference to getStackMap in comment

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

3 months agointernal/poll: remove buf field from operation
qmuntal [Tue, 16 Sep 2025 08:25:58 +0000 (10:25 +0200)]
internal/poll: remove buf field from operation

WSASend and WSARecv functions capture the WSABuf structure before
returning, so there is no need to keep a copy of it in the
operation structure.

Write and Read functions don't need it, they can operate directly
on the byte slice.

To be on the safe side, pin the input byte slice so that stack-allocated
slices don't get moved while overlapped I/O is in progress.

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-amd64-race
Change-Id: I474bed94e11acafa0bdd8392b5dcf8993d8e1ed5
Reviewed-on: https://go-review.googlesource.com/c/go/+/704155
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
3 months agocmd/link: use a .def file to mark exported symbols on Windows
qmuntal [Mon, 22 Sep 2025 13:48:36 +0000 (15:48 +0200)]
cmd/link: use a .def file to mark exported symbols on Windows

Binutils defaults to exporting all symbols when building a Windows DLL.
To avoid that we were marking symbols with __declspec(dllexport) in
the cgo-generated headers, which instructs ld to export only those
symbols. However, that approach makes the headers hard to reuse when
importing the resulting DLL into other projects, as imported symbols
should be marked with __declspec(dllimport).

A better approach is to generate a .def file listing the symbols to
export, which gets the same effect without having to modify the headers.

Updates #30674
Fixes #56994

Change-Id: I22bd0aa079e2be4ae43b13d893f6b804eaeddabf
Reviewed-on: https://go-review.googlesource.com/c/go/+/705776
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Than McIntosh <thanm@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 months agointernal/syscall/windows: regenerate GetFileSizeEx
qmuntal [Mon, 29 Sep 2025 06:37:35 +0000 (08:37 +0200)]
internal/syscall/windows: regenerate GetFileSizeEx

GetFileSizeEx was generated before mkwinsyscall was updated to use
SyscallN. Regenerate to use the new style.

Fixes #75642

Change-Id: Ia473a167633b67fb75b5762d693848ecee425a7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/707615
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 months agocrypto/tls: quote protocols in ALPN error message
Roland Shoemaker [Mon, 29 Sep 2025 17:11:56 +0000 (10:11 -0700)]
crypto/tls: quote protocols in ALPN error message

Quote the protocols sent by the client when returning the ALPN
negotiation error message.

Fixes CVE-2025-58189
Fixes #75652

Change-Id: Ie7b3a1ed0b6efcc1705b71f0f1e8417126661330
Reviewed-on: https://go-review.googlesource.com/c/go/+/707776
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Neal Patel <nealpatel@google.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
Auto-Submit: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
TryBot-Bypass: Roland Shoemaker <roland@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
3 months agocmd/link: don't pass -Wl,-S on Solaris
Cherry Mui [Fri, 26 Sep 2025 13:45:08 +0000 (09:45 -0400)]
cmd/link: don't pass -Wl,-S on Solaris

Solaris linker's -S has a different meaning.

Fixes #75637.

Change-Id: I51e641d5bc6d7f64ab5aa280090c70ec787a1fbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/707096
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
3 months agocmd/link: use correct length for pcln.cutab
Ian Lance Taylor [Mon, 29 Sep 2025 04:25:24 +0000 (21:25 -0700)]
cmd/link: use correct length for pcln.cutab

The pcln.cutab slice holds uint32 elements, as can be seen in the
runtime.moduledata type. The slice was being created with the len
(and cap) set to the size of the slice, which means that the count
was four times too large. This patch sets the correct len/cap.

This doesn't matter for the runtime because nothing looks at
the len of cutab. Since the incorrect len is larger, all valid
indexes remain valid. Using the correct length means that more
invalid indexes will be caught at run time, but such cases are unlikely.
Still, using the correct len is less confusing.

While we're here use the simpler sliceSym for pcln.pclntab.

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

3 months ago[dev.simd] simd: use new data movement instructions to do "fast" transposes
David Chase [Tue, 2 Sep 2025 16:10:26 +0000 (12:10 -0400)]
[dev.simd] simd: use new data movement instructions to do "fast" transposes

This is a test/example/performance-comparison.  Looking at the
generated code shows that there is still a lot of checking that
perhaps we can figure out how to optimize away.

$b/go test -bench=B -benchtime=5x .
goos: linux
goarch: amd64
pkg: simd/internal/simd_test
cpu: Intel(R) Xeon(R) Platinum 8481C CPU @ 2.70GHz
BenchmarkPlainTranspose-88                5 3143116414 ns/op
BenchmarkTiled4Transpose-88               5 1127457328 ns/op
BenchmarkTiled8Transpose-88               5  671788993 ns/op
Benchmark2BlockedTranspose-88             5 1665429657 ns/op
Benchmark3BlockedTranspose-88             5 1208767441 ns/op
Benchmark4BlockedTranspose-88             5  910212696 ns/op
Benchmark5aBlockedTranspose-88            5  939205670 ns/op
Benchmark5bBlockedTranspose-88            5 1018286871 ns/op

Change-Id: I78bae0fd2ff4f511dac4291b898bbb79b0114741
Reviewed-on: https://go-review.googlesource.com/c/go/+/700695
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
3 months agocmd/link: skip TestFlagW on platforms without DWARF symbol table
Richard Miller [Sat, 27 Sep 2025 18:45:36 +0000 (19:45 +0100)]
cmd/link: skip TestFlagW on platforms without DWARF symbol table

As with other DWARF tests, don't run TestFlagW on platforms
where executables don't have a DWARF symbol table.

Fixes #75585

Change-Id: I81014bf59b15e30ac1b2a7d24a52f9647db46c26
Reviewed-on: https://go-review.googlesource.com/c/go/+/706418
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
3 months agoencoding/xml: make use of reflect.TypeAssert
apocelipes [Wed, 24 Sep 2025 03:23:03 +0000 (03:23 +0000)]
encoding/xml: make use of reflect.TypeAssert

To make the code more readable and improve performance:

goos: darwin
goarch: arm64
pkg: encoding/xml
cpu: Apple M4
                 â”‚     old     â”‚                 new                 â”‚
                 â”‚   sec/op    â”‚   sec/op     vs base                â”‚
Marshal-10         1.902µ Â± 1%   1.496µ Â± 1%  -21.37% (p=0.000 n=10)
Unmarshal-10       3.877µ Â± 1%   3.418µ Â± 2%  -11.84% (p=0.000 n=10)
HTMLAutoClose-10   1.314µ Â± 3%   1.333µ Â± 1%        ~ (p=0.270 n=10)
geomean            2.132µ        1.896µ       -11.07%

                 â”‚     old      â”‚                  new                  â”‚
                 â”‚     B/op     â”‚     B/op      vs base                 â”‚
Marshal-10         5.570Ki Â± 0%   5.570Ki Â± 0%       ~ (p=1.000 n=10) Â¹
Unmarshal-10       7.586Ki Â± 0%   7.555Ki Â± 0%  -0.41% (p=0.000 n=10)
HTMLAutoClose-10   3.496Ki Â± 0%   3.496Ki Â± 0%       ~ (p=1.000 n=10) Â¹
geomean            5.286Ki        5.279Ki       -0.14%
¹ all samples are equal

                 â”‚    old     â”‚                 new                 â”‚
                 â”‚ allocs/op  â”‚ allocs/op   vs base                 â”‚
Marshal-10         23.00 Â± 0%   23.00 Â± 0%       ~ (p=1.000 n=10) Â¹
Unmarshal-10       185.0 Â± 0%   184.0 Â± 0%  -0.54% (p=0.000 n=10)
HTMLAutoClose-10   93.00 Â± 0%   93.00 Â± 0%       ~ (p=1.000 n=10) Â¹
geomean            73.42        73.28       -0.18%
¹ all samples are equal

Updates #62121

Change-Id: Ie458e7458d4358c380374571d380ca3b65ca87bb
GitHub-Last-Rev: bb6bb3039328ca1d53ee3d56fd6597109ed76b09
GitHub-Pull-Request: golang/go#75483
Reviewed-on: https://go-review.googlesource.com/c/go/+/704215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
3 months agoruntime: jump instead of branch in netbsd/arm64 entry point
qmuntal [Mon, 29 Sep 2025 12:14:28 +0000 (14:14 +0200)]
runtime: jump instead of branch in netbsd/arm64 entry point

CL 706175 removed the NOFRAME directive from _rt0_arm64_netbsd but
did not change the BL instruction to a JMP instruction. This causes the
frame pointer to be stored on the stack, this making direct load from
RSP to be off by 8 bytes.

Cq-Include-Trybots: luci.golang.try:gotip-netbsd-arm64
Change-Id: I0c212fbaba74cfce508f961090dc6e66154c3054
Reviewed-on: https://go-review.googlesource.com/c/go/+/707675
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 months agodebug/elf: prevent offset overflow
Jes Cok [Thu, 25 Sep 2025 04:41:12 +0000 (04:41 +0000)]
debug/elf: prevent offset overflow

When applying relocations, a malformed ELF file can provide an offset
that, when added to the relocation size, overflows. This wrapped-around
value could then incorrectly pass the bounds check, leading to a panic
when the slice is accessed with the original large offset.

This change eliminates the manual bounds and overflow checks
and writes a relocation to slice by calling putUint.

The putUint helper function centralizes the logic for validating slice
access, correctly handling both out-of-bounds and integer overflow conditions.
This simplifies the relocation code and improves robustness when parsing
malformed ELF files.

Fixes #75516

Change-Id: I00d806bf5501a9bf70200585ba4fd0475d7b2ddc
GitHub-Last-Rev: 49144311d31fecc63cb81b6c31bf9a206acb0596
GitHub-Pull-Request: golang/go#75522
Reviewed-on: https://go-review.googlesource.com/c/go/+/705075
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Commit-Queue: Ian Lance Taylor <iant@golang.org>

3 months agoall: fix typos
AN Long [Thu, 25 Sep 2025 14:38:19 +0000 (23:38 +0900)]
all:  fix typos

Change-Id: I290812905b6b5c52f289f7f8524f93aef19e6efe
Reviewed-on: https://go-review.googlesource.com/c/go/+/706775
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Sean Liao <sean@liao.dev>
3 months agocmd/compile: implement jump table on loong64
limeidan [Fri, 19 Sep 2025 03:18:13 +0000 (11:18 +0800)]
cmd/compile: implement jump table on loong64

Following CL 357330, use jump tables on Loong64.

goos: linux
goarch: loong64
pkg: cmd/compile/internal/test
cpu: Loongson-3A6000-HV @ 2500.00MHz
                                 â”‚     old     â”‚                 new                 â”‚
                                 â”‚   sec/op    â”‚   sec/op     vs base                â”‚
Switch8Predictable                 2.352n Â± 0%   2.101n Â± 0%  -10.65% (p=0.000 n=10)
Switch8Unpredictable               11.99n Â± 0%   10.25n Â± 0%  -14.51% (p=0.000 n=10)
Switch32Predictable                3.153n Â± 0%   1.887n Â± 1%  -40.14% (p=0.000 n=10)
Switch32Unpredictable              12.47n Â± 0%   10.22n Â± 0%  -18.00% (p=0.000 n=10)
SwitchStringPredictable            3.162n Â± 0%   3.352n Â± 0%   +6.01% (p=0.000 n=10)
SwitchStringUnpredictable          14.70n Â± 0%   13.31n Â± 0%   -9.46% (p=0.000 n=10)
SwitchTypePredictable              3.702n Â± 0%   2.201n Â± 0%  -40.55% (p=0.000 n=10)
SwitchTypeUnpredictable            16.18n Â± 0%   14.48n Â± 0%  -10.51% (p=0.000 n=10)
SwitchInterfaceTypePredictable     7.654n Â± 0%   9.680n Â± 0%  +26.47% (p=0.000 n=10)
SwitchInterfaceTypeUnpredictable   22.04n Â± 0%   22.44n Â± 0%   +1.81% (p=0.000 n=10)
geomean                            7.441n        6.469n       -13.07%

Change-Id: Id6f30fa73349c60fac17670084daee56973a955f
Reviewed-on: https://go-review.googlesource.com/c/go/+/705396
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
3 months agoos/user: simplify go:build
Kir Kolyshkin [Thu, 11 Sep 2025 22:45:37 +0000 (15:45 -0700)]
os/user: simplify go:build

The go:build constraint for these files is way too complicated,
and can be simplified by using unix tag.

Change-Id: Id8278db0ba799a4e951d3c976f77c7402bebb332
Reviewed-on: https://go-review.googlesource.com/c/go/+/703155
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 months agoruntime: use a smaller arena size on Wasm
Cherry Mui [Sun, 22 Jun 2025 19:40:02 +0000 (15:40 -0400)]
runtime: use a smaller arena size on Wasm

On Wasm, some programs have very small heap. Currently,
we use 4 MB arena size (like all other 32-bit platforms).
For a very small program, it needs to allocate one heap
arena, 4 MB size at a 4 MB aligned address. So we'll
need 8 MB of linear memory, whereas only a smaller
portion is actually used by the program. On Wasm, samll
programs are not uncommon (e.g. WASI plugins), and
users are concerned about the memory usage.

This CL switches to a smaller arena size, as well as a
smaller page allocator chunk size (both are now 512 KB).
So the heap will be grown in 512 KB granularity. For a
helloworld program, it now uses less than 3 MB of
linear memory, instead of 8 MB.

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

3 months agonet/http: add HTTP2Config.StrictMaxConcurrentRequests
Damien Neil [Wed, 25 Sep 2024 18:10:07 +0000 (11:10 -0700)]
net/http: add HTTP2Config.StrictMaxConcurrentRequests

Add a field to HTTP2Config controlling how we behave when an HTTP/2
connection reaches its concurrency limit.

This field will have no effect until golang.org/x/net/http2 is
updated to make use of it, and h2_bundle.go is updated with the
new http2 package.

For #67813

Change-Id: Ic72a0986528abb21649f28e9fe7cf6e1236b388d
Reviewed-on: https://go-review.googlesource.com/c/go/+/615875
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
3 months agonet/http: add more tests of transport connection pool
Damien Neil [Wed, 25 Sep 2024 18:48:17 +0000 (11:48 -0700)]
net/http: add more tests of transport connection pool

Add a variety of addtional tests exercising client connection pooling,
in particular HTTP/2 connection behavior.

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

3 months ago[dev.simd] simd: repair broken comments in generated ops_amd64.go
David Chase [Thu, 25 Sep 2025 19:59:01 +0000 (15:59 -0400)]
[dev.simd] simd: repair broken comments in generated ops_amd64.go

these are for concatSelectedConstant and concatSelectedConstantGrouped

Change-Id: I15211596615b42908cdf11182a05b004b6a17950
Reviewed-on: https://go-review.googlesource.com/c/go/+/706975
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
3 months ago[dev.simd] cmd/compile, simd: add 64-bit select-from-pair methods
David Chase [Sat, 20 Sep 2025 20:52:07 +0000 (16:52 -0400)]
[dev.simd] cmd/compile, simd: add 64-bit select-from-pair methods

these are in the same style as the 32-bit select-from-pair,
including the grouped variant.  This does not quite capture
the full awesome power of VSHUFPD where it can select
differently in each group; that will be some other method,
that is more complex.

Change-Id: I807ddd7c1256103b5b0d7c5d60bd70b185e3aaf0
Reviewed-on: https://go-review.googlesource.com/c/go/+/705695
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
3 months ago[dev.simd] simd, cmd/compile: add 128 bit select-from-pair
David Chase [Fri, 19 Sep 2025 17:07:59 +0000 (13:07 -0400)]
[dev.simd] simd, cmd/compile: add 128 bit select-from-pair

Using this name until a better one appears:
   x.Select128FromPair(3, 2, y)

Includes test for constant and variable case.
Checks for unexpected immediates (using the zeroing flag,
which is not supported for this intrinsic) and panics.

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

3 months agoos/user: use getgrouplist on illumos && cgo
Kir Kolyshkin [Thu, 11 Sep 2025 16:57:00 +0000 (09:57 -0700)]
os/user: use getgrouplist on illumos && cgo

The getgrouplist call is available on Illumos since December 2020:

    https://github.com/illumos/illumos-gate/commit/f2c438c5058c64b7373448f239156bf60009abcb

We can assume it is available for users now. Let's switch to using it
when cgo is enabled.

Since neither LUCY nor legacy trybots provide illumos, I tested this
locally in a OpenIndiana VM, with and without osusergo, with cgo enabled
and disabled.

This is a continuation of CL 315278.

Fixes #14709

Change-Id: I922049e7ea5f450f6900914b30967e522e56cfc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/702975
Reviewed-by: Andrew Stormont <andyjstormont@gmail.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Kirill Kolyshkin <kolyshkin@gmail.com>
TryBot-Bypass: Kirill Kolyshkin <kolyshkin@gmail.com>

3 months ago[dev.simd] cmd/compile: don't require single use for SIMD load/store folding
Cherry Mui [Fri, 26 Sep 2025 18:38:22 +0000 (14:38 -0400)]
[dev.simd] cmd/compile: don't require single use for SIMD load/store folding

For load and store on scalar values, we fold the address to the
load/stoer instruction without requiring the address having one
use. Do the same for SIMD, and remove the single use check.

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

3 months agointernal/poll: simplify WriteMsg and ReadMsg on Windows
qmuntal [Tue, 16 Sep 2025 07:14:47 +0000 (09:14 +0200)]
internal/poll: simplify WriteMsg and ReadMsg on Windows

Let newWSAMsg retrieve the socket from the sync pool for unconnected
sockets instead of forcing the caller to do it.

Change-Id: I9b3d30bf3f5be187cbde5735d519b3b14f7b3008
Reviewed-on: https://go-review.googlesource.com/c/go/+/704116
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
3 months ago[dev.simd] cmd/compile: remove unnecessary code from early simd prototype
Cherry Mui [Fri, 26 Sep 2025 17:44:48 +0000 (13:44 -0400)]
[dev.simd] cmd/compile: remove unnecessary code from early simd prototype

The code overwrites a SIMD vector's register numbers is from an
early prototype. Now CalcStructSize and simdify take care of it.

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

3 months agoruntime: move TestReadMetricsSched to testprog
Michael Anthony Knyszek [Fri, 26 Sep 2025 17:05:43 +0000 (17:05 +0000)]
runtime: move TestReadMetricsSched to testprog

There are just too many flakes resulting from background pollution by
the testing package and other tests. Run in a subprocess where at least
the environment can be more tightly controlled.

Fixes #75049.

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

3 months ago[dev.simd] cmd/compile: make condtion of CanSSA smarter for SIMD fields
Junyang Shao [Fri, 19 Sep 2025 04:38:19 +0000 (04:38 +0000)]
[dev.simd] cmd/compile: make condtion of CanSSA smarter for SIMD fields

This CL tires to improve a situation pointed out by
https://github.com/golang/go/issues/73787#issuecomment-3305494947.

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

3 months ago[dev.simd] simd: generalize select-float32-from-pair
David Chase [Thu, 11 Sep 2025 09:35:35 +0000 (05:35 -0400)]
[dev.simd] simd: generalize select-float32-from-pair

This adds methods SelectFromPair for {Int,Uint,Float}32x4
and SelectFromPairGrouped for {Int,Uint,Float}32x8.

Each of these has the signature
```
 func(x T32xK.Method(a,b,c,d uint8, y T32xK) T32xK)
```
where a, b, c, d can be 0-7 and each one specifies an
element from the concatenated elements of x (0-3) and
y (4-7).  When a, b, c, d are constants, 1 or 2
instructions are generated, otherwise, it's done the
harder-slower way with a function call.

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

3 months agocmd/link: don't pass -Wl,-S on AIX
Cherry Mui [Fri, 26 Sep 2025 13:56:12 +0000 (09:56 -0400)]
cmd/link: don't pass -Wl,-S on AIX

The AIX linker's -S flag has a different meaning. Don't pass it.

Updates #75618.

Change-Id: I98faabea3435cde255f4c2d25f34dde9f69b7ec9
Reviewed-on: https://go-review.googlesource.com/c/go/+/707097
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
3 months agocmd/link: skip TestFlagW on AIX
Cherry Mui [Fri, 26 Sep 2025 13:38:23 +0000 (09:38 -0400)]
cmd/link: skip TestFlagW on AIX

The internal/xcoff can only parse XCOFF with symbol table. This
test creates executables without symbol table. Skip the test.

(It might be possible to make internal/xcoff work with binaries
without symbol table? Leave it for the future.)

Fixes #75618.

Change-Id: I273ffefee5376d987accd5aa48c9473d2b3df055
Reviewed-on: https://go-review.googlesource.com/c/go/+/707095
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 months agocmd/compile: fix ICE with new(<untyped expr>)
Cuong Manh Le [Fri, 26 Sep 2025 11:07:18 +0000 (18:07 +0700)]
cmd/compile: fix ICE with new(<untyped expr>)

Fixes #75617

Change-Id: Iaee7d4556db54b9999f5ba8458e7c05c11ccfc36
Reviewed-on: https://go-review.googlesource.com/c/go/+/707075
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
3 months agointernal/poll: don't call SetFilePointerEx in Seek for overlapped handles
qmuntal [Thu, 21 Aug 2025 08:45:23 +0000 (10:45 +0200)]
internal/poll: don't call SetFilePointerEx in Seek for overlapped handles

Overlapped handles don't have the file pointer updated when performing
I/O operations, so there is no need to call syscall.SetFilePointerEx in
FD.Seek. Updating the in-memory offset is sufficient.

Updates #74951 (provides a more complete fix)

Change-Id: Ibede6625cdbd501fc92cfdf8ce2782ec291af2b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/698035
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
3 months agomime/multipart: percent-encode CR and LF in header values to avoid CRLF injection
Damien Neil [Thu, 25 Sep 2025 20:24:01 +0000 (13:24 -0700)]
mime/multipart: percent-encode CR and LF in header values to avoid CRLF injection

When provided with a field or file name containing newlines,
multipart.FileContentDisposition and other header-producing functions
could create an invalid header value.

In some scenarios, this could permit a malicious input to perform
a CRLF injection attack:

  field := "field"
  evilFile := "name\"\r\nEvil-Header: \"evil"
  fmt.Printf("Content-Disposition: %v\r\n", multipart.FileContentDisposition(field, evilFile))
  // Prints:
  // Content-Disposition: form-data; name="field"; filename="name"
  // Evil-Header: "evil"

Percent-endode \r and \n characters in headers, as recommended by
https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart/form-data-encoding-algorithm

The above algorithm also recommends using percent-encoding for quotes,
but preserve the existing backslash-escape behavior for now.
Empirically, browsers understand backslash-escape in attribute values.

Fixes #75557

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

3 months agoRevert "cmd/internal/obj/loong64: use the MOVVP instruction to optimize prologue"
abner chenc [Tue, 23 Sep 2025 03:24:56 +0000 (20:24 -0700)]
Revert "cmd/internal/obj/loong64: use the MOVVP instruction to optimize prologue"

This reverts commit eb7c67fdc9e17959647a15db9e7781b9d447061a.

Reason for revert: Causes x/tools/gopls/internal/filecache/TestConcurrency failures, See issue 75571.

Fixes #75571
Fixes #75572

Change-Id: Ife328dce917c63c872da35f4a9e9f7ef8f88c712
Reviewed-on: https://go-review.googlesource.com/c/go/+/706035
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
3 months agoruntime: unify arm64 entry point code
qmuntal [Tue, 23 Sep 2025 15:17:37 +0000 (17:17 +0200)]
runtime: unify arm64 entry point code

There is a lot of duplication in how arm64 OSes handle entry points.
Do as amd64, have all the logic in a common function.

Cq-Include-Trybots: luci.golang.try:gotip-darwin-arm64-longtest,gotip-windows-arm64
Change-Id: I370c25c3c4b107b525aba14e9dcac34a02d9872e
Reviewed-on: https://go-review.googlesource.com/c/go/+/706175
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>

3 months agoruntime: use common library entry point on windows amd64/386
qmuntal [Tue, 23 Sep 2025 16:19:47 +0000 (18:19 +0200)]
runtime: use common library entry point on windows amd64/386

Windows can reuse the common library entry point instead of implementing
a its own version. Note that windows/arm64 already uses the common one.

Change-Id: I1a27bbec04bfd1d58a136638bafcdc0583bd106f
Reviewed-on: https://go-review.googlesource.com/c/go/+/706235
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
3 months agolib/fips140: re-seal v1.0.0
Filippo Valsorda [Sun, 7 Sep 2025 14:52:08 +0000 (16:52 +0200)]
lib/fips140: re-seal v1.0.0

Exceptionally, we decided to make a compliance-related change following
CMVP's updated Implementation Guidance on September 2nd.

The Security Policy will be updated to reflect the new zip hash.

mkzip.go has been modified to accept versions of the form vX.Y.Z-hash,
where the -hash suffix is ignored for fips140.Version() but used to
name the zip file and the unpacked cache directory.

The new zip is generated with

go run ../../src/cmd/go/internal/fips140/mkzip.go -b c2097c7c v1.0.0-c2097c7c

from c2097c7c which is the current release-branch.go1.24 head.

The full diff between the zip file contents is included below.

For #74947
Updates #69536

$ diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c

diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/cast.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/cast.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/cast.go 1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/cast.go 1980-01-10 00:00:00.000000000 +0100
@@ -56,9 +56,10 @@
 }

 // PCT runs the named Pairwise Consistency Test (if operated in FIPS mode) and
-// returns any errors. If an error is returned, the key must not be used.
+// aborts the program (stopping the module input/output and entering the "error
+// state") if the test fails.
 //
-// PCTs are mandatory for every key pair that is generated/imported, including
+// PCTs are mandatory for every generated (but not imported) key pair, including
 // ephemeral keys (which effectively doubles the cost of key establishment). See
 // Implementation Guidance 10.3.A Additional Comment 1.
 //
@@ -66,17 +67,23 @@
 //
 // If a package p calls PCT during key generation, an invocation of that
 // function should be added to fipstest.TestConditionals.
-func PCT(name string, f func() error) error {
+func PCT(name string, f func() error) {
  if strings.ContainsAny(name, ",#=:") {
  panic("fips: invalid self-test name: " + name)
  }
  if !Enabled {
- return nil
+ return
  }

  err := f()
  if name == failfipscast {
  err = errors.New("simulated PCT failure")
  }
- return err
+ if err != nil {
+ fatal("FIPS 140-3 self-test failed: " + name + ": " + err.Error())
+ panic("unreachable")
+ }
+ if debug {
+ println("FIPS 140-3 PCT passed:", name)
+ }
 }
diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/ecdh/ecdh.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ecdh/ecdh.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/ecdh/ecdh.go 1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ecdh/ecdh.go 1980-01-10 00:00:00.000000000 +0100
@@ -161,6 +161,27 @@
  if err != nil {
  continue
  }
+
+ // A "Pairwise Consistency Test" makes no sense if we just generated the
+ // public key from an ephemeral private key. Moreover, there is no way to
+ // check it aside from redoing the exact same computation again. SP 800-56A
+ // Rev. 3, Section 5.6.2.1.4 acknowledges that, and doesn't require it.
+ // However, ISO 19790:2012, Section 7.10.3.3 has a blanket requirement for a
+ // PCT for all generated keys (AS10.35) and FIPS 140-3 IG 10.3.A, Additional
+ // Comment 1 goes out of its way to say that "the PCT shall be performed
+ // consistent [...], even if the underlying standard does not require a
+ // PCT". So we do it. And make ECDH nearly 50% slower (only) in FIPS mode.
+ fips140.PCT("ECDH PCT", func() error {
+ p1, err := c.newPoint().ScalarBaseMult(privateKey.d)
+ if err != nil {
+ return err
+ }
+ if !bytes.Equal(p1.Bytes(), privateKey.pub.q) {
+ return errors.New("crypto/ecdh: public key does not match private key")
+ }
+ return nil
+ })
+
  return privateKey, nil
  }
 }
@@ -188,28 +209,6 @@
  panic("crypto/ecdh: internal error: public key is the identity element")
  }

- // A "Pairwise Consistency Test" makes no sense if we just generated the
- // public key from an ephemeral private key. Moreover, there is no way to
- // check it aside from redoing the exact same computation again. SP 800-56A
- // Rev. 3, Section 5.6.2.1.4 acknowledges that, and doesn't require it.
- // However, ISO 19790:2012, Section 7.10.3.3 has a blanket requirement for a
- // PCT for all generated keys (AS10.35) and FIPS 140-3 IG 10.3.A, Additional
- // Comment 1 goes out of its way to say that "the PCT shall be performed
- // consistent [...], even if the underlying standard does not require a
- // PCT". So we do it. And make ECDH nearly 50% slower (only) in FIPS mode.
- if err := fips140.PCT("ECDH PCT", func() error {
- p1, err := c.newPoint().ScalarBaseMult(key)
- if err != nil {
- return err
- }
- if !bytes.Equal(p1.Bytes(), publicKey) {
- return errors.New("crypto/ecdh: public key does not match private key")
- }
- return nil
- }); err != nil {
- panic(err)
- }
-
  k := &PrivateKey{d: bytes.Clone(key), pub: PublicKey{curve: c.curve, q: publicKey}}
  return k, nil
 }
diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/ecdsa/cast.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ecdsa/cast.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/ecdsa/cast.go 1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ecdsa/cast.go 1980-01-10 00:00:00.000000000 +0100
@@ -51,8 +51,8 @@
  }
 }

-func fipsPCT[P Point[P]](c *Curve[P], k *PrivateKey) error {
- return fips140.PCT("ECDSA PCT", func() error {
+func fipsPCT[P Point[P]](c *Curve[P], k *PrivateKey) {
+ fips140.PCT("ECDSA PCT", func() error {
  hash := testHash()
  drbg := newDRBG(sha512.New, k.d, bits2octets(P256(), hash), nil)
  sig, err := sign(c, k, drbg, hash)
diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/ecdsa/ecdsa.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ecdsa/ecdsa.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/ecdsa/ecdsa.go 1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ecdsa/ecdsa.go 1980-01-10 00:00:00.000000000 +0100
@@ -166,11 +166,6 @@
  return nil, err
  }
  priv := &PrivateKey{pub: *pub, d: d.Bytes(c.N)}
- if err := fipsPCT(c, priv); err != nil {
- // This can happen if the application went out of its way to make an
- // ecdsa.PrivateKey with a mismatching PublicKey.
- return nil, err
- }
  return priv, nil
 }

@@ -203,10 +198,7 @@
  },
  d: k.Bytes(c.N),
  }
- if err := fipsPCT(c, priv); err != nil {
- // This clearly can't happen, but FIPS 140-3 mandates that we check it.
- panic(err)
- }
+ fipsPCT(c, priv)
  return priv, nil
 }

diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/ecdsa/hmacdrbg.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ecdsa/hmacdrbg.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/ecdsa/hmacdrbg.go 1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ecdsa/hmacdrbg.go 1980-01-10 00:00:00.000000000 +0100
@@ -121,7 +121,7 @@
 //
 // This should only be used for ACVP testing. hmacDRBG is not intended to be
 // used directly.
-func TestingOnlyNewDRBG(hash func() fips140.Hash, entropy, nonce []byte, s []byte) *hmacDRBG {
+func TestingOnlyNewDRBG[H fips140.Hash](hash func() H, entropy, nonce []byte, s []byte) *hmacDRBG {
  return newDRBG(hash, entropy, nonce, plainPersonalizationString(s))
 }

diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/ed25519/cast.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ed25519/cast.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/ed25519/cast.go 1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ed25519/cast.go 1980-01-10 00:00:00.000000000 +0100
@@ -12,8 +12,8 @@
  "sync"
 )

-func fipsPCT(k *PrivateKey) error {
- return fips140.PCT("Ed25519 sign and verify PCT", func() error {
+func fipsPCT(k *PrivateKey) {
+ fips140.PCT("Ed25519 sign and verify PCT", func() error {
  return pairwiseTest(k)
  })
 }
diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/ed25519/ed25519.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ed25519/ed25519.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/ed25519/ed25519.go 1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/ed25519/ed25519.go 1980-01-10 00:00:00.000000000 +0100
@@ -69,10 +69,7 @@
  fips140.RecordApproved()
  drbg.Read(priv.seed[:])
  precomputePrivateKey(priv)
- if err := fipsPCT(priv); err != nil {
- // This clearly can't happen, but FIPS 140-3 requires that we check.
- panic(err)
- }
+ fipsPCT(priv)
  return priv, nil
 }

@@ -88,10 +85,6 @@
  }
  copy(priv.seed[:], seed)
  precomputePrivateKey(priv)
- if err := fipsPCT(priv); err != nil {
- // This clearly can't happen, but FIPS 140-3 requires that we check.
- panic(err)
- }
  return priv, nil
 }

@@ -137,12 +130,6 @@

  copy(priv.prefix[:], h[32:])

- if err := fipsPCT(priv); err != nil {
- // This can happen if the application messed with the private key
- // encoding, and the public key doesn't match the seed anymore.
- return nil, err
- }
-
  return priv, nil
 }

diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/fips140.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/fips140.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/fips140.go 1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/fips140.go 1980-01-10 00:00:00.000000000 +0100
@@ -62,6 +62,10 @@
  return "Go Cryptographic Module"
 }

+// Version returns the formal version (such as "v1.0.0") if building against a
+// frozen module with GOFIPS140. Otherwise, it returns "latest".
 func Version() string {
- return "v1.0"
+ // This return value is replaced by mkzip.go, it must not be changed or
+ // moved to a different file.
+ return "v1.0.0"
 }
diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/mlkem/mlkem1024.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/mlkem/mlkem1024.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/mlkem/mlkem1024.go 1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/mlkem/mlkem1024.go 1980-01-10 00:00:00.000000000 +0100
@@ -118,10 +118,7 @@
  var z [32]byte
  drbg.Read(z[:])
  kemKeyGen1024(dk, &d, &z)
- if err := fips140.PCT("ML-KEM PCT", func() error { return kemPCT1024(dk) }); err != nil {
- // This clearly can't happen, but FIPS 140-3 requires us to check.
- panic(err)
- }
+ fips140.PCT("ML-KEM PCT", func() error { return kemPCT1024(dk) })
  fips140.RecordApproved()
  return dk, nil
 }
@@ -149,10 +146,6 @@
  d := (*[32]byte)(seed[:32])
  z := (*[32]byte)(seed[32:])
  kemKeyGen1024(dk, d, z)
- if err := fips140.PCT("ML-KEM PCT", func() error { return kemPCT1024(dk) }); err != nil {
- // This clearly can't happen, but FIPS 140-3 requires us to check.
- panic(err)
- }
  fips140.RecordApproved()
  return dk, nil
 }
diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/mlkem/mlkem768.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/mlkem/mlkem768.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/mlkem/mlkem768.go 1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/mlkem/mlkem768.go 1980-01-10 00:00:00.000000000 +0100
@@ -177,10 +177,7 @@
  var z [32]byte
  drbg.Read(z[:])
  kemKeyGen(dk, &d, &z)
- if err := fips140.PCT("ML-KEM PCT", func() error { return kemPCT(dk) }); err != nil {
- // This clearly can't happen, but FIPS 140-3 requires us to check.
- panic(err)
- }
+ fips140.PCT("ML-KEM PCT", func() error { return kemPCT(dk) })
  fips140.RecordApproved()
  return dk, nil
 }
@@ -208,10 +205,6 @@
  d := (*[32]byte)(seed[:32])
  z := (*[32]byte)(seed[32:])
  kemKeyGen(dk, d, z)
- if err := fips140.PCT("ML-KEM PCT", func() error { return kemPCT(dk) }); err != nil {
- // This clearly can't happen, but FIPS 140-3 requires us to check.
- panic(err)
- }
  fips140.RecordApproved()
  return dk, nil
 }
diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/rsa/keygen.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/rsa/keygen.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/rsa/keygen.go 1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/rsa/keygen.go 1980-01-10 00:00:00.000000000 +0100
@@ -105,7 +105,28 @@
  // negligible chance of failure we can defer the check to the end of key
  // generation and return an error if it fails. See [checkPrivateKey].

- return newPrivateKey(N, 65537, d, P, Q)
+ k, err := newPrivateKey(N, 65537, d, P, Q)
+ if err != nil {
+ return nil, err
+ }
+
+ if k.fipsApproved {
+ fips140.PCT("RSA sign and verify PCT", func() error {
+ hash := []byte{
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
+ 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
+ 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
+ }
+ sig, err := signPKCS1v15(k, "SHA-256", hash)
+ if err != nil {
+ return err
+ }
+ return verifyPKCS1v15(k.PublicKey(), "SHA-256", hash, sig)
+ })
+ }
+
+ return k, nil
  }
 }

diff -ru golang.org/fips140@v1.0.0/fips140/v1.0.0/rsa/rsa.go golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/rsa/rsa.go
--- golang.org/fips140@v1.0.0/fips140/v1.0.0/rsa/rsa.go 1980-01-10 00:00:00.000000000 +0100
+++ golang.org/fips140@v1.0.0-c2097c7c/fips140/v1.0.0-c2097c7c/rsa/rsa.go 1980-01-10 00:00:00.000000000 +0100
@@ -310,26 +310,6 @@
  return errors.New("crypto/rsa: d too small")
  }

- // If the key is still in scope for FIPS mode, perform a Pairwise
- // Consistency Test.
- if priv.fipsApproved {
- if err := fips140.PCT("RSA sign and verify PCT", func() error {
- hash := []byte{
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
- 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
- 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
- }
- sig, err := signPKCS1v15(priv, "SHA-256", hash)
- if err != nil {
- return err
- }
- return verifyPKCS1v15(priv.PublicKey(), "SHA-256", hash, sig)
- }); err != nil {
- return err
- }
- }
-
  return nil
 }

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Change-Id: I6a6a6964b1780f19ec2b5202052de58b47d9342c
Reviewed-on: https://go-review.googlesource.com/c/go/+/701520
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Commit-Queue: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 months agocrypto/internal/fips140: remove key import PCTs, make keygen PCTs fatal
Filippo Valsorda [Fri, 5 Sep 2025 02:19:18 +0000 (22:19 -0400)]
crypto/internal/fips140: remove key import PCTs, make keygen PCTs fatal

CMVP clarified with the September 2nd changes to IG 10.3.A that PCTs
don't need to run on imported keys.

However, PCT failure must enter the error state (which for us is fatal).

Thankfully, now that PCTs only run on key generation, we can be assured
they will never fail.

This change should only affect FIPS 140-3 mode.

While at it, make the CAST/PCT testing more robust, checking
TestConditional is terminated by a fatal error (and not by t.Fatal).

Fixes #74947
Updates #69536

Change-Id: I6a6a696439e1560c10f3cce2cb208fd40c5bc641
Reviewed-on: https://go-review.googlesource.com/c/go/+/701517
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>

3 months agocrypto/internal/fips140: update frozen module version to "v1.0.0"
Filippo Valsorda [Wed, 10 Sep 2025 10:19:49 +0000 (03:19 -0700)]
crypto/internal/fips140: update frozen module version to "v1.0.0"

We are re-sealing the .zip file anyway for another reason, might as well
take the opportunity to fix the "v1.0" mistake.

Note that the actual returned version change will happen when re-sealing
the .zip, as the latest mkzip.go will inject "v1.0.0" instead of "v1.0".

This reapplies CL 701518, reverted in CL 702255.

Change-Id: Ib5b3721bda35c32dd48293b3d1193c12661662dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/702316
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>

3 months agocrypto/internal/fips140/ecdsa: make TestingOnlyNewDRBG generic
Filippo Valsorda [Sun, 7 Sep 2025 14:44:43 +0000 (16:44 +0200)]
crypto/internal/fips140/ecdsa: make TestingOnlyNewDRBG generic

We are re-sealing the .zip file anyway for another reason, might as well
take the opportunity to remove the fips140.Hash type indirection.

Change-Id: I6a6a6964fdb312cc2c64e327f845c398c0f6279b
Reviewed-on: https://go-review.googlesource.com/c/go/+/701519
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Mark Freeman <markfreeman@google.com>
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>

3 months agostd: remove unused declarations
Alan Donovan [Fri, 12 Sep 2025 20:04:24 +0000 (16:04 -0400)]
std: remove unused declarations

One function was unused by mistake, and is now used as intended.

Change-Id: I42ae7481c6f794b310bdac656ea525bd882f146e
Reviewed-on: https://go-review.googlesource.com/c/go/+/706815
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 months ago[dev.simd] all: merge master (d70ad4e) into dev.simd
Cherry Mui [Thu, 25 Sep 2025 17:33:58 +0000 (13:33 -0400)]
[dev.simd] all: merge master (d70ad4e) into dev.simd

Conflicts:

- src/cmd/compile/internal/types2/stdlib_test.go
- src/go/types/stdlib_test.go

Merge List:

+ 2025-09-25 d70ad4e740 sync/atomic: correct Uintptr.Or return doc
+ 2025-09-25 d7abfe4f0d runtime: acquire/release C TSAN lock when calling cgo symbolizer/tracebacker
+ 2025-09-25 393d91aea0 cmd/fix: remove all functionality
+ 2025-09-25 6dceff8bad cmd/link: handle -w flag in external linking mode
+ 2025-09-25 76d088eb74 cmd/internal/obj/riscv: remove ACFLWSP/ACFSWSP and ACFLW/ACFSW
+ 2025-09-25 5225e9dc49 doc/next: document new image/jpeg DCT in release notes
+ 2025-09-25 81a83bba21 cmd: update x/tools@4df13e3
+ 2025-09-25 6b32c613ca go/types: make typeset return an iterator
+ 2025-09-25 fbba930271 image/jpeg: replace fdct.go and idct.go with new implementation in dct.go
+ 2025-09-25 92e093467f image/jpeg: correct and test reference slowFDCT and slowIDCT
+ 2025-09-25 27c7bbc51c image/jpeg: prepare for new FDCT/IDCT implementations
+ 2025-09-24 f15cd63ec4 cmd/compile: don't rely on loop info when there are irreducible loops
+ 2025-09-24 371c1d2fcb cmd/internal/obj/riscv: add support for vector unit-stride fault-only-first load instructions
+ 2025-09-23 411c250d64 runtime: add specialized malloc functions for sizes up to 512 bytes
+ 2025-09-23 d7a38adf4c runtime: eliminate global span queue [green tea]
+ 2025-09-23 7bc1935db5 cmd/compile/internal: support new(expr)
+ 2025-09-23 eb78f13c9f doc/go_spec.html: document new(expr)
+ 2025-09-23 74cc463f9e go/token: add TestRemovedFileFileReturnsNil test
+ 2025-09-23 902dc27ae9 go/token: clear cache after grabbing the mutex in RemoveFile
+ 2025-09-23 a13d085a5b cmd/cgo: don't hardcode section name in TestNumberOfExportedFunctions
+ 2025-09-23 61bf26a9ee cmd/link: fix Macho-O X86_64_RELOC_SUBTRACTOR in internal linking
+ 2025-09-23 4b787c8c2b reflect: remove stale comment in unpackEface
+ 2025-09-23 3df27cd21a cmd/compile: fix typo in comment
+ 2025-09-23 684e8d3363 reflect: allocate memory in TypeAssert[I] only when the assertion succeeds
+ 2025-09-23 a5866ebe40 cmd/compile: prevent shapifying of pointer shape type
+ 2025-09-23 a27261c42f go/types,types2: allow new(expr)
+ 2025-09-23 e93f439ac4 runtime/cgo: retry when CreateThread fails with ERROR_ACCESS_DENIED
+ 2025-09-23 69e74b0aac runtime: deduplicate pMask resize code
+ 2025-09-23 fde10c4ce7 runtime: split gcMarkWorkAvailable into two separate conditions
+ 2025-09-23 5d040df092 runtime: use scan kernels in scanSpan [green tea]
+ 2025-09-23 7e0251bf58 runtime: don't report non-blocked goroutines as "(durable)" in stacks
+ 2025-09-23 22ac328856 cmd/link: make -w behavior consistent on Windows

Change-Id: Id76b5a30a3b6f6669437f97e3320c9bca65a1e96

3 months ago[dev.simd] simd, cmd/compile: mark simd vectors uncomparable
Cherry Mui [Mon, 22 Sep 2025 15:57:19 +0000 (11:57 -0400)]
[dev.simd] simd, cmd/compile: mark simd vectors uncomparable

SIMD vector types are opqaue, and are expected to be operated with
methods. It is not always possible to compare the two vectors
efficiently. Instead of adding more magic to the compiler to
handle the == operator, mark the vector types uncomparable.

Change-Id: I4ca5d5e80ca7d8992dffa7b3c0386b75eb19cfa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/705855
Reviewed-by: Junyang Shao <shaojunyang@google.com>
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
3 months agosync/atomic: correct Uintptr.Or return doc
Michael Pratt [Thu, 25 Sep 2025 17:12:12 +0000 (10:12 -0700)]
sync/atomic: correct Uintptr.Or return doc

Uintptr.Or returns the old value, just like all of the other Or
functions. This was a typo in the original CL 544455.

Fixes #75607.

Change-Id: I260959e7e32e51f1152b5271df6cc51adfa02a4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/706816
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>

3 months agoruntime: acquire/release C TSAN lock when calling cgo symbolizer/tracebacker
Michael Pratt [Fri, 30 May 2025 21:05:41 +0000 (17:05 -0400)]
runtime: acquire/release C TSAN lock when calling cgo symbolizer/tracebacker

When calling into C via cmd/cgo, the generated code calls
_cgo_tsan_acquire / _cgo_tsan_release around the C call to report a
dummy lock to the C/C++ TSAN runtime. This is necessary because the
C/C++ TSAN runtime does not understand synchronization within Go and
would otherwise report false positive race reports. See the comment in
cmd/cgo/out.go for more details.

Various C functions in runtime/cgo also contain manual calls to
_cgo_tsan_acquire/release where necessary to suppress race reports.

However, the cgo symbolizer and cgo traceback functions called from
callCgoSymbolizer and cgoContextPCs, respectively, do not have any
instrumentation [1]. They call directly into user C functions with no
TSAN instrumentation.

This means they have an opportunity to report false race conditions. The
most direct way is via their argument. Both are passed a pointer to a
struct stored on the Go stack, and both write to fields of the struct.
If two calls are passed the same pointer from different threads, the C
TSAN runtime will think this is a race.

This is simple to achieve for the cgo symbolizer function, which the
new regression test does. callCgoSymbolizer is called on the standard
goroutine stack, so the argument is a pointer into the goroutine stack.
If the goroutine moves Ms between two calls, it will look like a race.

On the other hand, cgoContextPCs is called on the system stack. Each M
has a unique system stack, so for it to pass the same argument pointer
on different threads would require the first M to exit, free its stack,
and the same region of address space to be used as the stack for a new
M. Theoretically possible, but quite unlikely.

Both of these are addressed by providing a C wrapper in runtime/cgo that
calls _cgo_tsan_acquire/_cgo_tsan_release around calls to the symbolizer
and traceback functions.

There is a lot of room for future cleanup here. Most runtime/cgo
functions have manual instrumentation in their C implementation. That
could be removed in favor of instrumentation in the runtime. We could
even theoretically remove the instrumentation from cmd/cgo and move it
to cgocall. None of these are necessary, but may make things more
consistent and easier to follow.

[1] Note that the cgo traceback function called from the signal handler
via x_cgo_callers _does_ have manual instrumentation.

Fixes #73949.

Cq-Include-Trybots: luci.golang.try:gotip-freebsd-amd64,gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Change-Id: I6a6a636c9daa38f7fd00694af76b75cb93ba1886
Reviewed-on: https://go-review.googlesource.com/c/go/+/677955
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 months agocmd/fix: remove all functionality
Alan Donovan [Thu, 25 Sep 2025 16:41:08 +0000 (12:41 -0400)]
cmd/fix: remove all functionality

The buildtag fixer has been incorporated into the vet analyzer
of the same name; all other fixers were already no-ops since
CL 695855.

Fixes #73605
Updates #71859

Change-Id: I90b6c730849a5ecbac3e6fb6fc0e062b5de74831
Reviewed-on: https://go-review.googlesource.com/c/go/+/706758
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

3 months agocmd/link: handle -w flag in external linking mode
Cherry Mui [Tue, 16 Sep 2025 17:34:19 +0000 (13:34 -0400)]
cmd/link: handle -w flag in external linking mode

Currently, when the -w flag is set, it doesn't actually disable
the debug info generation with in external linking mode. (It does
make the Go object have no debug info, but C objects may still
have.) Pass "-Wl,-S" to let the external linker disable debug info
generation.

Change-Id: I0fce56b9f23a45546b69b9e6dd027c5527b1bc87
Reviewed-on: https://go-review.googlesource.com/c/go/+/705857
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 months agocmd/internal/obj/riscv: remove ACFLWSP/ACFSWSP and ACFLW/ACFSW
Joel Sing [Tue, 9 Sep 2025 15:00:22 +0000 (01:00 +1000)]
cmd/internal/obj/riscv: remove ACFLWSP/ACFSWSP and ACFLW/ACFSW

These are RV32-only instructions that will not be implemented.

Updates #71105

Change-Id: Ie386fe36e56f1151bb8756088dd79804584317c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/702395
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
3 months agodoc/next: document new image/jpeg DCT in release notes
Russ Cox [Thu, 25 Sep 2025 15:13:45 +0000 (11:13 -0400)]
doc/next: document new image/jpeg DCT in release notes

Fixes #75603.

Change-Id: I0b4b93af467b97c2d4b5703e31605ff4f7970260
Reviewed-on: https://go-review.googlesource.com/c/go/+/706736
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>