aboutsummaryrefslogtreecommitdiff
path: root/src/internal
AgeCommit message (Collapse)Author
2025-07-20internal/testenv: exclude GOMAXPROCS when building test programfix-runtime-test-GOMAXPROCSShulhan
In the environment where GOMAXPROCS set explicitly, for example to 3 in shell profile, the runtime tests will fail with the following error, ---- ok regexp/syntax 0.428s --- FAIL: TestCgroupGOMAXPROCS (0.81s) crash_test.go:186: running /home/ms/src/go/bin/go build -o /tmp/go-build1753772192/testprog.exe crash_test.go:208: built testprog in 796.664277ms --- FAIL: TestCgroupGOMAXPROCS/containermaxprocs=0 (0.00s) cgroup_linux_test.go:60: /tmp/go-build1753772192/testprog.exe PrintGOMAXPROCS (907.06µs): ok cgroup_linux_test.go:63: output got "3\n" want "4\n" --- FAIL: TestCgroupGOMAXPROCSNoLimit (0.00s) cgroup_linux_test.go:82: /tmp/go-build1753772192/testprog.exe PrintGOMAXPROCS (879.194µs): ok cgroup_linux_test.go:85: output got "3\n" want "4\n" --- FAIL: TestCgroupGOMAXPROCSHigherThanNumCPU (0.00s) cgroup_linux_test.go:102: /tmp/go-build1753772192/testprog.exe PrintGOMAXPROCS (852.396µs): ok cgroup_linux_test.go:105: output got "3\n" want "4\n" --- FAIL: TestCgroupGOMAXPROCSRound (0.01s) --- FAIL: TestCgroupGOMAXPROCSRound/50000 (0.00s) cgroup_linux_test.go:156: /tmp/go-build1753772192/testprog.exe PrintGOMAXPROCS (852.099µs): ok cgroup_linux_test.go:159: output got "3\n" want "2\n" --- FAIL: TestCgroupGOMAXPROCSRound/100000 (0.00s) cgroup_linux_test.go:156: /tmp/go-build1753772192/testprog.exe PrintGOMAXPROCS (894.001µs): ok cgroup_linux_test.go:159: output got "3\n" want "2\n" --- FAIL: TestCgroupGOMAXPROCSRound/150000 (0.00s) cgroup_linux_test.go:156: /tmp/go-build1753772192/testprog.exe PrintGOMAXPROCS (850.897µs): ok cgroup_linux_test.go:159: output got "3\n" want "2\n" --- FAIL: TestCgroupGOMAXPROCSSchedAffinity (0.00s) cgroup_linux_test.go:229: /tmp/go-build1753772192/testprog.exe PrintGOMAXPROCS (867.987µs): ok cgroup_linux_test.go:232: output got "3\n" want "2\n" FAIL FAIL runtime 23.088s ---- This changes exclude the GOMAXPROCS when building program for testing so it does not affect the tests. Change-Id: I590d9eca57026539413cf4c93b37f624f179d534
2025-07-15runtime/maps: fix typo in group.go comment (instrinsified -> intrinsified)dyma solovei
Several comments refer to bitset as 'instrinsified', which is likely a typo, because it refers to the output of the intrinsics implemented with SIMD. Change-Id: I00f26b8d8128592ee0e9dc8a1b1480c93a9542d6 GitHub-Last-Rev: 8a4236710979f2f969210e0b261bdb9ae44f3321 GitHub-Pull-Request: golang/go#74624 Reviewed-on: https://go-review.googlesource.com/c/go/+/688016 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
2025-07-08cmd/go: disable support for multiple vcs in one moduleRoland Shoemaker
Removes the somewhat redundant vcs.FromDir, "allowNesting" argument, which was always enabled, and disallow multiple VCS metadata folders being present in a single directory. This makes VCS injection attacks much more difficult. Also adds a GODEBUG, allowmultiplevcs, which re-enables this behavior. Thanks to RyotaK (https://ryotak.net) of GMO Flatt Security Inc for reporting this issue. Fixes #74380 Fixes CVE-2025-4674 Change-Id: I5787d90cdca8deb3aca6f154efb627df1e7d2789 Reviewed-on: https://go-review.googlesource.com/c/go/+/686515 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Commit-Queue: Carlos Amedee <carlos@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-07-08internal: make struct comment match struct namecuishuang
Change-Id: I85a4051bd3413bd843b17d22cf9120f615cfe8db Reviewed-on: https://go-review.googlesource.com/c/go/+/686295 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Carlos Amedee <carlos@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-07-07internal/trace: only test for sync preemption if async preemption is offMichael Anthony Knyszek
Currently, the test change made for the fix to #68090 is flaky. This is because the sync-point-only goroutine that we expect to be sync preempted might only ever get async preempted in some circumstances. This change adds a variant to all trace tests to run with asyncpreemptoff=1, and the stacks test, the flaky one, only actually checks for the sync-point in the trace when async preemption is disabled. Fixes #74417. Change-Id: Ib6341bbc26921574b8f0fff6dd521ce83f85499c Reviewed-on: https://go-review.googlesource.com/c/go/+/686055 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-07-01internal/abi: fix comment on NonEmptyInterfaceKeith Randall
Change-Id: Ia3f4e844049caf11ae67d1bd6dd48350f51c532f Reviewed-on: https://go-review.googlesource.com/c/go/+/684375 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2025-06-30internal/goexperiment: fix godoc formattingOlivier Mengué
In internal/goexperiment fix godoc formatting (list indent, add godoc links). In internal/buildcfg fix godoc for Experiment.baseline. Change-Id: I30eaba60cbf3978a375b50dda19dbb2830903bdb Reviewed-on: https://go-review.googlesource.com/c/go/+/595915 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Austin Clements <austin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-30sync: disassociate WaitGroups from bubbles on WaitDamien Neil
Fix a race condition in disassociating a WaitGroup in a synctest bubble from its bubble. We previously disassociated the WaitGroup when count becomes 0, but this causes problems when an Add call setting count to 0 races with one incrementing the count. Instead, disassociate a WaitGroup from its bubble when Wait returns. Wait must not be called concurrently with an Add call with a positive delta and a 0 count, so we know that the disassociation will not race with an Add call trying to create a new association. Fixes #74386 Change-Id: I9b519519921f7691869a64a245a5ee65d071d054 Reviewed-on: https://go-review.googlesource.com/c/go/+/684635 Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-27runtime: account for missing frame pointer in preambleMichael Anthony Knyszek
If a goroutine is synchronously preempted, then taking a frame-pointer-based stack trace at that preemption will skip PC of the caller of the function which called into morestack. This happens because the frame pointer is pushed to the stack after the preamble, leaving the stack in an odd state for frame pointer unwinding. Deal with this by marking a goroutine as synchronously preempted and using that signal to load the missing PC from the stack. On LR platforms this is available in gp.sched.lr. On non-LR platforms like x86, it's at gp.sched.sp, because there are no args, no locals, and no frame pointer pushed to the SP yet. For #68090. Change-Id: I73a1206d8b84eecb8a96dbe727195da30088f288 Reviewed-on: https://go-review.googlesource.com/c/go/+/684435 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nick Ripley <nick.ripley@datadoghq.com>
2025-06-23internal/trace: improve gc-stress testMichael Anthony Knyszek
The gc-stress test is useful for trying to exercise GC-related trace events by producing a lot of them in many different situations. Unfortunately this test is flaky, because allocating in a loop can easily out-run the GC when it's trying to preempt the allocating goroutine. It's been a long standing problem that a program that allocates in a loop can outrun a GC. The problem isn't the GC persay, it's consistently correlated with a high STW time (likely a high 'stopping' time, not a 'stopped' time), suggesting that in the window of time when the garbage collector is trying to stop all goroutines, they continue to allocate. This should probably be fixed in general, but for now, let's focus on this flaky test. This CL changes the gc-stress test to (1) set a memory limit and (2) do more work in between allocations. (2) is really what makes things less flaky, but (2) unfortunately also means the GC is less exercised. That's where (1) comes in. By setting a low memory limit, we increase GC activity (in particular, assist activity). The memory limit also helps prevent the heap from totally blowing up due to the heap goal inflating from floating garbage, but it's not perfect. After this change, under stress2, this test exceeds a heap size of 500 MiB only 1 in 5000 runs on my 64-vCPU VM. Before this change, it got that big about 1/4th of the time. Fixes #74052. Change-Id: I49233c914c8b65b1d593d3953891fddda6685aec Reviewed-on: https://go-review.googlesource.com/c/go/+/683515 Reviewed-by: Carlos Amedee <carlos@golang.org> Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-16internal/reflectlite: fix comment about meaning of flag fieldKeith Randall
Copied current (presumably correct) comment text from reflect package. Change-Id: I19582b3675fbcb96a925002498d24ad2b7bc6178 Reviewed-on: https://go-review.googlesource.com/c/go/+/681935 Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2025-06-16internal/trace: make Value follow reflect conventionsMichael Anthony Knyszek
A previous change renamed Value.Uint64 to Value.ToUint64 to accomodate string values. The method for a string value is then Value.ToString, while the method for a debug string (for example, for fmt) is just called String, as per fmt.Stringer. This change follows a request from Dominik Honnef, maintainer of gotraceui, to make Value follow the conventions of the reflect package. The Value type there has a method String which fulfills both purposes: getting the string for a String Value, and as fmt.Stringer. It's not exactly pretty, but it does make sense to just stick to convention. Change-Id: I55b364be88088d2121527bffc833ef03dbdb9764 Reviewed-on: https://go-review.googlesource.com/c/go/+/680978 Reviewed-by: Florian Lehner <lehner.florian86@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-06-12internal/trace: end test programs with SIGQUITMichael Anthony Knyszek
This change switches from using testenv.Command to testenv.CommandContext which is a little bit friendlier. It also switches away from using 'go run' to 'go build' and running the resulting binary explicitly. This helps eliminate any questions about signal handling and propagation. For #72740. Change-Id: Ife8010da89a7bc439e061fe0c9c6b1f5620d90f1 Reviewed-on: https://go-review.googlesource.com/c/go/+/680977 Reviewed-by: Carlos Amedee <carlos@golang.org> TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
2025-06-10os: disallow Root.Remove(".") on Plan 9, js, and WindowsDamien Neil
Windows already forbids this, since removing the root causes a sharing violation (can't delete the directory while the os.Root has a handle open to it), but add a more explicit check for attempts to delete "." and return EINVAL. Note that this change to Windows doesn't affect operations like Root.Remove("dir/."), since the path is cleaned into just "dir" before attempting the deletion. Fixes #73863 Change-Id: I0f45ccb6c9f171d3a52831632c134150388d77b6 Reviewed-on: https://go-review.googlesource.com/c/go/+/679377 Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-10testing/synctest, runtime: avoid panic when using linker-alloc WG from bubbleDamien Neil
We associate WaitGroups with synctest bubbles by attaching a special to the WaitGroup. It is not possible to attach a special to a linker-allocated value, such as: var wg sync.WaitGroup Avoid panicking when accessing a linker-allocated WaitGroup from a bubble. We have no way to associate these WaitGroups with a bubble, so just treat them as always unbubbled. This is probably fine, since the WaitGroup was always created outside the bubble in this case. Fixes #74005 Change-Id: Ic71514b0b8d0cecd62e45cc929ffcbeb16f54a55 Reviewed-on: https://go-review.googlesource.com/c/go/+/679695 Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-10internal/trace: pass GOTRACEBACK=crash to testprogsMichael Anthony Knyszek
The failures in #70310 are hard to decipher. The cases where the lock is being held either don't really make sense (the STW failures) or the goroutine that fails is 'running on another thread' and we don't get a stack trace. In fact, such a goroutine exists even in the STW cases. Since reproducing this is going to be hard (very few failures over a 2 year span) let's set GOTRACEBACK=crash for these testprogs so next time it happens we can see why. For #70310. Change-Id: I81a780aa82b173d42973f06911cb243f33352be1 Reviewed-on: https://go-review.googlesource.com/c/go/+/680476 Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-06-09runtime: return a different bubble deadlock error when main goroutine is doneDamien Neil
The synctest.Test function waits for all goroutines in a bubble to exit before returning. If there is ever a point when all goroutines in a bubble are durably blocked, it panics and reports a deadlock. Panic with a different message depending on whether the bubble's main goroutine has returned or not. The main goroutine returning stops the bubble clock, so knowing whether it is running or not is useful debugging information. The new panic messages are: deadlock: all goroutines in bubble are blocked deadlock: main bubble goroutine has exited but blocked goroutines remain Change-Id: I94a69e79121c272d9c86f412c1c9c7de57ef27ef Reviewed-on: https://go-review.googlesource.com/c/go/+/679375 Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-04runtime: make bubbled timers more consistent with unbubbledDamien Neil
This CL makes two changes to reduce the predictability with which bubbled timers fire. When asynctimerchan=0 (the default), regular timers with an associated channel are only added to a timer heap when some channel operation is blocked on that channel. This allows us to garbage collect unreferenced, unstopped timers. Timers in a synctest bubble, in contrast, are always added to the bubble's timer heap. This CL changes bubbled timers with a channel to be handled the same as unbubbled ones, adding them to the bubble's timer heap only when some channel operation is blocked on the timer's channel. This permits unstopped bubbled timers to be garbage collected, but more importantly it makes all timers past their deadline behave identically, regardless of whether they are in a bubble. This CL also changes timer scheduling to execute bubbled timers immediately when possible rather than adding them to a heap. Timers in a bubble's heap are executed when the bubble is idle. Executing timers immediately avoids creating a predictable order of execution. For #73850 Fixes #73934 Change-Id: If82e441546408f780f6af6fb7f6e416d3160295d Reviewed-on: https://go-review.googlesource.com/c/go/+/678075 Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-02runtime: randomize order of timers at the same instant in bubblesDamien Neil
In synctest bubbles, fire timers scheduled for the same instant in a randomized order. Pending timers are added to a heap ordered by the timer's wakeup time. Add a per-timer random value, set when the timer is added to a heap, to break ties between timers scheduled for the same instant. Only inject this randomness in synctest bubbles. We could do so for all timers at the cost of one cheaprand call per timer, but given that it's effectively impossible to create two timers scheduled for the same instant outside of a fake-time environment, don't bother. Fixes #73876 For #73850 Change-Id: Ie96c86a816f548d4c31e4e014bf9293639155bd4 Reviewed-on: https://go-review.googlesource.com/c/go/+/677276 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2025-05-30internal/trace: expose the go version read by the readerCarlos Amedee
This change adds a function to expose the version set by the trace reader after reading the trace header (in tests). The trace validator needs to be able to determine what version of the trace it needs to validate against. Clock snapshot checks have been disabled for Windows and WASM. For #63185 Change-Id: Ia3d63e6ed7a5ecd87e63292b84cc417d982aaa5a Reviewed-on: https://go-review.googlesource.com/c/go/+/677695 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Carlos Amedee <carlos@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-05-29internal/pkgbits: explain the rationale for reference tablesMark Freeman
The primary benefit of reference tables is to the linker, though they are also reasonably compact as compared to absolute element indices. It is worth also checking if reference table structure is similarly exploited past the IR linking stage. Ideally, the reference table definition would live in / near the linker. As it stands, it's a bit hard to infer the purpose of the reference tables when looking at pkgbits in isolation. Change-Id: I496aca5a4edcf28e66fa7863ddfa4d825e1b2e89 Reviewed-on: https://go-review.googlesource.com/c/go/+/675596 Auto-Submit: Mark Freeman <mark@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-29internal/synctest: speed up TestWeakDamien Neil
Run TestWeak for fewer iterations. Five is enough reproduce #73817, which was the motivation for this test. runtime.GC is ridiculously slow on wasm, and not especially fast anywhere else. Change-Id: Ieb5235d064b123cbc22a306425e385c273b54493 Reviewed-on: https://go-review.googlesource.com/c/go/+/675716 Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-29runtime, internal/synctest, sync: associate WaitGroups with bubblesDamien Neil
Add support to internal/synctest for managing associations between arbitrary pointers and synctest bubbles. (Implemented internally to the runtime package by attaching a special to the pointer.) Associate WaitGroups with bubbles. Since WaitGroups don't have a constructor, perform the association when Add is called. All Add calls must be made from within the same bubble, or outside any bubble. When a bubbled goroutine calls WaitGroup.Wait, the wait is durably blocking iff the WaitGroup is associated with the current bubble. Change-Id: I77e2701e734ac2fa2b32b28d5b0c853b7b2825c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/676656 Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Damien Neil <dneil@google.com>
2025-05-27runtime: define lock ranking between weak pointers and synctestDamien Neil
Fixes #73817 Change-Id: I0101bdc797237b4c7eb58b414c71b009b0b44447 Reviewed-on: https://go-review.googlesource.com/c/go/+/675176 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Damien Neil <dneil@google.com>
2025-05-21cmd/compile, unique: model data flow of non-string pointersCherry Mui
Currently, hash/maphash.Comparable escapes its parameter if it contains non-string pointers, but does not escape strings or types that contain strings but no other pointers. This is achieved by a compiler intrinsic. unique.Make does something similar: it stores its parameter to a central map, with strings cloned. So from the escape analysis's perspective, the non-string pointers are passed through, whereas string pointers are not. We currently cannot model this type of type-dependent data flow directly in Go. So we do this with a compiler intrinsic. In fact, we can unify this and the intrinsic above. Tests are from Jake Bailey's CL 671955 (thanks!). Fixes #73680. Change-Id: Ia6a78e09dee39f8d9198a16758e4b5322ee2c56a Reviewed-on: https://go-review.googlesource.com/c/go/+/675156 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Jake Bailey <jacob.b.bailey@gmail.com>
2025-05-21runtime/trace: add the flight recorderCarlos Amedee
This change adds the flight recorder to the trace package. Flight recording is a technique in which trace data is kept in a circular buffer and can be flushed upon request. The implementation will be added in follow-up CLs. The flight recorder has already been implemented inside of the golang.org/x/exp/trace package. This copies the current implementation and modifies it to work within the runtime/trace package. The changes include: This adds the ability for multiple consumers (both the execution tracer and the flight recorder) to subscribe to tracing events. This change allows us to add multiple consumers without making major modifications to the runtime. Future optimizations are planned for this functionality. This removes the use of byte readers from the process that parses and processes the trace batches. This modifies the flight recorder to not parse out the trace clock frequency, since that requires knowledge of the format that's unfortunate to encode in yet another place. Right now, the trace clock frequency is considered stable for the lifetime of the program, so just grab it directly from the runtime. This change adds an in-band end-of-generation signal to the internal implementation of runtime.ReadTrace. The internal implementation is exported via linkname to runtime/trace, so the flight recorder can identify exactly when a generation has ended. This signal is also useful for ensuring that subscribers to runtime trace data always see complete generations, by starting or stopping data streaming only at generation boundaries. For #63185 Change-Id: I5c15345981a6bbe9764a3d623448237e983c64ec Reviewed-on: https://go-review.googlesource.com/c/go/+/673116 Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-21crypto,hash: add and implement hash.ClonerFilippo Valsorda
Fixes #69521 Co-authored-by: qiulaidongfeng <2645477756@qq.com> Change-Id: I6a6a465652f5ab7e6c9054e826e17df2b8b34e41 Reviewed-on: https://go-review.googlesource.com/c/go/+/675197 Reviewed-by: Roland Shoemaker <roland@golang.org> Auto-Submit: Filippo Valsorda <filippo@golang.org> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-21crypto/x509: use truncated SHA-256 for SubjectKeyIdFilippo Valsorda
Fixes #71746 Change-Id: I6a6a46568b092933d8ac2039df99ee9f0edf6e56 Reviewed-on: https://go-review.googlesource.com/c/go/+/674477 Reviewed-by: Daniel McCarney <daniel@binaryparadox.net> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Roland Shoemaker <roland@golang.org> Auto-Submit: Filippo Valsorda <filippo@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-21crypto/tls: disable SHA-1 signature algorithms in TLS 1.2Filippo Valsorda
This implements RFC 9155 by removing support for SHA-1 algorithms: - we don't advertise them in ClientHello and CertificateRequest (where supportedSignatureAlgorithms is used directly) - we don't select them in our ServerKeyExchange and CertificateVerify (where supportedSignatureAlgorithms filters signatureSchemesForCertificate) - we reject them in the peer's ServerKeyExchange and CertificateVerify (where we check against the algorithms we advertised in ClientHello and CertificateRequest) Fixes #72883 Change-Id: I6a6a4656e2aafd2c38cdd32090d3d8a9a8047818 Reviewed-on: https://go-review.googlesource.com/c/go/+/658216 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Filippo Valsorda <filippo@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Roland Shoemaker <roland@golang.org> Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
2025-05-21internal/cpu: add ARM64.HasSHA3Filippo Valsorda
For #69536 Change-Id: If237226ba03e282443b4fc90484968c903198cb1 Reviewed-on: https://go-review.googlesource.com/c/go/+/616715 Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Roland Shoemaker <roland@golang.org>
2025-05-21internal/pkgbits: mark element / section ends as delta encoding candidatesMark Freeman
Change-Id: I165c98a0a5800515bfa33c60b95b534900d0ea59 Reviewed-on: https://go-review.googlesource.com/c/go/+/675215 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Mark Freeman <mark@golang.org> Reviewed-by: Robert Griesemer <gri@google.com>
2025-05-21internal/godebug,crypto/fips140: make fips140 setting immutableFilippo Valsorda
Updates #70123 Co-authored-by: qmuntal <quimmuntal@gmail.com> Change-Id: I6a6a4656fd23ecd82428cccbd7c48692287fc75a Reviewed-on: https://go-review.googlesource.com/c/go/+/657116 Reviewed-by: Daniel McCarney <daniel@binaryparadox.net> Reviewed-by: Roland Shoemaker <roland@golang.org> Auto-Submit: Filippo Valsorda <filippo@golang.org> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
2025-05-21internal/trace: skip clock snapshot checks on Windows in stress modeMichael Anthony Knyszek
Windows' monotonic and wall clock granularity is just too coarse to get reasonable values out of stress mode, which is creating new trace generations constantly. Fixes #73813. Change-Id: Id9cb2fed9775ce8d78a736d0164daa7bf45075e0 Reviewed-on: https://go-review.googlesource.com/c/go/+/675096 Reviewed-by: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com> Reviewed-by: Roland Shoemaker <roland@golang.org> Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-21runtime: use cgroup CPU limit to set GOMAXPROCSMichael Pratt
This CL adds two related features enabled by default via compatibility GODEBUGs containermaxprocs and updatemaxprocs. On Linux, containermaxprocs makes the Go runtime consider cgroup CPU bandwidth limits (quota/period) when setting GOMAXPROCS. If the cgroup limit is lower than the number of logical CPUs available, then the cgroup limit takes precedence. On all OSes, updatemaxprocs makes the Go runtime periodically recalculate the default GOMAXPROCS value and update GOMAXPROCS if it has changed. If GOMAXPROCS is set manually, this update does not occur. This is intended primarily to detect changes to cgroup limits, but it applies on all OSes because the CPU affinity mask can change as well. The runtime only considers the limit in the leaf cgroup (the one that actually contains the process), caching the CPU limit file descriptor(s), which are periodically reread for updates. This is a small departure from the original proposed design. It will not consider limits of parent cgroups (which may be lower than the leaf), and it will not detection cgroup migration after process start. We can consider changing this in the future, but the simpler approach is less invasive; less risk to packages that have some awareness of runtime internals. e.g., if the runtime periodically opens new files during execution, file descriptor leak detection is difficult to implement in a stable way. For #73193. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest Change-Id: I6a6a636c631c1ae577fb8254960377ba91c5dc98 Reviewed-on: https://go-review.googlesource.com/c/go/+/670497 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-05-21internal/runtime/cgroup: CPU cgroup limit discoveryMichael Pratt
For #73193. Change-Id: I6a6a636ca9fa9cba429cf053468c56c2939cb1ac Reviewed-on: https://go-review.googlesource.com/c/go/+/668638 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-05-21internal/runtime/cgroup: add line-by-line reader using a single scratch bufferMichael Pratt
Change-Id: I6a6a636ca21edcc6f16705fbb72a5241d4f7f22d Reviewed-on: https://go-review.googlesource.com/c/go/+/668637 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-21os: add Root.MkdirAllDamien Neil
For #67002 Change-Id: Idd74b5b59e787e89bdfad82171b6a7719465f501 Reviewed-on: https://go-review.googlesource.com/c/go/+/674116 Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-21internal/pkgbits: specify that RelIdx is an element indexMark Freeman
Without this, it's not clear what this is relative to or the granularity of the index. Change-Id: Ibaabe47e089f0ba9b084523969c5347ed4c9dbee Reviewed-on: https://go-review.googlesource.com/c/go/+/674636 Auto-Submit: Mark Freeman <mark@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-21internal/pkgbits: indent productions and hoist some types upMark Freeman
The types being hoisted are those which cannot be referenced; that is, where Ref[T] is illegal. These are most clearly owned by pkgbits. The types which follow are those which can be referenced. Referenceable types are more hazy due to the reference mechanism of UIR - sections. These are a detail of the UIR file format and are surfaced directly to importers. I suspect that pkgbits would benefit from a reference mechanism not dependent on sections. This would permit us to push down many types from the noder into pkgbits, reducing the interface surface without giving up deduplication. Change-Id: Ifaf5cd9de20c767ad0941413385b308d628aac6c Reviewed-on: https://go-review.googlesource.com/c/go/+/674635 Auto-Submit: Mark Freeman <mark@golang.org> TryBot-Bypass: Mark Freeman <mark@golang.org> Reviewed-by: Robert Griesemer <gri@google.com>
2025-05-21internal/trace: add generator tests for sync eventsFelix Geisendörfer
Add generator tests that verify the timestamps for the sync events emitted in the go1.25 trace format and earlier versions. Add the ability to configure the properties of the per-generation sync batches in testgen. Also refactor testgen to produce more realistic timestamps by keeping track of lastTs and using it for structural batches that don't have their own timestamps. Otherwise they default to zero which means the minTs of the generation can't be controlled. For #69869 Change-Id: I92a49b8281bc4169b63e13c030c1de7720cd6f26 Reviewed-on: https://go-review.googlesource.com/c/go/+/653876 Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-05-21internal/trace/internal/testgen: make generated trace version configurableFelix Geisendörfer
Replace hard coded references to version.Go122 with the trace version passed to NewTrace. This allows writing testgen tests for newer trace versions. For #69869 Change-Id: Id25350cea1c397a09ca23465526ff259e34a4752 Reviewed-on: https://go-review.googlesource.com/c/go/+/653875 Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-21internal/trace: add a validator test for the new clock snapshotsFelix Geisendörfer
Check that the clock snapshots, when expected to be present, are non-zero and monotonically increasing. This required some refactoring to make the validator aware of the version of the trace it is validating. Change-Id: I04c4dd10fe6975cbac12bb0ddaebcec3a5284e7b Reviewed-on: https://go-review.googlesource.com/c/go/+/669715 Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: David Chase <drchase@google.com>
2025-05-21internal/trace: expose clock snapshot timestamps on sync eventFelix Geisendörfer
Add ClockSnapshot field to the Sync event type and populate it with the information from the new EvClockSnapshot event when available. For #69869 Change-Id: I3b24b5bfa15cc7a7dba270f5e6bf189adb096840 Reviewed-on: https://go-review.googlesource.com/c/go/+/653576 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-05-21runtime,internal/trace: emit clock snapshots at the start of trace generationsFelix Geisendörfer
Replace the per-generation EvEventBatch containing a lone EvFrequency event with a per-generation EvEventBatch containing a EvSync header followed by an EvFrequency and EvClockSnapshot event. The new EvClockSnapshot event contains trace, mono and wall clock snapshots taken in close time proximity. Ignoring minor resolution differences, the trace and mono clock are the same on linux, but not on windows (which still uses a TSC based trace clock). Emit the new sync batch at the very beginning of every new generation rather than the end to be in harmony with the internal/trace reader which emits a sync event at the beginning of every generation as well and guarantees monotonically increasing event timestamps. Bump the version of the trace file format to 1.25 since this change is not backwards compatible. Update the internal/trace reader implementation to decode the new events, but do not expose them to the public reader API yet. This is done in the next CL. For #69869 Change-Id: I5bfedccdd23dc0adaf2401ec0970cbcc32363393 Reviewed-on: https://go-review.googlesource.com/c/go/+/653575 Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-05-21runtime, internal/fuzz: optimize build tag combination on loong64Guoqi Chen
Change-Id: I971b789beb08e0c6b11169fd5547a8d4ab74fab5 Reviewed-on: https://go-review.googlesource.com/c/go/+/668155 Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-05-20cmd/dist, internal/platform: enable internal linking feature and test on loong64limeidan
Change-Id: Ifea676e9eb44281465832fc4050f6286e50f4543 Reviewed-on: https://go-review.googlesource.com/c/go/+/533717 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn> Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
2025-05-20runtime: record synctest bubble ownership in hchanDamien Neil
Replace the hchan.synctest bool with an hchan.bubble reference to the synctest bubble that created the chan. I originally used a bool to avoid increasing the size of hchan, but we have space in hchan's current size class for another pointer. This lets us detect one bubble operating on a chan created in a different bubble. For #67434 Change-Id: If6cf9ffcb372fe7fb3f8f4ef27b664848578ba5c Reviewed-on: https://go-review.googlesource.com/c/go/+/674515 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Damien Neil <dneil@google.com>
2025-05-20internal/pkgbits: rename RelocEnt to RefTableEntryMark Freeman
Change-Id: I9b1c9a0499ad3444e8cb3e4be187f9fab816c90c Reviewed-on: https://go-review.googlesource.com/c/go/+/674159 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <mark@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-20runtime: disallow closing bubbled chans from outside bubbleDamien Neil
A chan created within a synctest bubble may not be operated on from outside the bubble. We panicked on send and receive, but not close. Panic on close as well. For #67434 Change-Id: I98d39e0cf7baa1a679aca1fb325453d69c535308 Reviewed-on: https://go-review.googlesource.com/c/go/+/671960 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Damien Neil <dneil@google.com>
2025-05-20internal/filepathlite: fix commentMaineK00n
fix typo Change-Id: I46f0b052615d388a852439e63542b43e2ca62b7e GitHub-Last-Rev: 96ac66c0362c5c544249cf465c528a924112fa76 GitHub-Pull-Request: golang/go#73725 Reviewed-on: https://go-review.googlesource.com/c/go/+/672955 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Sean Liao <sean@liao.dev> Reviewed-by: Sean Liao <sean@liao.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>