Commit graph

64985 commits

Author SHA1 Message Date
Gopher Robot
dcc5fe0c62 api: promote next to go1.26
Change-Id: I078af0e9aa310a94ec5038f2bfd850e4b43a497e
Reviewed-on: https://go-review.googlesource.com/c/go/+/726340
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-12-03 08:36:36 -08:00
qmuntal
7991da1161 crypto/hpke: remove unused hybridKEM field
hybridKEM.pqGenerateKey is not used anywhere. Having it around
is confusing, as it suggests that the mlkem seed is generated within
the mlkem package, when it is not.

Change-Id: Ie0bdb79d6b774db7b21dfff2b966452463f1ce08
Reviewed-on: https://go-review.googlesource.com/c/go/+/726260
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2025-12-03 08:23:24 -08:00
Will Faught
2729e87aa5 doc/next: pluralize 'result'
Change-Id: Id53ee875ee31b43a6d7bd3f180260276ddd4f8b9
GitHub-Last-Rev: c90e386967
GitHub-Pull-Request: golang/go#76664
Reviewed-on: https://go-review.googlesource.com/c/go/+/725922
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2025-12-03 08:04:02 -08:00
Alan Donovan
6e72f526cd doc/next/6-stdlib/99-minor/go/ast/76031.md: add BasicLit caveat
For #76395

Change-Id: Ied054b54f319a2a448ccdfa4b42044250abb5af7
Reviewed-on: https://go-review.googlesource.com/c/go/+/722820
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>
2025-12-03 07:26:36 -08:00
Alan Donovan
fa30b68767 go/{ast,doc}: update BasicLit.ValueEnd as well as ValuePos
For #76395

Change-Id: Ie2ad715a05cb298b08667cfe8a8394f1dfa3936c
Reviewed-on: https://go-review.googlesource.com/c/go/+/722880
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-12-03 06:50:50 -08:00
Ian Lance Taylor
32a9804c7b cmd/link: don't update offset of existing ELF section name
Fixes #76656

Change-Id: If2e823ba1577700af00f5883e4ea5c139e4749c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/726100
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-12-03 00:22:35 -08:00
Cuong Manh Le
509ddf3868 cmd/compile: ensure bloop only kept alive addressable nodes
Fixes #76636

Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
Reviewed-on: https://go-review.googlesource.com/c/go/+/725420
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2025-12-02 16:56:58 -08:00
Robert Griesemer
7cab1b1b26 doc: pre-announce removal of gotypesalias and asynctimerchan GODEBUG flags
This announcement follows the policy outlined in #76163.

For #76472.

Change-Id: I4299e7f474e314810883dc4f50be6afba8c3e3e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/726020
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: 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>
2025-12-02 16:18:09 -08:00
Robert Griesemer
1a64db3a4b spec: remove restriction on channel element types for close built-in (bug fix)
The spec states that if the argument type for close is a type parameter,
it's type set must only contain channels and they must all have the same
element type. This latter requirement (all must have the same element
type) was never enforced by the compiler, nor is it important for
correctness or required by the implementation.

This change removes this requirement also in the spec and thus
documents what was always (since 1.18) the case.

Fixes #74034.

Change-Id: If65d50bfb581b7f37999413088d3d3b1820e054a
Reviewed-on: https://go-review.googlesource.com/c/go/+/725923
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2025-12-02 15:07:19 -08:00
Michael Anthony Knyszek
2e06fa6b68 doc/next: release note for scheduler metrics
For #15490.

Change-Id: Ic268a7d1d54814e903fc44f5f143008fb5d6dcde
Reviewed-on: https://go-review.googlesource.com/c/go/+/725663
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-12-02 14:44:07 -08:00
Michael Anthony Knyszek
77c795011b doc/next: document cgo call overhead improvement
Change-Id: Ibac18513d2f76172665b4f3a4ea09b69ae0bdef3
Reviewed-on: https://go-review.googlesource.com/c/go/+/725664
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-12-02 14:43:44 -08:00
Keith Randall
6e4abe8cef doc: mention stack allocation of slices
Very similar to last release's note.

Change-Id: Ie7afe21d98cee1c9718e53b20e8af8ee18504bb9
Reviewed-on: https://go-review.googlesource.com/c/go/+/725921
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
2025-12-02 14:43:05 -08:00
Michael Anthony Knyszek
88c24de8b5 doc/next: add section for Green Tea
Change-Id: I420e8d673e5d34d1b09c02b8bc84b890da42e320
Reviewed-on: https://go-review.googlesource.com/c/go/+/725662
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-12-02 13:55:43 -08:00
Devon Mar
043b9de658 net: parse addresses without separators in ParseMac
IEEE EUI guidelines states that "an EUI-48 can be represented in the IEEE RA
hexadecimal (hex) form with the octets separated by hyphens, or as a pure
base-16 numerical representation without hyphens"
(https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf p.9).
The latter form is used in Azure Instance Metadata Service
(https://github.com/Azure/azure-container-networking/pull/4122) among others.

Fixes #66682

Change-Id: Id66c23d50ebb1fed1f3bdb5cf3822a8fd60b886d
GitHub-Last-Rev: 77900cc1a6
GitHub-Pull-Request: golang/go#76387
Reviewed-on: https://go-review.googlesource.com/c/go/+/722720
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-12-02 12:42:13 -08:00
khr@golang.org
e432b4f3a1 cmd/compile: more generated equality function tests
Change-Id: I05cd103ea8d8bbee0ad907ff3e594de273d49e86
Reviewed-on: https://go-review.googlesource.com/c/go/+/725600
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2025-12-02 12:32:35 -08:00
Nicholas S. Husin
c1acdcb345 crypto/x509: prevent HostnameError.Error() from consuming excessive resource
Constructing HostnameError.Error() takes O(N^2) runtime due to using a
string concatenation in a loop. Additionally, there is no limit on how
many names are included in the error message. As a result, a malicious
attacker could craft a certificate with an infinite amount of names to
unfairly consume resource.

To remediate this, we will now use strings.Builder to construct the
error message, preventing O(N^2) runtime. When a certificate has 100 or
more names, we will also not print each name individually.

Thanks to Philippe Antoine (Catena cyber) for reporting this issue.

Fixes #76445
Fixes CVE-2025-61729

Change-Id: I6343776ec3289577abc76dad71766c491c1a7c81
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3000
Reviewed-by: Neal Patel <nealpatel@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/725920
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
2025-12-02 12:22:04 -08:00
Robert Griesemer
8ae5d408ed spec: more precise prose for built-in function new
1) explain new(type) (simpler) before new(expr) (more complicated)
2) for new(expr), explain what happens when expr is an untyped bool
3) explain that new(nil) is not permitted
4) streamline examples slightly

