Cherry Mui [Tue, 9 Dec 2025 16:48:41 +0000 (11:48 -0500)]
runtime: VZEROUPPER at the end of FilterNilAVX512
VZEROUPPER at the end of FilterNilAVX512 as we're leaving AVX
context. Also explicitly zero Z15, as the high bits are not
guaranteed zero as of CL 728240.
Change-Id: I000a199206d0b8fd4905c8a699e934551bbd3c60
Reviewed-on: https://go-review.googlesource.com/c/go/+/728740 Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
cuishuang [Mon, 8 Dec 2025 04:18:59 +0000 (12:18 +0800)]
cmd: fix some issues in the comments
Change-Id: Id2c4152b43c7ee1a687e49da7dda5a690e554231
Reviewed-on: https://go-review.googlesource.com/c/go/+/727900 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Ian Lance Taylor [Sun, 7 Dec 2025 06:00:20 +0000 (22:00 -0800)]
runtime: on AIX check isarchive before calling libpreinit
On AIX, all externally linked programs call _rt0_ppc64_aix_lib,
as seen in runtime/cgo/gcc_aix_ppc64.c. The idea is that we
only do the library initialization is isarchive is set.
However, before this CL, AIX programs would call libpreinit
before checking isarchive. The effect was that signals were
initialized twice. That caused the signal code to record that
all signals had an existing forwarding address, namely the
Go signal handler that was always installed. This caused signal
forwarding to enter an infinite loop. This caused, for example,
"go test os" to hang forever when running TestStdPipe.
Fixes #76081
Change-Id: I5555f8c5e299d45549f5ce601568dc6b3cff4ecc
Reviewed-on: https://go-review.googlesource.com/c/go/+/727820
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@google.com>
Mark Freeman [Wed, 3 Dec 2025 20:14:22 +0000 (15:14 -0500)]
go/types, types2: add check for finite size at value observance
Each type must be representable by a finite amount of Go source code
after replacing all alias type names, value names, and embedded
interfaces (per #56103) with the RHS from their respective declarations
("expansion"); otherwise the type is invalid.
Furthermore, each type must have a finite size.
Checking for finite source after expansion is handled in decl.go.
Checking for finite size is handled in validtype.go and is delayed to
the end of type checking (unless used in unsafe.Sizeof, in which case
it is computed eagerly).
We can only construct values of valid types. Thus, while a type is
pending (on the object path and thus not yet valid), it cannot construct
a value of its own type (directly or indirectly).
This change enforces the indirect case by validating each type at value
observance (and hence upholding the invariant that values of only valid
types are created). Validation is cached on Named types to avoid
duplicate work.
As an example, consider:
type A [unsafe.Sizeof(B{})]int
type B A
Clearly, since there are no aliases, A and B have finite source. At the
site of B{}, B will be checked for finite size, recursing down the
values of B, at which point A is seen. Since A is on the object path,
there is a cycle preventing B from being proven valid before B{},
violating our invariant.
Note that this change also works for generic types.
Fixes #75918
Fixes #76478
Change-Id: I76d493b5da9571780fed4b3c76803750ec184818
Reviewed-on: https://go-review.googlesource.com/c/go/+/726580
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
Cherry Mui [Mon, 8 Dec 2025 22:41:04 +0000 (17:41 -0500)]
[dev.simd] all: merge master (a33bbf1) into dev.simd
Merge List:
+ 2025-12-08 a33bbf1988 weak: fix weak pointer test to correctly iterate over weak pointers after GC
+ 2025-12-08 a88a96330f cmd/cgo: use doc link for cgo.Handle
+ 2025-12-08 276cc4d3db cmd/link: fix AIX builds after recent linker changes
+ 2025-12-08 f2d96272cb runtime/trace: update TestSubscribers to dump traces
+ 2025-12-08 4837bcc92c internal/trace: skip tests for alloc/free experiment by default
+ 2025-12-08 b5f6816cea cmd/link: generate DWARF for moduledata
+ 2025-12-08 44a39c9dac runtime: only run TestNotInGoMetricCallback when building with cgo
+ 2025-12-08 3a6a034cd6 runtime: disable TestNotInGoMetricCallback on FreeBSD + race
+ 2025-12-08 4122d3e9ea runtime: use atomic C types with atomic C functions
+ 2025-12-08 34397865b1 runtime: deflake TestProfBufWakeup
+ 2025-12-08 d4972f6295 runtime: mark getfp as nosplit
+ 2025-12-05 0d0d5c9a82 test/codegen: test negation with add/sub on riscv64
+ 2025-12-05 2e509e61ef cmd/go: convert some more tests to script tests
+ 2025-12-05 c270e71835 cmd/go/internal/vet: skip -fix on pkgs from vendor or non-main mod
+ 2025-12-05 745349712e runtime: don't count nGsyscallNoP for extra Ms in C
+ 2025-12-05 f3d572d96a cmd/go: fix race applying fixes in fix and vet -fix modes
+ 2025-12-05 76345533f7 runtime: expand Pinner documentation
+ 2025-12-05 b133524c0f cmd/go/testdata/script: skip vet_cache in short mode
+ 2025-12-05 96e142ba2b runtime: skip TestArenaCollision if we run out of hints
+ 2025-12-05 fe4952f116 runtime: relax threadsSlack in TestReadMetricsSched
+ 2025-12-05 8947f092a8 runtime: skip mayMoreStackMove in goroutine leak tests
+ 2025-12-05 44cb82449e runtime/race: set missing argument frame for ppc64x atomic And/Or wrappers
+ 2025-12-05 435e61c801 runtime: reject any goroutine leak test failure that failed to execute
+ 2025-12-05 54e5540014 runtime: print output in case of segfault in goroutine leak tests
+ 2025-12-05 9616c33295 runtime: don't specify GOEXPERIMENT=greenteagc in goroutine leak tests
+ 2025-12-05 2244bd7eeb crypto/subtle: add speculation barrier after DIT
+ 2025-12-05 f84f8d86be cmd/compile: fix mis-infer bounds in slice len/cap calculations
+ 2025-12-05 a70addd3b3 all: fix some comment issues
+ 2025-12-05 93b49f773d internal/runtime/maps: clarify probeSeq doc comment
+ 2025-12-04 91267f0a70 all: update vendored x/tools
+ 2025-12-04 a753a9ed54 cmd/internal/fuzztest: move fuzz tests out of cmd/go test suite
+ 2025-12-04 1681c3b67f crypto: use rand.IsDefaultReader instead of comparing to boring.RandReader
+ 2025-12-04 7b67b68a0d cmd/compile: use isUnsignedPowerOfTwo rather than isPowerOfTwo for unsigneds
+ 2025-12-03 2b62144069 all: REVERSE MERGE dev.simd (9ac524a) into master
cuishuang [Mon, 24 Nov 2025 06:38:30 +0000 (14:38 +0800)]
weak: fix weak pointer test to correctly iterate over weak pointers after GC
This change fixes a bug in the weak pointer test where the loop was
attempting to iterate over a nil slice (bt) instead of the weak
pointer slice (wt).
After setting bt to nil and running GC, the test should iterate over
the weak pointers to verify they've been cleared, not attempt to
iterate over the now-nil strong references.
Change-Id: Ic0425f59da132257770ed87d1bcea5d2c0a54e07
Reviewed-on: https://go-review.googlesource.com/c/go/+/723600 Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Sean Liao <sean@liao.dev>
Ariel Otilibili [Sun, 7 Dec 2025 00:39:34 +0000 (00:39 +0000)]
cmd/cgo: use doc link for cgo.Handle
Change-Id: If6af9842f563fe9233de0563d356e925a7b912f8
GitHub-Last-Rev: e8422e9a5aa9ca3140c96f7abfa4fa4482d709ab
GitHub-Pull-Request: golang/go#76727
Reviewed-on: https://go-review.googlesource.com/c/go/+/727581
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
Ian Lance Taylor [Tue, 2 Dec 2025 00:25:56 +0000 (16:25 -0800)]
cmd/link: fix AIX builds after recent linker changes
This updates XCOFF-specific code for the recent addition
of funcdata to pclntab.
Because XCOFF puts separate symbols into separate csects,
each with their own alignment, it's important to tell the
external linker the expected alignment of each part of pclntab.
Otherwise the offsets within pclntab may change as the external
linker aligns symbols. This CL sets the correct alignment for
each pclntab child symbol, and sets pclntab's alignment to the
max of that of its children.
Tested on the GCC compile farm.
Fixes #76486
Change-Id: I77d8a90c4b4b79d80ca11ede8d9a2aa9cc89f53f
Reviewed-on: https://go-review.googlesource.com/c/go/+/725603
Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
Cherry Mui [Mon, 8 Dec 2025 17:14:24 +0000 (12:14 -0500)]
[dev.simd] cmd/compile: zero only low 128-bit of X15
Zeroing the upper part of X15 may make the CPU think it is
"dirty" and slow down SSE operations. For now, just not zeroing
the upper part, and construct a zero value on the fly if we need
a 256- or 512-bit zero value. Maybe VZEROUPPER works better than
explicitly zeroing X15, but we need to evaluate.
Long term, we probably want to move more things from SSE to AVX.
This essentially undoes CL 698237 and CL 698238, except keeping
using X15 for 128-bit zeroing for SIMD.
Change-Id: I1564e6332c4c57f9721397c92c7c734c5497534c
Reviewed-on: https://go-review.googlesource.com/c/go/+/728240
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
Michael Anthony Knyszek [Mon, 8 Dec 2025 17:48:53 +0000 (17:48 +0000)]
internal/trace: skip tests for alloc/free experiment by default
These tests are just too flaky and I don't have the time to fix them
right now. I also am thinking to just change how trace experiments work,
so it may not be worth taking the time to fix them.
For #70838.
Change-Id: Ia896215a0cbeccac99b73fefc836088f43530849
Reviewed-on: https://go-review.googlesource.com/c/go/+/728122 Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Joel Sing [Mon, 8 Dec 2025 13:11:55 +0000 (00:11 +1100)]
runtime: use atomic C types with atomic C functions
Mark types as _Atomic - fixes breakage introduced in CL 726964
across most LLVM based platforms/builders.
Change-Id: I5e64b9ccb0cf5244977a787a52ee124bc03c10de
Reviewed-on: https://go-review.googlesource.com/c/go/+/728040
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Nick Ripley [Sat, 6 Dec 2025 15:09:38 +0000 (10:09 -0500)]
runtime: deflake TestProfBufWakeup
If CI infrastructure is oversubscribed, the profile buffer reader can be
blocked long enough for the status in the traceback to be something like
"[syscall, 3 minutes]", rather than the "[syscall]" we are looking for.
Tweak the regexp to look for the expected state at the beginning of the
status in the brackets.
While we're here, clarify the possible "race" in the test, which has
more to do with failing to catch a buggy implementation rather than
failing for a correct implementation. Ideally if the implementation is
buggy, we should see the t.Errorf at least some of the time, even if we
don't see it in every run.
Change-Id: Iebd5229d338dc3f973349cea6dd84c506a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/727660 Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
David Chase [Thu, 4 Dec 2025 22:51:04 +0000 (17:51 -0500)]
[dev.simd] simd: add carryless multiply
now with comments, and also a test.
choice of data types, method names, etc, are all up for comment.
It's NOT commutative, because of the immediate operand (unless we
swap the bits of the immediate).
khr@golang.org [Mon, 8 Dec 2025 14:21:39 +0000 (09:21 -0500)]
runtime: mark getfp as nosplit
When compiling with -l, we can't take a stack split here.
Fixes #76702
Change-Id: Ieab1225c6259c7f16bb5188aa84bff615d9db2e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/728060
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@google.com>
Meng Zhuo [Thu, 13 Nov 2025 08:13:31 +0000 (16:13 +0800)]
test/codegen: test negation with add/sub on riscv64
Change-Id: Ic0eca86d3c93707ebd7c716e774ebda55af4f196
Reviewed-on: https://go-review.googlesource.com/c/go/+/703755
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Julian Zhu <jz531210@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Joel Sing <joel@sing.id.au>
matloob [Fri, 5 Dec 2025 20:25:42 +0000 (15:25 -0500)]
cmd/go: convert some more tests to script tests
Convert more tests to script tests so they can run in parallel with the
rest of the script tests. This CL converts
TestPackageMainTestCompilerFlags, TestGoListTest,
TestListTemplateContextFunction, and TestIssue22588.
Change-Id: I4f8410e85d4811e82d85d884d28a2a0d6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/727420
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
Alan Donovan [Fri, 5 Dec 2025 17:41:21 +0000 (12:41 -0500)]
cmd/go/internal/vet: skip -fix on pkgs from vendor or non-main mod
This change causes go fix (and go vet -fix) to skip applying fixes
to any package in the vendor/ tree, including the GOROOT vendor
packages that are part of std, and to any package from a non-main
module (since these usually come from the readonly module cache).
+ test
Fixes golang/go#76479
Change-Id: Ifdb73e09fbe413b4d99a92e5081b8ea43460be0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/727300
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>
Auto-Submit: Alan Donovan <adonovan@google.com>
Michael Anthony Knyszek [Thu, 4 Dec 2025 23:27:03 +0000 (23:27 +0000)]
runtime: don't count nGsyscallNoP for extra Ms in C
In #76435, it turns out that the new metric
/sched/goroutines/not-in-go:goroutines counts C threads that have called
into Go before (on Linux) as not-in-go goroutines. The reason for this
is that the M is still attached to the C thread on Linux as an
optimization, so we don't go through all the trouble of detaching the M
and, of course, decrementing nGsyscallNoP.
There's an easy fix to this accounting issue. The flag on the M,
isExtraInC, says whether a thread with an extra M attached no longer has
any Go on its (logical) stack. When we take the P from an M in this
state, we simply just don't increment nGsyscallNoP. When it calls back
into Go, we similarly skip the decrement to nGsyscallNoP.
This is more efficient than alternatives, like always updating
nGsyscallNoP in cgocallbackg, since that would add a new
read-modify-write atomic onto that fast path. It does mean we count
threads in C with a P still attached as not-in-go, but this transient in
most real programs, assuming the thread indeed does not call back into
Go any time soon.
Fixes #76435.
Change-Id: Id05563bacbe35d3fae17d67fb5ed45fa43fa0548
Reviewed-on: https://go-review.googlesource.com/c/go/+/726964
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Alan Donovan [Thu, 4 Dec 2025 20:29:49 +0000 (15:29 -0500)]
cmd/go: fix race applying fixes in fix and vet -fix modes
Previously, the cmd/fix tool, which is analogous to a compiler
in a "go fix" or "go vet -fix" build, applied its fixes directly
to source files during the build. However, this led to races
since the edits may in some cases occur concurrently with other
build steps that are still reading those source file.
This change separates the computation of the fixes, which
happens during the build, and applying the fixes, which happens
in a phase after the build.
The unitchecker now accepts a FixArchive file name (see CL 726940).
If it is non-empty, the unitchecker will write the fixed files
into an archive instead of updating them directly.
The vet build sets this option, then reads the produced zip
files in the second phase. The files are saved in the cache;
some care is required to sequence the various cache operations
so that a cache hit has all-or-nothing semantics.
The tweak to vet_basic.txt is a sign that there was a latent
bug, inadvertently fixed by this change: because the old approach
relied on side effects of cmd/fix to mutate files, rather than
the current pure-functional approach of computing fixes which
are then applied as a second pass, a cache hit would cause some
edits not to be applied. Now they are applied.
Fixes golang/go#71859
Change-Id: Ib8e70644ec246dcdb20a90794c11ea6fd420247d
Reviewed-on: https://go-review.googlesource.com/c/go/+/727000
Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@google.com>
Michael Anthony Knyszek [Wed, 3 Dec 2025 23:07:26 +0000 (23:07 +0000)]
runtime: expand Pinner documentation
This change expands the Pinner documentation based on a few points of
feedback.
- We need a note that the Pinner has a finalizer.
- We need a note that the Pinner is safe to reuse.
I also added a note that the zero value is ready to use, and expanded
upon the use-cases of a Pinner.
Fixes #76431.
Change-Id: I312385557e67a815db05def02c1b1d7dcaa9d764
Reviewed-on: https://go-review.googlesource.com/c/go/+/726641
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Michael Matloob [Thu, 4 Dec 2025 20:32:53 +0000 (15:32 -0500)]
cmd/go/testdata/script: skip vet_cache in short mode
vet_cache uses a clean cache
Change-Id: I68e9f32e60ad228785e9bf28f1c3a42e6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/726961
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Matloob <matloob@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Michael Matloob <matloob@google.com>
Michael Anthony Knyszek [Wed, 3 Dec 2025 23:22:18 +0000 (23:22 +0000)]
runtime: skip TestArenaCollision if we run out of hints
This seems failure mode seems to have become more common on Windows. I
suspect the randomized heap base address has something to do with it,
but I'm not 100% sure.
What's definitely certain is that we're running out of hints, since
we're seeing failures that mheap_.arenaHints is nil and GetNextArenaHint
doesn't actually check that.
At the very least we can check that and skip. We know that in this case
there's not that much we can do.
Fixes #76566.
Change-Id: I8ccc8994806b6c95e3157eb296b09705637564b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/726527 Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Michael Anthony Knyszek [Wed, 3 Dec 2025 23:13:36 +0000 (23:13 +0000)]
runtime: relax threadsSlack in TestReadMetricsSched
runtime.GC is called in the test and may spin up GOMAXPROCS
(proportional to the initial count) new threads. We need to be robust to
this, and it happens relatively frequently on some platforms.
We didn't notice this earlier since the heap is so miniscule that
runtime.GC essentially finished instantly without all the threads
getting spun up.
Fixes #76613.
Change-Id: I2af02cb090d5c1c952e4db53ad35895b6f23f638
Reviewed-on: https://go-review.googlesource.com/c/go/+/726642
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Michael Anthony Knyszek [Wed, 3 Dec 2025 22:52:45 +0000 (22:52 +0000)]
runtime: skip mayMoreStackMove in goroutine leak tests
mayMoreStackMove may introduce more scheduler chaos because of all the
stack movement (not as much as mayMoreStackPreempt) so let's disable the
tests here too, since we have evidence that they can produce false
negatives under this configuration. Though we're not 100% sure why this
is happening yet, let's at least stop the flow of flaky failures.
For #75729.
Change-Id: I16d13dba9a61fbd47563b21cbf188e4754f58213
Reviewed-on: https://go-review.googlesource.com/c/go/+/726526
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
runtime/race: set missing argument frame for ppc64x atomic And/Or wrappers
The ppc64x TSAN wrappers for atomic And/Or did not initialize R6 with the Go argument frame before calling racecallatomic. Since racecallatomic expects R6 to point to the argument list and dereferences it unconditionally, this led to a nil-pointer dereference under -race.
Other atomic TSAN wrappers (Load/Store/Add/Swap/CAS) already set up R6 in the expected way. This change aligns the And/Or wrappers with the rest by adding the missing R6 initialisation.
This keeps the behavior consistent across all atomic operations on ppc64x.
Fixes #76051.
Change-Id: Iaf578449a6171a0c6f7c33ec6f64c1251297ae6d
Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-ppc64_power8,gotip-linux-ppc64le_power8,gotip-linux-ppc64le_power9,gotip-linux-ppc64le_power10
Reviewed-on: https://go-review.googlesource.com/c/go/+/718560 Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Paul Murphy <paumurph@redhat.com>
Michael Anthony Knyszek [Wed, 3 Dec 2025 22:29:19 +0000 (22:29 +0000)]
runtime: reject any goroutine leak test failure that failed to execute
This is far more general than the regexp, which was necessary only
because runTestProg doesn't return the error. This change makes
runTestProg a wrapper function around a function that *does* return the
error.
For #76526.
Change-Id: Ib3daa75eb0fe314a28a7a368474943ba470d0d4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/726525
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Roland Shoemaker [Thu, 4 Dec 2025 21:26:52 +0000 (13:26 -0800)]
crypto/subtle: add speculation barrier after DIT
When enabling DIT on ARM64, add speculation barrier instructions to
ensure that subsequent instructions are executed using the updated
DIT state.
See https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms#Enable-DIT-for-constant-time-cryptographic-operations
which recommends doing this. The Arm documentation for DIT doesn't tell
you to do this, but it seems prudent.
Change-Id: Idbc87b332650a77b8cb3509c11377bf5c724f3cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/726980
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Cuong Manh Le [Fri, 5 Dec 2025 14:49:53 +0000 (21:49 +0700)]
cmd/compile: fix mis-infer bounds in slice len/cap calculations
CL 704875 enhanced prove to infer bounds when index have a relationship
with len(A) - K. However, the change incorrectly infer "K - len(A)" case,
causing wrong bounds information.
Fixing this by matching exactly "len(A) - K" case.
Fixes #76709
Change-Id: Ibeedff55520658401af5bd3aa7e98cc1bcf38fd6
Reviewed-on: https://go-review.googlesource.com/c/go/+/727180 Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Reviewed-by: David Chase <drchase@google.com>
cuishuang [Thu, 4 Dec 2025 03:39:53 +0000 (11:39 +0800)]
all: fix some comment issues
Change-Id: I5dec35b1432705b3a52859c38e758220282226af
Reviewed-on: https://go-review.googlesource.com/c/go/+/726700
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
The probeSeq doc comment describes the probe sequence as triangular and
gives the formula for terms in the sequence. This formula isn't actually
used in the code, though. List the first few terms of the sequence
explicitly so the connection between the description and the code is
more clear.
Change-Id: I6a6a69648bc94e15df436815c16128ebef3c6eb8
Reviewed-on: https://go-review.googlesource.com/c/go/+/726820
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Dmitri Shuralyov [Thu, 4 Dec 2025 22:57:40 +0000 (17:57 -0500)]
all: update vendored x/tools
Pull in the following x/tools changes:
- CL 726000: go/analysis/passes/modernize: omitzero: suppress on kubebuilder
- CL 726621: internal/refactor/inline: built-ins may affect inference
- CL 727041: go/analysis/passes/modernize: fix stringscut false positives
- CL 727040: go/analysis/unitchecker: write fixed files to an archive
Fixes #76649.
Fixes #76287.
Fixes #76687.
For #71859.
[git-generate]
go install golang.org/x/build/cmd/updatestd@latest
go install golang.org/x/tools/cmd/bundle@latest
updatestd -goroot=$(pwd) -branch=internal-branch.go1.26-vendor
Change-Id: I0a369ad85b06adab3a977c2c523b8214fb53271a
Reviewed-on: https://go-review.googlesource.com/c/go/+/727022
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: Alan Donovan <adonovan@google.com>
Michael Matloob [Thu, 4 Dec 2025 19:21:44 +0000 (14:21 -0500)]
cmd/internal/fuzztest: move fuzz tests out of cmd/go test suite
They are very slow: taking them out of the cmd/go test suite makes the
go command tests go from about 80 seconds to run on my system, to about
50 seconds to run.
Change-Id: I19b5c252bd2b6e6d64821cada961ddaa6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/726960
Auto-Submit: Michael Matloob <matloob@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
qmuntal [Wed, 3 Dec 2025 10:20:41 +0000 (11:20 +0100)]
crypto: use rand.IsDefaultReader instead of comparing to boring.RandReader
Several crypto functions accepting a rand parameter skip calling
boringcrypto when the rand is not boring.RandReader.
The new crypto/internal/rand package currently defines its own Reader
that wraps boring.RandReader. That will unintentionally bypass
boringcrypto when used with the aforementioned functions.
Fixes #76672
Change-Id: Ie0c1345530c734a23815f9593590b5d32604f54d
Reviewed-on: https://go-review.googlesource.com/c/go/+/726220 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Filippo Valsorda <filippo@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
qmuntal [Wed, 3 Dec 2025 11:32:15 +0000 (12:32 +0100)]
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>
Ian Lance Taylor [Wed, 3 Dec 2025 01:01:57 +0000 (17:01 -0800)]
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>
Robert Griesemer [Tue, 2 Dec 2025 19:58:29 +0000 (11:58 -0800)]
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>
Robert Griesemer [Tue, 2 Dec 2025 22:32:13 +0000 (14:32 -0800)]
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>
Keith Randall [Tue, 2 Dec 2025 22:22:34 +0000 (14:22 -0800)]
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>
Devon Mar [Tue, 25 Nov 2025 07:38:09 +0000 (07:38 +0000)]
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: 77900cc1a68cb535b685a63cf84b5413b480df2c
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>
khr@golang.org [Mon, 1 Dec 2025 18:32:23 +0000 (10:32 -0800)]
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>
Nicholas S. Husin [Mon, 24 Nov 2025 19:56:23 +0000 (14:56 -0500)]
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>
Robert Griesemer [Thu, 20 Nov 2025 22:05:27 +0000 (14:05 -0800)]
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>
Damien Neil [Mon, 1 Dec 2025 20:28:19 +0000 (12:28 -0800)]
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>
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>
胡玮文 [Sun, 23 Nov 2025 18:29:24 +0000 (02:29 +0800)]
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>
Ian Lance Taylor [Fri, 28 Nov 2025 22:34:06 +0000 (14:34 -0800)]
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>
Brad Fitzpatrick [Wed, 26 Nov 2025 18:11:41 +0000 (10:11 -0800)]
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>
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>
Dmitri Shuralyov [Mon, 1 Dec 2025 15:32:57 +0000 (10:32 -0500)]
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>
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>
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: f264915ca2964ad8f34ce1deee4f42c2f9dc21bf
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>
Cuong Manh Le [Fri, 28 Nov 2025 10:19:42 +0000 (17:19 +0700)]
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>
Daniel Morsing [Thu, 27 Nov 2025 06:45:20 +0000 (06:45 +0000)]
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>
胡玮文 [Sat, 22 Nov 2025 03:00:47 +0000 (11:00 +0800)]
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>
胡玮文 [Fri, 21 Nov 2025 17:44:14 +0000 (01:44 +0800)]
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>
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>
thepudds [Thu, 20 Nov 2025 19:43:50 +0000 (14:43 -0500)]
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:
(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).
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>
Dave Vasilevsky [Tue, 25 Nov 2025 03:55:45 +0000 (03:55 +0000)]
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: 8f83d009ef0320fd3fe7cf03e55d5d24df57f015
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>
Ian Lance Taylor [Tue, 18 Nov 2025 04:20:26 +0000 (20:20 -0800)]
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>
Ian Lance Taylor [Tue, 18 Nov 2025 02:35:50 +0000 (18:35 -0800)]
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>
Ian Lance Taylor [Tue, 18 Nov 2025 02:29:42 +0000 (18:29 -0800)]
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>
Ian Lance Taylor [Thu, 13 Nov 2025 21:01:14 +0000 (13:01 -0800)]
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>
Ian Lance Taylor [Fri, 7 Nov 2025 20:25:03 +0000 (12:25 -0800)]
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>