Fixes #76122.

Change-Id: I5ddb26bd88241b4b2b9aa9b532a62f7861c2341c
Reviewed-on: https://go-review.googlesource.com/c/go/+/722482
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Commit-Queue: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2025-12-02 10:02:53 -08:00
matloob@golang.org
c5c05a0e43 cmd/go: add test checking version with experiment is valid
For #75953

Change-Id: I6a6a69645d6d2af9be1b076f2460cdb295ea3c6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/720600
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-12-02 07:16:57 -08:00
Michael Pratt
f22d37d574 runtime/internal/testprog: log initial SchedMetrics GOMAXPROCS
For #76613.

Change-Id: I6a6a636ccf28676b9cd1f820bbe42c2f3e974fee
Reviewed-on: https://go-review.googlesource.com/c/go/+/725660
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2025-12-01 14:59:40 -08:00
Damien Neil
8b5db48db1 net/http: deflake TestClientConnReserveAndConsume
This test includes an assertion that a client conn's state hook
is called exactly once, but some of the test cases can result in
two events occurring: A request completes and a connection closes.

Change the assertion to just check that the hook is called
at least once.

Fixes #76480

Change-Id: Ie1438581b072b10623eb3d5fe443294a639c9853
Reviewed-on: https://go-review.googlesource.com/c/go/+/725601
Commit-Queue: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
TryBot-Bypass: Damien Neil <dneil@google.com>
2025-12-01 13:35:16 -08:00
Michael Pratt
94616dad42 internal/runtime/cgroup: remove duplicate readString definition
Both CL 723241 and CL 723581 added identical definitions.

Change-Id: I6a6a636c9e5f8c9080b9389ebf9d3f10305d79ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/725661
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-12-01 13:27:40 -08:00
胡玮文
67851547d8 internal/runtime/cgroup: lineReader fuzz test
The original unit test is converted to a fuzz test, to be more confident
on future refactors. All sub-tests are converted to seed corpus.

Change-Id: Id0c167ed47729a00ea0614d17746ddcc284697d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/723581
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-12-01 12:31:06 -08:00
Michael Pratt
ac3e0ae51a doc: document go tool pprof -http default change
For #74774.

Change-Id: I6a6a636c579fa95938021cc73d7d11a86f8a19a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/725540
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>
2025-12-01 11:56:35 -08:00
Ian Lance Taylor
42e03bbd27 debug/elf: correct case of DWARF in comment
Change-Id: I5b80b0e3e50fafdb732c732cdae6e2756d919d20
Reviewed-on: https://go-review.googlesource.com/c/go/+/725360
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-12-01 09:41:50 -08:00
Brad Fitzpatrick
18015e8c36 doc/next: clean up some Go 1.26 release notes
The Var.Kind stuff was in Go 1.25.

And the net additions were in the wrong tense and didn't have links.

Change-Id: Ie710e1d41c714fe627a3a21a5afb6b7f78301f68
Reviewed-on: https://go-review.googlesource.com/c/go/+/724780
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2025-12-01 09:41:45 -08:00
Dmitri Shuralyov
4be545115c cmd/pprof: update vendored github.com/google/pprof
Pull in the latest published version of github.com/google/pprof
as part of the continuous process of keeping Go's dependencies
up to date.

For #36905.

[git-generate]
cd src/cmd
go get github.com/google/pprof@v0.0.0-20251114195745-4902fdda35c8
go mod tidy
go mod vendor

Change-Id: Id26eb632f637fb2c602d87cb83fdff7f099934ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/725500
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-12-01 09:15:40 -08:00
Lin Lin
16c0f7e152 cmd/compile: run go generate for internal/ir
Updates #70954

Change-Id: I00ddb37650d27a98da921f04570d33535865622c
GitHub-Last-Rev: 69d52f3d72
GitHub-Pull-Request: golang/go#76638
Reviewed-on: https://go-review.googlesource.com/c/go/+/725440
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2025-12-01 09:01:58 -08:00
Dmitri Shuralyov
dc913c316a all: update vendored dependencies
The Go 1.26 code freeze has recently started. This is a time to update
all golang.org/x/... module versions that contribute packages to the
std and cmd modules in the standard library to latest master versions.

For #36905.

[git-generate]
go install golang.org/x/build/cmd/updatestd@latest
go install golang.org/x/tools/cmd/bundle@latest
updatestd -goroot=$(pwd) -branch=master

Change-Id: I39c68d4c36d0c83ac07c3cda3c4d042bb32a9624
Reviewed-on: https://go-review.googlesource.com/c/go/+/725480
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-12-01 08:23:28 -08:00
Alan Donovan
1555fad47d vendor/golang.org/x/tools: update to 1ad6f3d
cmd$ go get golang.org/x/tools@1ad6f3d
cmd$ GOWORK=off go mod tidy
cmd$ GOWORK=off go mod vendor

This merge pulls in the following commits, which include several fixes
needed for go1.26, marked by an asterisk. None of the unmarked commits
affects vendored packages, so it is safe (and simpler) to merge rather
than cherrypick via a release branch.

tools$ git log --oneline 68724afed209...1ad6f3d02713
*4a3f2f81eb go/analysis/passes/printf: panic when function literal is assigned to the blank identifier
*d5d7d21fe7 gopls/internal/cache: fix %q verb use with wrong type
*92a094998a go/analysis/passes/modernize: rangeint: handle usages of loop label
*ffbdcac342 go/analysis/passes/modernize: stditerators: add reflect iters
*2e3e83a050 internal/refactor/inline: preserve local package name used by callee
 d32ec34454 gopls/internal/protocol/generate: move injections to tables.go
 98d172d8bd gopls/internal/protocol: add form field in type CodeAction
 e1317381e4 go/packages: suppress test on (e.g.) wasm
*e31ed53b51 internal/stdlib: regenerate
*6f1f89817d internal/analysis/driverutil: include end positions in -json output
 7839abf5e8 gopls/internal/metadata: document when Module can be nil
 98aa9a7d0b gopls/internal/cache: make unimported completions deterministic
 4c5faddb0f internal/modindex: unescape import paths
 c2c902c441 gopls/completion: avoid nil dereference
*4bf3169c8a go/analysis/passes/modernize: waitgroup: highlight "go func" part
 ba5189b063 gopls/internal/template: fix printf mistake in test
*a7d12506a0 go/analysis/passes/printf: clarify checkForward
 c7a1a29f93 internal/pkgbits: fix printf mistake in test
 af205c0a29 gopls/doc/release/v0.21.0.md: tweaks

Change-Id: I23c991987afeb2db3e0f98f76f8ee5000c8a6e02
Reviewed-on: https://go-review.googlesource.com/c/go/+/725460
Auto-Submit: Alan Donovan <adonovan@google.com>
TryBot-Bypass: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
2025-12-01 08:00:02 -08:00
Aditya Sirish A Yelgundhalli
eec1afeb28 debug/elf: make check for empty symbol section consistent for 64-bit and 32-bit binaries
The check for whether a binary's symbols section is empty is
inconsistent across the 32-bit and 64-bit flows.

Change-Id: I1abc235320a53cf957cfb83c9e7bcad6e52bc529
GitHub-Last-Rev: f264915ca2
GitHub-Pull-Request: golang/go#75334
Reviewed-on: https://go-review.googlesource.com/c/go/+/702195
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2025-12-01 07:29:29 -08:00
Joel Sing
3f94f3d4b2 test/codegen: fix shift tests on riscv64
These were broken by CL 721206, which changes Rsh to RshU for
positive inputs.

Change-Id: I9e38c3c428fb8aeb70cf51e7e76f4711c864f027
Reviewed-on: https://go-review.googlesource.com/c/go/+/723340
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-28 15:26:25 -08:00
Cuong Manh Le
2ac1f9cbc3 cmd/compile: avoid unnecessary interface conversion in bloop
Fixes #76482

Change-Id: I076568d8ae92ad6c9e0a5797cfe5bbfb615f63d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/725180
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2025-11-28 15:18:43 -08:00
Daniel Morsing
de456450e7 runtime/secret: disable tests under memory validating modes
These tests rely on reading memory that has been freed, so any of the
modes that validate memory accesses are going to fail. Disable them for
now.

Fixes #76586.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-msan-clang15,gotip-linux-amd64-asan-clang15,gotip-linux-amd64-race
Change-Id: I14ee5dfccbafa0e4da684a95ee42acf54499b013
Reviewed-on: https://go-review.googlesource.com/c/go/+/725140
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-11-28 06:15:02 -08:00
Alan Donovan
67d4a28707 fmt: document space behavior of Append
Also, introduce the {Print,Fprint,Sprint,Append}{,f,ln}
cross product of functions at the top of the docs.

Fixes #74656

Change-Id: I85a156cd545ca866e579d8020ddf165cd4bcb26f
Reviewed-on: https://go-review.googlesource.com/c/go/+/688877
Reviewed-by: Rob Pike <r@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2025-11-27 19:54:18 -08:00
Daniel Morsing
c079dd13c0 runtime/secret: reorganize tests to fix -buildmode=shared
The testing assembly methods had a linkname that was implicitly
satisfied during the regular build but not there during the shared
build. Fix by moving the testing routine into the package itself.

For good measure, section off the assembly files from the non-experiment
build. Should prevent further build failures as we work on this.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-linux-arm64-longtest
Change-Id: I2b45668e44641ae7880ff14f6402d982c7eaedd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/724001
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-11-27 05:54:25 -08:00
Filippo Valsorda
2947cb0469 runtime/_mkmalloc: fix log.Fatal formatting directive
Change-Id: I9b9b9dbde440c3a24599efd55ef6f85a6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/724281
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
2025-11-27 05:53:03 -08:00
胡玮文
cead111a77 internal/runtime/cgroup: stricter unescapePath
8 and 9 in escape sequence is invalid now, it should be octal.

Escape sequence larger than \377 is invalid now, it does not fit one
byte.

Change-Id: I3fdebce1d054c44919f0e66a33c778b5a2b099e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/723242
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
2025-11-26 22:29:49 -08:00
胡玮文
c2af9f14b4 internal/runtime/cgroup: fix path on non-root mount point
We should trim the mount root (4th field in /proc/self/mountinfo) from
cgroup path read from /proc/self/cgroup before appending it to the mount
point.  Non-root mount points are very common in containers with cgroup
v1.

parseCPURelativePath is renamed to parseCPUCgroup, as it is unclear what
it is relative to. cgroups(7) says "This pathname is relative to the
mount point of the hierarchy." It should mean the root of the hierarchy,
and we cannot concat it to arbirary cgroup mount point. So just use the
word cgroup, since it parses /proc/self/cgroup.

It now returns errMalformedFile if the cgroup pathname does not start
with "/", and errPathTooLong if the pathname can't fit into the buffer.
We already rely on this when composing the path, just make this explicit
to avoid incorrect paths.

We now parse cgroup first then parse the mount point accordingly.  We
consider the previously read cgroup pathname and version to ensure we
got the desired mount point.  The out buffer is reused to pass in the
cgroup, to avoid extra memory allocation.

This should also resolve the race mentioned in the comments, so removing
those comments.  If our cgroup changed between the two read syscalls, we
will stick with the cgroup read from /proc/self/cgroup. This is the same
behavior as cgroup change after FindCPU() returns, so nothing special to
comment about now.

parseCPUMount now returns error when the combined path is too long, to
avoid panic or truncation if we got a really long path from mountinfo.

cgrouptest is changed to use dev returned from stat() to detect
filesystem boundary, since we don't return mount point and sub-path
separately now. This also avoid using os.Root since we don't handle
untrusted input here. os.Root is too complex, and the performance is
bad.

Fixes #76390

Change-Id: Ia9cbd7be3e58a2d51caf27a973fbd201dac06afc
Reviewed-on: https://go-review.googlesource.com/c/go/+/723241
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-11-26 22:09:55 -08:00
胡玮文
6be5de4bc4 internal/runtime/cgroup: simplify escapePath in test
Don't work on rune, kernel does not use utf-8 here.
Can be verified like this:

  # mkdir "$(echo -e "\xff\x20")"
  # mount -t tmpfs tmpfs "$(echo -e "\xff\x20")"
  # tail -n 1 /proc/self/mountinfo | xxd
  00000000: 3133 3334 2031 3030 2030 3a31 3632 202f  1334 100 0:162 /
  00000010: 202f 726f 6f74 2fff 5c30 3430 2072 772c   /root/.\040 rw,
  00000020: 7265 6c61 7469 6d65 2073 6861 7265 643a  relatime shared:
  00000030: 3433 3520 2d20 746d 7066 7320 746d 7066  435 - tmpfs tmpf
  00000040: 7320 7277 0a                             s rw.

Change-Id: I7468b56eb26f14bc809f8f7580535e6562795c62
Reviewed-on: https://go-review.googlesource.com/c/go/+/723300
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-11-26 21:51:52 -08:00
thepudds
481c6df7b9 io: reduce intermediate allocations in ReadAll and have a smaller final result
Currently, io.ReadAll allocates a significant amount of intermediate
memory as it grows its result slice to the size of the input data.

This CL aims to reduce the allocated memory. Geomean benchstat results
comparing existing io.ReadAll to this CL for a variety of input sizes:

                      │     old     |      new       vs base    │
          sec/op           132.2µ        66.32µ     -49.83%
            B/op          645.4Ki       324.6Ki     -49.70%
  final-capacity           178.3k        151.3k     -15.10%
    excess-ratio            1.216         1.033     -15.10%

The corresponding full benchstat results are below. The input data sizes
are a blend of random sizes, power-of-2 sizes, and power-of-10 sizes.

This CL reduces intermediate bytes allocated in io.ReadAll by reading
via a set of slices of exponentially growing size, and then copying
into a final perfectly-sized slice at the end.

The current memory allocations impact real uses. For example, in #50774
two real-world reports were ~60% more bytes allocated via io.ReadAll
compared to an alternate approach, and also a separate report of
~5x more bytes allocated than the input data size of ~5MiB.

Separately, bytes.Buffer.ReadFrom uses a 2x growth strategy, which
usually can beat the pre-existing io.ReadAll on total bytes allocated
but sometimes not (depending on alignment between exact input data size
and growth). That said, bytes.Buffer.ReadFrom usually ends up with
more excess memory used in a larger final result than the current
io.ReadAll (often significantly more).

If we compare bytes.Buffer.ReadFrom to this CL, we also see
better geomean overall results reported with this CL:

                  │  bytes.Buffer  |    io.ReadAll (new)       │
          sec/op           104.6µ        66.32µ       -36.60%
            B/op          466.9Ki        324.6Ki      -30.48%
  final-capacity           247.4k        151.3k       -38.84%
    excess-ratio            1.688         1.033       -38.84%

(Full corresponding benchstat results comparing this CL vs. bytes.Buffer
are at https://go.dev/play/p/eqwk2BkaSwJ).

One challenge with almost any change of growth strategy for something
widely used is there can be a subset of users that benefited more from
the old growth approach (e.g., based on their data size aligning
particularly well with the old growth), even if the majority of users
on average benefit from the new growth approach.

To help mitigate that, this CL somewhat follows the old read pattern
in its early stages.

Here are the full benchstat results comparing the existing
io.ReadAll vs. this CL. The standard metrics are included, plus
the final result capacity and an excess capacity ratio, which is
the final capacity of the result divided by the input data size (so 1.0
is no excess memory present in the result, though due to
size class rounding the ratio is usually above 1.0 unless the
input data size exactly matches a size class).

We consider smaller reported excess capacity to be better for most
uses given it means the final allocation puts less pressure on the GC
(both in cases when it will almost immediately be garbage in user code,
or if for example the final result is held for multiple GC cycles).

The input data sizes used in the benchmarks:
  - Six powers of 10.
  - Six powers of 2.
  - Ten random sizes between 1KiB and 100MiB (chosen uniformly
    on a log scale).
  - size=300 (so that we have something below 512, which is the
    initial read size).

goos: linux
goarch: amd64
pkg: io
cpu: AMD EPYC 7B13
                       │      old     │             io.ReadAll (new)  │
                       │    sec/op    │   sec/op     vs base          │
ReadAll/size=300-16          113.0n ± 0%   115.4n ± 2%   +2.08% (p=0.005 n=20)
ReadAll/size=512-16          295.0n ± 2%   288.7n ± 1%   -2.14% (p=0.006 n=20)
ReadAll/size=1000-16         549.2n ± 1%   492.8n ± 1%  -10.28% (p=0.000 n=20)
ReadAll/size=4096-16         3.193µ ± 1%   2.277µ ± 1%  -28.70% (p=0.000 n=20)
ReadAll/size=6648-16         4.318µ ± 1%   3.100µ ± 1%  -28.21% (p=0.000 n=20)
ReadAll/size=10000-16        7.771µ ± 1%   4.629µ ± 1%  -40.43% (p=0.000 n=20)
ReadAll/size=12179-16        7.724µ ± 1%   5.066µ ± 1%  -34.42% (p=0.000 n=20)
ReadAll/size=16384-16       13.664µ ± 1%   7.309µ ± 1%  -46.51% (p=0.000 n=20)
ReadAll/size=32768-16        24.07µ ± 2%   14.52µ ± 2%  -39.67% (p=0.000 n=20)
ReadAll/size=65536-16        43.14µ ± 2%   24.00µ ± 2%  -44.37% (p=0.000 n=20)
ReadAll/size=80000-16        57.12µ ± 2%   31.28µ ± 2%  -45.24% (p=0.000 n=20)
ReadAll/size=100000-16       75.08µ ± 2%   38.18µ ± 3%  -49.15% (p=0.000 n=20)
ReadAll/size=118014-16       76.06µ ± 1%   50.03µ ± 3%  -34.22% (p=0.000 n=20)
ReadAll/size=131072-16      103.99µ ± 1%   52.31µ ± 2%  -49.70% (p=0.000 n=20)
ReadAll/size=397601-16       518.1µ ± 6%   204.2µ ± 2%  -60.58% (p=0.000 n=20)
ReadAll/size=626039-16       934.9µ ± 3%   398.7µ ± 7%  -57.35% (p=0.000 n=20)
ReadAll/size=1000000-16     1800.3µ ± 8%   651.4µ ± 6%  -63.82% (p=0.000 n=20)
ReadAll/size=1141838-16     2236.3µ ± 5%   710.2µ ± 5%  -68.24% (p=0.000 n=20)
ReadAll/size=2414329-16      4.517m ± 3%   1.471m ± 3%  -67.43% (p=0.000 n=20)
ReadAll/size=5136407-16      8.547m ± 3%   2.060m ± 1%  -75.90% (p=0.000 n=20)
ReadAll/size=10000000-16    13.303m ± 4%   3.767m ± 4%  -71.68% (p=0.000 n=20)
ReadAll/size=18285584-16    23.414m ± 2%   6.790m ± 5%  -71.00% (p=0.000 n=20)
ReadAll/size=67379426-16     55.93m ± 4%   24.50m ± 5%  -56.20% (p=0.000 n=20)
ReadAll/size=100000000-16    84.61m ± 5%   33.84m ± 5%  -60.00% (p=0.000 n=20)
geomean                   132.2µ        66.32µ       -49.83%

                       │      old      │              io.ReadAll (new) │
                       │     B/op      │     B/op      vs base         │
ReadAll/size=300-16            512.0 ± 0%     512.0 ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=512-16          1.375Ki ± 0%   1.250Ki ± 0%   -9.09% (p=0.000 n=20)
ReadAll/size=1000-16         2.750Ki ± 0%   2.125Ki ± 0%  -22.73% (p=0.000 n=20)
ReadAll/size=4096-16         17.00Ki ± 0%   10.12Ki ± 0%  -40.44% (p=0.000 n=20)
ReadAll/size=6648-16         23.75Ki ± 0%   15.75Ki ± 0%  -33.68% (p=0.000 n=20)
ReadAll/size=10000-16        45.00Ki ± 0%   23.88Ki ± 0%  -46.94% (p=0.000 n=20)
ReadAll/size=12179-16        45.00Ki ± 0%   25.88Ki ± 0%  -42.50% (p=0.000 n=20)
ReadAll/size=16384-16        82.25Ki ± 0%   36.88Ki ± 0%  -55.17% (p=0.000 n=20)
ReadAll/size=32768-16       150.25Ki ± 0%   78.88Ki ± 0%  -47.50% (p=0.000 n=20)
ReadAll/size=65536-16        278.3Ki ± 0%   134.9Ki ± 0%  -51.53% (p=0.000 n=20)
ReadAll/size=80000-16        374.3Ki ± 0%   190.9Ki ± 0%  -49.00% (p=0.000 n=20)
ReadAll/size=100000-16       502.3Ki ± 0%   214.9Ki ± 0%  -57.22% (p=0.000 n=20)
ReadAll/size=118014-16       502.3Ki ± 0%   286.9Ki ± 0%  -42.88% (p=0.000 n=20)
ReadAll/size=131072-16       670.3Ki ± 0%   294.9Ki ± 0%  -56.01% (p=0.000 n=20)
ReadAll/size=397601-16      1934.3Ki ± 0%   919.8Ki ± 0%  -52.45% (p=0.000 n=20)
ReadAll/size=626039-16       3.092Mi ± 0%   1.359Mi ± 0%  -56.04% (p=0.000 n=20)
ReadAll/size=1000000-16      4.998Mi ± 0%   2.086Mi ± 0%  -58.27% (p=0.000 n=20)
ReadAll/size=1141838-16      6.334Mi ± 0%   2.219Mi ± 0%  -64.98% (p=0.000 n=20)
ReadAll/size=2414329-16     12.725Mi ± 0%   4.789Mi ± 0%  -62.37% (p=0.000 n=20)
ReadAll/size=5136407-16      25.28Mi ± 0%   10.44Mi ± 0%  -58.71% (p=0.000 n=20)
ReadAll/size=10000000-16     49.84Mi ± 0%   21.92Mi ± 0%  -56.02% (p=0.000 n=20)
ReadAll/size=18285584-16     97.88Mi ± 0%   35.99Mi ± 0%  -63.23% (p=0.000 n=20)
ReadAll/size=67379426-16     375.2Mi ± 0%   158.0Mi ± 0%  -57.91% (p=0.000 n=20)
ReadAll/size=100000000-16    586.7Mi ± 0%   235.9Mi ± 0%  -59.80% (p=0.000 n=20)
geomean                   645.4Ki        324.6Ki       -49.70%

                       │     old     │              io.ReadAll (new)   │
                       │  final-cap  │  final-cap   vs base            │
ReadAll/size=300-16          512.0 ± 0%    512.0 ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=512-16          896.0 ± 0%    512.0 ± 0%  -42.86% (p=0.000 n=20)
ReadAll/size=1000-16        1.408k ± 0%   1.024k ± 0%  -27.27% (p=0.000 n=20)
ReadAll/size=4096-16        5.376k ± 0%   4.096k ± 0%  -23.81% (p=0.000 n=20)
ReadAll/size=6648-16        6.912k ± 0%   6.784k ± 0%   -1.85% (p=0.000 n=20)
ReadAll/size=10000-16       12.29k ± 0%   10.24k ± 0%  -16.67% (p=0.000 n=20)
ReadAll/size=12179-16       12.29k ± 0%   12.29k ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=16384-16       21.76k ± 0%   16.38k ± 0%  -24.71% (p=0.000 n=20)
ReadAll/size=32768-16       40.96k ± 0%   32.77k ± 0%  -20.00% (p=0.000 n=20)
ReadAll/size=65536-16       73.73k ± 0%   65.54k ± 0%  -11.11% (p=0.000 n=20)
ReadAll/size=80000-16       98.30k ± 0%   81.92k ± 0%  -16.67% (p=0.000 n=20)
ReadAll/size=100000-16      131.1k ± 0%   106.5k ± 0%  -18.75% (p=0.000 n=20)
ReadAll/size=118014-16      131.1k ± 0%   122.9k ± 0%   -6.25% (p=0.000 n=20)
ReadAll/size=131072-16      172.0k ± 0%   131.1k ± 0%  -23.81% (p=0.000 n=20)
ReadAll/size=397601-16      442.4k ± 0%   401.4k ± 0%   -9.26% (p=0.000 n=20)
ReadAll/size=626039-16      704.5k ± 0%   630.8k ± 0%  -10.47% (p=0.000 n=20)
ReadAll/size=1000000-16     1.114M ± 0%   1.008M ± 0%   -9.56% (p=0.000 n=20)
ReadAll/size=1141838-16     1.401M ± 0%   1.147M ± 0%  -18.13% (p=0.000 n=20)
ReadAll/size=2414329-16     2.753M ± 0%   2.417M ± 0%  -12.20% (p=0.000 n=20)
ReadAll/size=5136407-16     5.399M ± 0%   5.145M ± 0%   -4.70% (p=0.000 n=20)
ReadAll/size=10000000-16    10.56M ± 0%   10.00M ± 0%   -5.28% (p=0.000 n=20)
ReadAll/size=18285584-16    20.65M ± 0%   18.29M ± 0%  -11.42% (p=0.000 n=20)
ReadAll/size=67379426-16    78.84M ± 0%   67.39M ± 0%  -14.53% (p=0.000 n=20)
ReadAll/size=100000000-16   123.2M ± 0%   100.0M ± 0%  -18.82% (p=0.000 n=20)
geomean                  178.3k        151.3k       -15.10%

                       │      old     │              io.ReadAll (new)  │
                       │ excess-ratio │ excess-ratio  vs base          │
ReadAll/size=300-16           1.707 ± 0%     1.707 ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=512-16           1.750 ± 0%     1.000 ± 0%  -42.86% (p=0.000 n=20)
ReadAll/size=1000-16          1.408 ± 0%     1.024 ± 0%  -27.27% (p=0.000 n=20)
ReadAll/size=4096-16          1.312 ± 0%     1.000 ± 0%  -23.78% (p=0.000 n=20)
ReadAll/size=6648-16          1.040 ± 0%     1.020 ± 0%   -1.92% (p=0.000 n=20)
ReadAll/size=10000-16         1.229 ± 0%     1.024 ± 0%  -16.68% (p=0.000 n=20)
ReadAll/size=12179-16         1.009 ± 0%     1.009 ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=16384-16         1.328 ± 0%     1.000 ± 0%  -24.70% (p=0.000 n=20)
ReadAll/size=32768-16         1.250 ± 0%     1.000 ± 0%  -20.00% (p=0.000 n=20)
ReadAll/size=65536-16         1.125 ± 0%     1.000 ± 0%  -11.11% (p=0.000 n=20)
ReadAll/size=80000-16         1.229 ± 0%     1.024 ± 0%  -16.68% (p=0.000 n=20)
ReadAll/size=100000-16        1.311 ± 0%     1.065 ± 0%  -18.76% (p=0.000 n=20)
ReadAll/size=118014-16        1.111 ± 0%     1.041 ± 0%   -6.30% (p=0.000 n=20)
ReadAll/size=131072-16        1.312 ± 0%     1.000 ± 0%  -23.78% (p=0.000 n=20)
ReadAll/size=397601-16        1.113 ± 0%     1.010 ± 0%   -9.25% (p=0.000 n=20)
ReadAll/size=626039-16        1.125 ± 0%     1.008 ± 0%  -10.40% (p=0.000 n=20)
ReadAll/size=1000000-16       1.114 ± 0%     1.008 ± 0%   -9.52% (p=0.000 n=20)
ReadAll/size=1141838-16       1.227 ± 0%     1.004 ± 0%  -18.17% (p=0.000 n=20)
ReadAll/size=2414329-16       1.140 ± 0%     1.001 ± 0%  -12.19% (p=0.000 n=20)
ReadAll/size=5136407-16       1.051 ± 0%     1.002 ± 0%   -4.66% (p=0.000 n=20)
ReadAll/size=10000000-16      1.056 ± 0%     1.000 ± 0%   -5.30% (p=0.000 n=20)
ReadAll/size=18285584-16      1.129 ± 0%     1.000 ± 0%  -11.43% (p=0.000 n=20)
ReadAll/size=67379426-16      1.170 ± 0%     1.000 ± 0%  -14.53% (p=0.000 n=20)
ReadAll/size=100000000-16     1.232 ± 0%     1.000 ± 0%  -18.83% (p=0.000 n=20)
geomean                    1.216          1.033       -15.10%

                       │ io.ReadAll │              io.ReadAll (new)     │
                       │ allocs/op  │  allocs/op   vs base              │
ReadAll/size=300-16         1.000 ± 0%    1.000 ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=512-16         2.000 ± 0%    3.000 ± 0%  +50.00% (p=0.000 n=20)
ReadAll/size=1000-16        3.000 ± 0%    4.000 ± 0%  +33.33% (p=0.000 n=20)
ReadAll/size=4096-16        7.000 ± 0%    9.000 ± 0%  +28.57% (p=0.000 n=20)
ReadAll/size=6648-16        8.000 ± 0%   10.000 ± 0%  +25.00% (p=0.000 n=20)
ReadAll/size=10000-16       10.00 ± 0%    11.00 ± 0%  +10.00% (p=0.000 n=20)
ReadAll/size=12179-16       10.00 ± 0%    11.00 ± 0%  +10.00% (p=0.000 n=20)
ReadAll/size=16384-16       12.00 ± 0%    13.00 ± 0%   +8.33% (p=0.000 n=20)
ReadAll/size=32768-16       14.00 ± 0%    15.00 ± 0%   +7.14% (p=0.000 n=20)
ReadAll/size=65536-16       16.00 ± 0%    16.00 ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=80000-16       17.00 ± 0%    17.00 ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=100000-16      18.00 ± 0%    17.00 ± 0%   -5.56% (p=0.000 n=20)
ReadAll/size=118014-16      18.00 ± 0%    18.00 ± 0%        ~ (p=1.000 n=20) ¹
ReadAll/size=131072-16      19.00 ± 0%    18.00 ± 0%   -5.26% (p=0.000 n=20)
ReadAll/size=397601-16      23.00 ± 0%    22.00 ± 0%   -4.35% (p=0.000 n=20)
ReadAll/size=626039-16      25.00 ± 0%    23.00 ± 0%   -8.00% (p=0.000 n=20)
ReadAll/size=1000000-16     27.00 ± 0%    24.00 ± 0%  -11.11% (p=0.000 n=20)
ReadAll/size=1141838-16     28.00 ± 0%    24.00 ± 0%  -14.29% (p=0.000 n=20)
ReadAll/size=2414329-16     31.00 ± 0%    26.00 ± 0%  -16.13% (p=0.000 n=20)
ReadAll/size=5136407-16     34.00 ± 0%    28.00 ± 0%  -17.65% (p=0.000 n=20)
ReadAll/size=10000000-16    37.00 ± 0%    30.00 ± 0%  -18.92% (p=0.000 n=20)
ReadAll/size=18285584-16    40.00 ± 0%    31.00 ± 0%  -22.50% (p=0.000 n=20)
ReadAll/size=67379426-16    46.00 ± 0%    35.00 ± 0%  -23.91% (p=0.000 n=20)
ReadAll/size=100000000-16   48.00 ± 0%    36.00 ± 0%  -25.00% (p=0.000 n=20)
geomean                  14.89         14.65        -1.65%

Finally, the read size in this CL currently grows exponentially
at a 1.5x growth rate. The old approach had its read size grow at
a ~1.25x growth rate once the reads are larger. We could consider
for example using a 1.25x read size growth rate here as well.

There are perhaps some ~mild trade-offs. One benefit might
be something like a ~5% smaller peak live heap contribution
(at the end, when copying into the final result) if we used
a 1.25x read growth instead of 1.5x read growth.

That said, for some systems, larger read sizes can trigger
higher throughput behavior further down the stack or
elsewhere in a system, such as via better read-ahead behavior,
larger transfer sizes, etc.

I've observed this effect in various real-world systems,
including distributed systems as well as for example with
spinning platters (which are still widely used, including
backing various "Internet scale" systems). When the effect
exists, it is usually substantial.

Therefore, my guess is it is better to get to larger read
sizes faster, which is one reason the CL is using 1.5x
read size growth rate instead of 1.25x. Also, for something
like peak live heap contribution, we are already getting
substantial wins in this CL for total heap bytes allocated,
so maybe that is OK.

(I have the actual benchmark in a separate commit, which I can
send later, or I can update this CL if preferred).

Fixes #50774
Updates #74299

Change-Id: I65eabf1d83a00fbdbe42e4c697116955f8251740
Reviewed-on: https://go-review.googlesource.com/c/go/+/722500
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-11-26 20:45:34 -08:00
Dave Vasilevsky
cec4d4303f os: allow direntries to have zero inodes on Linux
Some Linux filesystems have been known to return valid enties with
zero inodes. This new behavior also puts Go in agreement with recent
glibc.

Fixes #76428

Change-Id: Ieaf50739a294915a3ea2ef8c5a3bb2a91a186881
GitHub-Last-Rev: 8f83d009ef
GitHub-Pull-Request: golang/go#76448
Reviewed-on: https://go-review.googlesource.com/c/go/+/724220
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-26 20:42:22 -08:00
Ian Lance Taylor
f1bbc66a10 cmd/link: test that moduledata is in its own section
This is a test for CL 720660.

For #76038

Change-Id: I2f630b738ddb5a9c48e3c5d4374c1e995910541a
Reviewed-on: https://go-review.googlesource.com/c/go/+/721480
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2025-11-26 20:29:52 -08:00
Ian Lance Taylor
003f52407a cmd/link: test that findfunctab is in gopclntab section
This is a test for CL 719743.

Change-Id: I2d7b9d00d2d4dd63a21ca00f09eb7c9378ec70f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/721461
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-11-26 20:29:49 -08:00
Ian Lance Taylor
21b6ab57d5 cmd/link: test that funcdata values are in gopclntab section
This is a test for CL 719440.

For #76038

Change-Id: I8fc55118b3c7dea39a36e04ffb060fcb6150af54
Reviewed-on: https://go-review.googlesource.com/c/go/+/721460
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2025-11-26 20:29:46 -08:00
Ian Lance Taylor
c03e25a263 cmd/link: always run current linker in tests
This ensures that the tests are testing the current linker sources,
not the installed linker.

Change-Id: I14a2ca9d413e1af57c7b5a00657c72023626a651
Reviewed-on: https://go-review.googlesource.com/c/go/+/721220
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-11-26 20:10:06 -08:00
Ian Lance Taylor
9f5cd43fe6 cmd/link: put moduledata in its own .go.module section
There is a test for this in CL 721480 later in this series.

For #76038

Change-Id: Ib7ed1f0b0aed2d929ca0f135b54d6b62112cae30
Reviewed-on: https://go-review.googlesource.com/c/go/+/720660
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
2025-11-26 20:07:41 -08:00
Ian Lance Taylor
43cfd785e7 cmd/link, runtime, debug/gosym: move pclntab magic to internal/abi
Change-Id: I2d3c41b0e61b994d7b04bd16a791fd226dc45269
Reviewed-on: https://go-review.googlesource.com/c/go/+/720302
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-26 20:06:46 -08:00
Ian Lance Taylor
312b2034a4 cmd/link: put runtime.findfunctab in the .gopclntab section
There is a test for this in CL 721461 later in this series.

For #76038

Change-Id: I15f9a8d0d5bd9424702a9ca7febb2fa76035aaf8
Reviewed-on: https://go-review.googlesource.com/c/go/+/719743
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-26 20:05:21 -08:00
Ian Lance Taylor
b437d5bf36 cmd/link: put funcdata symbols in .gopclntab section
There is a test for this in CL 721460 later in this series.

For #76038

Change-Id: Icd7a52cbabde5162139dbc4b2c61306c0c748545
Reviewed-on: https://go-review.googlesource.com/c/go/+/719440
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-11-26 20:04:57 -08:00
Ian Lance Taylor
4bc3410b6c cmd/link: build shstrtab from ELF sections
Since before Go 1 the Go linker has handled ELF by first building the
ELF section string table, and then pointing ELF section headers to it.
This duplicates code as sections are effectively created twice,
once with the name and then again with the full section header.
The code duplication also means that it's easy to create unnecessary
section names; for example, every internally linked Go program
currently contains the string ".go.fuzzcntrs" although most do not
have a section by that name.

This CL changes the linker to simply build the section string table
after all the sections are known.

Change-Id: I27ba15b2af3dc1b8d7436b6c409f818aa8e6bfb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/718840
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-26 20:03:00 -08:00