aboutsummaryrefslogtreecommitdiff
path: root/src/internal
AgeCommit message (Collapse)Author
20 hoursinternal/cgrouptest: use t.Cleanup instead of defer in InCgroupV2Shulhan
Using defer may cause the TestCgroupGOMAXPROCS fail with the following error messages, --- FAIL: TestCgroupGOMAXPROCS (5.14s) crash_test.go:193: running /home/ms/src/go/bin/go build -o /tmp/go-build2154548206/testprog.exe crash_test.go:216: built testprog in 5.13507196s --- FAIL: TestCgroupGOMAXPROCS/containermaxprocs=0 (0.00s) cgroup_linux_test.go:60: /tmp/go-build2154548206/testprog.exe PrintGOMAXPROCS (1.191505ms): ok cgrouptest_linux.go:81: Error removing cgroup directory: remove /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/go-cgrouptest4138918176: device or resource busy Under the following environment, - Linux 6.19.9-arch1-1 #1 SMP PREEMPT_DYNAMIC - systemd 260 (260.1-1-arch) Change-Id: Ic36b0b98f0d589ea5730ea35097af04a22dc7469
20 hoursinternal/testenv: exclude GOMAXPROCS when building test programShulhan
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.
20 hoursall: prealloc slice with possible minimum capabilitiesShulhan
21 hoursinternal/coverage: first write error never recordedWeixie Cui
Change-Id: Ie51246263ede8e069cd72a9646e0d485ec3d3806 GitHub-Last-Rev: 5a610d393a01e710db8db4639837b75816e06e04 GitHub-Pull-Request: golang/go#78610 Reviewed-on: https://go-review.googlesource.com/c/go/+/764483 Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@golang.org>
37 hoursgo/types, types2: fail interface inference against generic methodsRob Findley
When unifying an interface against a concrete type, interface inference looks up each interface method on the concrete type and unifies the signatures. If the concrete method is generic, the *Signature unify case (which ignores type parameter lists) would unify the method's own type parameter into the inference variable, leading to errors mentioning a leaked P and recording the wrong type in Info. A generic method never satisfies an interface method, so fail the unification at the lookup site instead. Change-Id: Id01eefcde492399cb94f4452f5627c4edbd22a1c Reviewed-on: https://go-review.googlesource.com/c/go/+/766160 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
6 dayscmd/go: use fsys.ReadDir for IsStandardPackageMichael Matloob
FIPS140 crypto files will be bound into the virtual filesystem using the fsys package. So IsStandardPackage needs to use fsys.ReadDir to check that the fips140 packages are standard packages rather than os.ReadDir because os.ReadDir doesn't know about the overlay. It would be nice if we could pass in a io/fs.FS to IsStandardPackage but the FS paths are slash paths and don't play well with windows paths. So we pass in ReadDir instead. Maybe in the future we could create an alternative interface to pass the filesystem through but that's a bigger project. Fixes #73649 Change-Id: I576f03cfc52a63cec0598e058e1354676a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/762581 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Michael Matloob <matloob@google.com> Auto-Submit: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
7 daysinternal/syscall/unix: properly support AT_SYMLINK_NOFOLLOW on LinuxDamien Neil
On Linux, the fchmodat syscall silently ignores the AT_SYMLINK_NOFOLLOW flag. Change the Linux Fchmodat function to use the fstatat2 syscall (added in Linux 6.6) when available. When fstatat2 is not available, use the same workaround as GNU libc and musl, which is to open the target file with O_PATH and then chmod it via /proc/self/fd. This change fixes an os.Root escape, where Root.Chmod could follow a symlink and act on a file outside of the root. Root.Chmod checks to see if its target is a symlink before calling fchmodat, so this escape requires the target to be replaced with a symlink in between the initial check and the fchmodat. Thanks to Uuganbayar Lkhamsuren (https://github.com/uug4na) for reporting this issue. Fixes CVE-2026-32282 Fixes #78293 Change-Id: Ie487be1a853b341a77b42ae0c59301d46a6a6964 Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3900 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Neal Patel <nealpatel@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/763761 TryBot-Bypass: David Chase <drchase@google.com> Auto-Submit: David Chase <drchase@google.com>
13 daysgo/types, types2: in range-over-func, the yield function cannot be variadicRobert Griesemer
Fixes #78483. For #78314. Change-Id: If83983c0bf79840aa02dc0d2fa8945f5e8b4e969 Reviewed-on: https://go-review.googlesource.com/c/go/+/761682 Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
14 daysinternal/runtime/atomic: simplify linknamesCherry Mui
When not in race mode, we redirect the sync/atomic functions to internal/runtime/atomic with assembly stubs in the sync/atomic package. Access from assembly is similar to linkname, so they need export linknames from internal/runtime/atomic. We currently have export linknames only for the Go functions, which varies from architecture to architecture. This CL adds export linknames to assembly functions as well, so they are same on all architectures. Linknames on assembly functions don't hurt. Also, we may restrict linkname access to assembly symbols without a push or export linkname later. This CL prepares for that. Change-Id: Ic6167a2f6610b9b1b1193e2ea86095ab7506b282 Reviewed-on: https://go-review.googlesource.com/c/go/+/749945 Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
14 daysinternal/pkgbits: bump version for generic methodsMark Freeman
We still need to guard changes to the bitstream which don't depend on witnessing a generic method. Change-Id: Idfc189ebb02f86dbd91e47f5e4c7663479441370 Reviewed-on: https://go-review.googlesource.com/c/go/+/761583 Auto-Submit: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
2026-04-01internal/abi: set MaxPtrmaskBytes to 16Ian Lance Taylor
When MaxPtrmaskBytes was introduced in CL 9888, it was given the value 16. That seemed like a good tradeoff between space in the binary and code computing the GC bitmask from a GC program. In CL 10815 MaxPtrmaxBytes was increased to 2048, because that CL changed channel sending to use typeBitsBulkBarrier, which did not support GC programs. The value 2048 was chosen to ensure that all types up to 64K would use a GC bitmask, as channel element types are limited to 64K. In CL 616255 GC programs were removed and the GC bitmask, if not precomputed, was instead generated from the type descriptor. As part of this change the restriction on typeBitsBulkBarrier was removed. Thus the requirement of setting MaxPtrmaskBytes to 2048 no longer applies. This CL restores MaxPtrmaskBytes back to the original value of 16. For reference, in tailscaled this changes the number of types requiring the GC bitmask to be computed from 6 to 49. This saves about 100 bytes in the executable, which I admit isn't much. On the other hand some of those precomputed bitmasks are never used, such as the one generated for runtime.spanQueue. Change-Id: I170baaaa07d9f86e976586de93635c1be820a91e Reviewed-on: https://go-review.googlesource.com/c/go/+/730000 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-03-30internal/trace/tracev2: add String for ProcSyscallAbandonedFlorian Lehner
Add missing string for ProcSyscallAbandoned. Change-Id: Ie6b049001432c2b667716d4eff95783c7eb1f350 Reviewed-on: https://go-review.googlesource.com/c/go/+/760840 Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> TryBot-Bypass: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2026-03-30go/types, types2: report an error if constant string overflowsRobert Griesemer
Set a limit of 10 GiB for strings obtained via constant string addition. Fixes #78346. Change-Id: I35dbdff94f3ed32bf69654f4b3da435dad9f6236 Reviewed-on: https://go-review.googlesource.com/c/go/+/761300 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev>
2026-03-30all: fix some minor issues in the commentscuishuang
Change-Id: If6c304efac7a46a9718cdc63ded3d98a26a3a831 Reviewed-on: https://go-review.googlesource.com/c/go/+/760700 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Neal Patel <nealpatel@google.com> Reviewed-by: Fred Sauer <fredsa@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
2026-03-28runtime: remove redundant fields from memory profile recordsNick Ripley
The memProfCycle struct holds allocation counts and bytes allocated, and frees and bytes freed. But the memory profile records are already aggregated by allocation size, which is stored in the "size" field of the bucket struct. We can derive the bytes allocated/freed using the counts and the size we already store. Thus we can delete the bytes fields from memProfCycle, saving 64 bytes per memRecord. We can do something similar for the profilerecord.MemProfileRecord type. We just need to know the object size and we can derive the allocated and freed bytes accordingly. Change-Id: I103885c2f29471b25283e330674fc16d6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/760140 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>
2026-03-27all: remove openbsd/mips64 portTobias Klauser
The openbsd/mips64 port is dead, remove the remaining code specific to that port and clean up build tags. Fixes #61546 Change-Id: I0328b7b76ce1ddacd3a526b3f4ae29eaa1254c3f Reviewed-on: https://go-review.googlesource.com/c/go/+/746480 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Joel Sing <joel@sing.id.au> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-03-26internal/trace: preallocate pcs array to correct sizeFlorian Lehner
Avoid additional allocations by requesting the correct size of the array. Change-Id: Ib1bcabdfc978c4dabf139c37e45d436182dec2d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/757800 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 Knyszek <mknyszek@google.com>
2026-03-26runtime, cmd/link: remove itablinksIan Lance Taylor
Instead of keeping a separate list of pointers to itabs, just walk through the itabs themselves. For #6853 Change-Id: If030bd64fbd01d73b0bf8495f6c9826ed2e61568 Reviewed-on: https://go-review.googlesource.com/c/go/+/729201 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: Cherry Mui <cherryyz@google.com>
2026-03-25runtime: use uname version check for 64-bit time on 32-bit arch codepathsBrad Fitzpatrick
The previous fallback-on-ENOSYS logic causes issues on forks of Linux. Android: #77621 (CL 750040 added a workaround with a TODO, this fixes that TODO) Causes the OS to terminate the program when running on Android versions <=10 since the seccomp jail does not know about the 64-bit time syscall and is configured to terminate the program on any unknown syscall. Synology's Linux: #77930 On old versions of Synology's Linux they added custom vendor syscalls without adding a gap in the syscall numbers, that means when we call the newer Linux syscall which was added later, Synology's Linux interprets it as a completely different vendor syscall. Originally by Jorropo in CL 751340. Fixes #77930 Co-authored-by: Jorropo <jorropo.pgm@gmail.com> Change-Id: I90e15495d9249fd7f6e112f9e3ae8ad1322f56e0 Reviewed-on: https://go-review.googlesource.com/c/go/+/758902 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-25cmd/dist: add GO_TEST_ASMFLAGS to set -asmflags during dist testDmitri Shuralyov
If we run into a need for finer control over when -asmflags gets set, there can be an asmflags field added to goTest, analogously to the existing gcflags and ldflags fields. Start with a minimal change for what is currently needed, since not adding something we ourselves don't use makes it easier to avoid inadvertently ending up maintaining it because we can't be sure whether someone else started to depend on it. For #77427. Change-Id: I5e80874861cadf95fe770af6712b2c3f172c990a Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-spectre Reviewed-on: https://go-review.googlesource.com/c/go/+/758740 Reviewed-by: Michael Pratt <mpratt@google.com> 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>
2026-03-24internal/abi, cmd/link: centralize type descriptor size calculationJake Bailey
The linker hardcoded the calculation for some types, which caused me some annoyance in CL 711560 because I didn't know it needed to be updated (and it took me a long time to find the hardcoded value). Move this calculation over to the abi package, similar to other funcs. Then update rttype.Init to also check that the function works, like again like other funcs in this package. This actually caught a latent bug; decodetypeMethods was incorrectly calculating the size for the Interface case! Change-Id: Iaa66055061b68ec93c9912ae6aa6e605260f52a8 Reviewed-on: https://go-review.googlesource.com/c/go/+/749961 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-03-24internal/runtime/maps: add GOEXPERIMENT=mapsplitgroup for KKKKVVVV slot orderJake Bailey
Map groups are currently: type group struct { ctrl uint64 slots [8]slot } type slot struct { key K elem E } If the element type is struct{}, the slot will be padded so that the address of the elem is unique rather than pointing outside the alloc. This has the effect of map[K]struct{} wasting space due to the extra byte and padding, making it no better than map[K]bool. This CL changes the group layout to instead place keys and elems together, as they used to be before swiss maps: type group struct { ctrl uint64 keys [8]K elems [8]V } This is an alternative to CL 701976, which I suspect will have better performance. Keys placed together should lead to better cache behavior, at the cost of more expensive elem lookups, since the elems are not a fixed offset from their keys. This change is locked behind GOEXPERIMENT=mapsplitgroup. Updates #70835 Updates #71368 Change-Id: Ide8d1406ae4ab636f86edc40e0640cc80653197c Reviewed-on: https://go-review.googlesource.com/c/go/+/711560 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>
2026-03-20internal/pkgbits: add missing testsRobert Griesemer
The encoding version was recently bumped to V3 but the tests were not updated. Do it now. For #9859. Change-Id: Ia61d3e178215e804dcd2db186774883617e5e5a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/757440 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
2026-03-19cmd/compile/internal/noder: encode promoted struct fields for composite ↵Robert Griesemer
literals in UIR This change requires an encoding format change for struct literals. Introduce a new UIR version (V3) and use the opportunity to encode all composite literals more compactly: specifically, when we know that (composite literal) keys are always present, avoid encoding a bool value for each key. Do not yet enable the new format. For #9859. Change-Id: Ic6dc9adb1aa494e923eadaf578f8cfc61efd5ea4 Reviewed-on: https://go-review.googlesource.com/c/go/+/754664 Reviewed-by: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
2026-03-19go/types, types2: allow promoted field names as keys in struct literalsRobert Griesemer
For #9859. Change-Id: Ie4823e726ab43fe2ce1e96c279f63dad6c1f9873 Reviewed-on: https://go-review.googlesource.com/c/go/+/751702 Reviewed-by: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
2026-03-18syscall: remove the 42 args limit in SyscallNqmuntal
SyscallN already supports more than 42 arguments on 386 and arm64. Lift that limit on amd64 as well. Change-Id: I3f5c6ebb959aa9b0d367903cac119fc27cb93064 Reviewed-on: https://go-review.googlesource.com/c/go/+/751862 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-03-18runtime: return the error code as a return value in asmstdcallqmuntal
This shaves off 8 bytes from the syscall_syscalln stack frame, which is significant as that call path is almost over the nosplit limit. Also, it follows the cgocall convention of returning the error code as a return value, making it easier to reason about. Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-arm64,gotip-windows-386 Change-Id: I62acdb7c0d4cf9cb928bf3974d3300dd752f6c29 Reviewed-on: https://go-review.googlesource.com/c/go/+/751861 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-18runtime,runtime/cgo: do cgo thread initialization in Go on Windowsqmuntal
Windows doesn't require any special handling for cgo threads. They can be created in the same way as in non-cgo code. In fact, the code to create threads in runtime and in runtime/cgo is basically the same, except that the latter does some retries on failure. Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-amd64-race,gotip-windows-arm64 Change-Id: I49d4de93d4d3b07a4c89e2bfb6b7302c6dfb9877 Reviewed-on: https://go-review.googlesource.com/c/go/+/746300 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-17go/types, types2: handle unconstrained type parameters correctly in a few placesRobert Griesemer
When iterating over a type set via a range clause, am unconstrained type set produces a single (nil, nil) result. This was not properly accounted for in a few places: - In the code for the append and copy built-in, handle the (nil, nil) case. - Likewise, in NewSignatureType, panic with the correct (string) error in this case. Check all remaining places where we iterate over type sets with range for correctness. Fixes #78163. Change-Id: If0f33f43dad59b4b5ef4c310f80522c25c6e251f Reviewed-on: https://go-review.googlesource.com/c/go/+/755941 Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Mark Freeman <markfreeman@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
2026-03-16internal/syscall/windows: don't force image section checks in Deleteatqmuntal
I originally added the FILE_DISPOSITION_FORCE_IMAGE_SECTION_CHECK flag because Windows' DeleteFileW used to use it, but it doesn't anymore. Not using that flag makes Deleteat work in more cases. Change-Id: I604ad68330e08bcbd37f33a3bf4e5f7e7f043c16 Reviewed-on: https://go-review.googlesource.com/c/go/+/754180 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Auto-Submit: Quim Muntal <quimmuntal@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-16internal/poll: pin all objects needed during overlapped I/Odatabase64128
Windows requires these objects to remain valid during the whole overlapped operation. This currently works because we have a non-moving GC and these objects are taken from a sync.Pool. For correctness, and to ensure a possible moving GC in the future does not break it in a similar manner, pin these objects in execIO. Updates #77975. Change-Id: Iff07009d40e4a439026a961a6dca9f6843cbd61d Reviewed-on: https://go-review.googlesource.com/c/go/+/753560 Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-03-12internal/gate: import from x/net/internal/gateDamien Neil
Copy the x/net/internal/gate package, used by net/http/internal/http2 tests. For #67810 Change-Id: I4080527ec74c57cb5c136f5701e3e76e6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/751301 Reviewed-by: Nicholas Husin <nsh@golang.org> Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <husin@google.com>
2026-03-10runtime/poll: fix race condition in Window's SendFileqmuntal
The destination of SendFile is a socket, which doesn't support file offsets. There is no need to keep track of the file offset, and doing so causes a race between SendFile and Read. While here, make sure that SendFile tests do call poll.SendFile. Fixes #78015 Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-race,gotip-linux-amd64-race Change-Id: I8cce45c0c110e848d9bdbc5ba340b92ca041f0a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/752860 Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
2026-03-10runtime: GODEBUG=tracebacklabels=1 for 1.27+David Finkel
https://go.dev/cl/742580 updated the goroutine label format in tracebacks to only quote the values under some circumstances, and use a more broadly acceptable format. Flip the GODEBUG=tracebacklabels default for go 1.27+ modules. Notably, tracebacklabels is marked as Opaque to avoid some diciness in maintaining a usage metric in signal handlers, etc. (where mutex acquisition may be problematic) Also, update the go 1.27 release notes to call out the new feature. Updates #76349 Change-Id: Iedd3f6b17d83e99da20365b952a565022d20ff13 Reviewed-on: https://go-review.googlesource.com/c/go/+/751580 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
2026-03-09internal/poll: move rsan to heap on windowsdatabase64128
According to https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsarecvfrom, the memory pointed to by lpFromlen must remain available during the overlapped I/O, and therefore cannot be allocated on the stack. CL 685417 moved the rsan field out of the operation struct and placed it on stack, which violates the above requirement and causes stack corruption. Unfortunately, it is no longer possible to cleanly revert CL 685417. Instead of attempting to revert it, this CL bundles rsan together with rsa in the same sync.Pool. The new wsaRsa struct is still in the same size class, so no additional overhead is introduced by this change. Fixes #77975. Change-Id: I5ffbccb332515116ddc03fb7c40ffc9293cad2ab Reviewed-on: https://go-review.googlesource.com/c/go/+/753040 Reviewed-by: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Commit-Queue: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
2026-03-09cmd/compile, go/*: allow generic methods starting with Go 1.27Robert Griesemer
This only changes the type checkers and tests. Backend compiler changes are not included. For #77273. Change-Id: I8cf0b6fddf6afd6b08b06ba6fdf9c726af4bea8d Reviewed-on: https://go-review.googlesource.com/c/go/+/746820 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Robert Griesemer <gri@google.com>
2026-03-09net: correctly handle non-nil empty cmsg buffer on windowsdatabase64128
Fixes #77875. Change-Id: I0ed91be7ed10c04ddea3af55548a8dbf0be5f3a8 Reviewed-on: https://go-review.googlesource.com/c/go/+/750420 Reviewed-by: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-06internal/runtime/maps/: devirtualize hashing for specialized mapsArsenySamoylov
This change improves performance of specialized maps and opens opportunity for further improvement by inlining hashing calls in the future (right now we can't inline functions from GOASM). MapAccessBenchmarks goos: linux goarch: amd64 pkg: runtime cpu: Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz │ base-randlayout-meged.stat │ devirt-randlayout-merged.stat │ │ sec/op │ sec/op vs base │ MapAccessHit/Key=int32/Elem=int32/len=6-4 21.35n ± 1% 21.72n ± 0% +1.73% (p=0.000 n=45) MapAccessHit/Key=int32/Elem=int32/len=64-4 25.74n ± 1% 25.37n ± 2% -1.44% (p=0.006 n=45) MapAccessHit/Key=int32/Elem=int32/len=65536-4 41.56n ± 0% 41.07n ± 0% -1.18% (p=0.000 n=45) MapAccessHit/Key=int64/Elem=int64/len=6-4 21.53n ± 0% 21.56n ± 0% +0.14% (p=0.000 n=45) MapAccessHit/Key=int64/Elem=int64/len=64-4 25.56n ± 0% 25.32n ± 2% ~ (p=0.651 n=45) MapAccessHit/Key=int64/Elem=int64/len=65536-4 44.47n ± 0% 44.42n ± 0% ~ (p=0.645 n=45) MapAccessHit/Key=string/Elem=string/len=6-4 30.54n ± 0% 30.83n ± 0% +0.95% (p=0.000 n=45) MapAccessHit/Key=string/Elem=string/len=64-4 33.94n ± 0% 32.58n ± 0% -4.01% (p=0.000 n=45) MapAccessHit/Key=string/Elem=string/len=65536-4 60.75n ± 1% 59.22n ± 0% -2.52% (p=0.000 n=45) MapAccessHit/Key=int32/Elem=bigType/len=6-4 104.7n ± 0% 104.2n ± 0% -0.48% (p=0.000 n=45) MapAccessHit/Key=int32/Elem=bigType/len=64-4 176.9n ± 2% 169.8n ± 1% -4.01% (p=0.000 n=45) MapAccessHit/Key=int32/Elem=bigType/len=65536-4 603.3n ± 0% 604.6n ± 0% +0.22% (p=0.000 n=45) MapAccessHit/Key=int32/Elem=*int32/len=6-4 21.75n ± 1% 21.90n ± 0% +0.69% (p=0.000 n=45) MapAccessHit/Key=int32/Elem=*int32/len=64-4 26.28n ± 0% 25.74n ± 0% -2.05% (p=0.000 n=45) MapAccessHit/Key=int32/Elem=*int32/len=65536-4 45.42n ± 0% 45.10n ± 0% -0.70% (p=0.000 n=45) MapAccessMiss/Key=int32/Elem=int32/len=6-4 23.49n ± 0% 23.56n ± 1% +0.30% (p=0.000 n=45) MapAccessMiss/Key=int32/Elem=int32/len=64-4 24.93n ± 3% 24.85n ± 2% ~ (p=0.144 n=45) MapAccessMiss/Key=int32/Elem=int32/len=65536-4 37.68n ± 0% 37.20n ± 0% -1.27% (p=0.000 n=45) MapAccessMiss/Key=int64/Elem=int64/len=6-4 23.49n ± 0% 23.44n ± 1% ~ (p=0.587 n=45) MapAccessMiss/Key=int64/Elem=int64/len=64-4 25.66n ± 2% 25.02n ± 2% -2.49% (p=0.032 n=45) MapAccessMiss/Key=int64/Elem=int64/len=65536-4 38.19n ± 0% 37.83n ± 0% -0.94% (p=0.000 n=45) MapAccessMiss/Key=string/Elem=string/len=6-4 31.29n ± 0% 31.55n ± 0% +0.83% (p=0.000 n=45) MapAccessMiss/Key=string/Elem=string/len=64-4 31.28n ± 3% 30.81n ± 2% -1.50% (p=0.025 n=45) MapAccessMiss/Key=string/Elem=string/len=65536-4 46.76n ± 0% 45.81n ± 0% -2.03% (p=0.000 n=45) MapAccessMiss/Key=int32/Elem=bigType/len=6-4 128.0n ± 0% 128.0n ± 0% ~ (p=0.647 n=45) MapAccessMiss/Key=int32/Elem=bigType/len=64-4 129.7n ± 0% 130.2n ± 0% ~ (p=0.069 n=45) MapAccessMiss/Key=int32/Elem=bigType/len=65536-4 154.3n ± 0% 154.3n ± 0% ~ (p=0.058 n=45) MapAccessMiss/Key=int32/Elem=*int32/len=6-4 23.38n ± 1% 23.87n ± 1% +2.10% (p=0.000 n=45) MapAccessMiss/Key=int32/Elem=*int32/len=64-4 25.52n ± 2% 25.41n ± 2% ~ (p=0.321 n=45) MapAccessMiss/Key=int32/Elem=*int32/len=65536-4 38.28n ± 0% 37.95n ± 0% -0.86% (p=0.000 n=45) MapAccessZero/Key=int64-4 2.708n ± 0% 3.095n ± 0% +14.29% (p=0.000 n=45)* MapAccessZero/Key=int32-4 2.708n ± 0% 3.095n ± 0% +14.29% (p=0.000 n=45)* MapAccessZero/Key=string-4 3.481n ± 0% 3.095n ± 0% -11.09% (p=0.000 n=45)* MapAccessEmpty/Key=int64-4 3.095n ± 0% 3.096n ± 0% ~ (p=0.087 n=45)* MapAccessEmpty/Key=int32-4 3.095n ± 0% 3.482n ± 0% +12.50% (p=0.000 n=45)* MapAccessEmpty/Key=string-4 3.869n ± 0% 3.483n ± 0% -9.98% (p=0.000 n=45)* geomean 28.04n 28.00n -0.12% * MapAccess(Empy|Zero) shows weird results due to basic block alignment changes Fixes: #77892 Change-Id: I43913ae5dfa2d3e0cd173a766614ca4341774761 Reviewed-on: https://go-review.googlesource.com/c/go/+/750580 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2026-03-05html/template: properly escape URLs in meta content attributesRoland Shoemaker
The meta tag can include a content attribute that contains URLs, which we currently don't escape if they are inserted via a template action. This can plausibly lead to XSS vulnerabilities if untrusted data is inserted there, the http-equiv attribute is set to "refresh", and the content attribute contains an action like `url={{.}}`. Track whether we are inside of a meta element, if we are inside of a content attribute, _and_ if the content attribute contains "url=". If all of those are true, then we will apply the same URL escaping that we use elsewhere. Also add a new GODEBUG, htmlmetacontenturlescape, to allow disabling this escaping for cases where this behavior is considered safe. The behavior can be disabled by setting htmlmetacontenturlescape=0. Fixes CVE-2026-27142 Fixes #77954 Change-Id: I9bbca263be9894688e6ef1e9a8f8d2f4304f5873 Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3360 Reviewed-by: Neal Patel <nealpatel@google.com> Reviewed-by: Nicholas Husin <husin@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/752181 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-03internal/bytealg: on android/arm64, don't read outside 16-byte regionsKeith Randall
CL 749062 attempted this, but handled only the case of reading past the end. This CL handles the case of reading before the beginning. Update #59090 Change-Id: Ia21166a9a3fb20ac9003c192589a3d92304c9ee4 Reviewed-on: https://go-review.googlesource.com/c/go/+/751020 Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2026-02-27runtime: on android/arm64, don't read outside 16-byte regionsKeith Randall
Because MTE might be enforced. Update #59090 Update #27610 Change-Id: Idfaecbf3b7a93c5e371abcace666febfc303de9a Reviewed-on: https://go-review.googlesource.com/c/go/+/749062 Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
2026-02-26os: avoid escape from Root via ReadDir or ReaddirDamien Neil
When reading the contents of a directory using File.ReadDir or File.Readdir, the os.FileInfo was populated on Unix platforms using lstat. This lstat call is vulnerable to a TOCTOU race and could escape the root. For example: - Open the directory "dir" within a Root. This directory contains a file named "file". - Use File.ReadDir to list the contents of "dir", receiving a os.DirEntry for "dir/file". - Replace "dir" with a symlink to "/etc". - Use DirEntry.Info to retrieve the FileInfo for "dir/file". This FileInfo contains information on "/etc/file" instead. This escape permits identifying the presence or absence of files outside a Root, as well as retreiving stat metadata (size, mode, modification time, etc.) for files outside a Root. This escape does not permit reading or writing to files outside a Root. Fixes #77827 Fixes CVE-2026-27139 Change-Id: I40004f830c588e516aff8ee593d630d36a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/749480 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <husin@google.com> Reviewed-by: Nicholas Husin <nsh@golang.org> Auto-Submit: Damien Neil <dneil@google.com>
2026-02-24internal/cpu: use IsProcessorFeaturePresent to calculate ARM64 on windowsAlex Brainman
This CL also adds internal/syscall/windows.IsProcessorFeaturePresent and all processor feature consts to test internal/cpu changes. For #76791 Change-Id: Iba9cc812f676b700e767a1ed7f194fcb4a67f61b Cq-Include-Trybots: luci.golang.try:gotip-windows-arm64 Reviewed-on: https://go-review.googlesource.com/c/go/+/745560 Reviewed-by: Quim Muntal <quimmuntal@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: David Chase <drchase@google.com>
2026-02-24internal/runtime/sys: only use speculation barrier for DIT on Apple SiliconRoland Shoemaker
The Apple documentation [0] indicates that when enabling DIT (via MSR), a speculation barrier should be used. The rationale for this is not explained, but one could assume that they perhaps do not treat MSR of a PSTATE bit as a context synchronization event, and thus the CPU might speculatively execute instructions that would be affected by DIT before the MSR takes effect. Arm on the other hand [1], explicitly states that MSR of a PSTATE bit is a context synchronization event, and thus speculation barriers are not needed. In order to square this circle, we keep the speculation barrier, but only use it on Apple Silicon. [0] http://go/appledoc/xcode/writing-arm64-code-for-apple-platforms#Enable-DIT-for-constant-time-cryptographic-operations [1] https://developer.arm.com/documentation/100941/0101/Barriers?lang=en Fixes #77776 Change-Id: I17a91adc8e4d90fe2288592547986c82a9356cde Reviewed-on: https://go-review.googlesource.com/c/go/+/748460 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-24internal/profile: fix error message casing for function ID not foundjjpinto
Go convention: error messages should not be capitalized Change-Id: I021f54791b7c12ffffa7106532a33cd0ee2e9377 GitHub-Last-Rev: dfa6e0ff5212deb105c747ed80041eff5efc4447 GitHub-Pull-Request: golang/go#77013 Reviewed-on: https://go-review.googlesource.com/c/go/+/732900 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Pratt <mpratt@google.com>
2026-02-24internal/runtime/sys: improve DIT assemblyRoland Shoemaker
In EnableDIT, if DIT is already enabled, return early instead of executing MSR and DSB/ISB, since they are not particularly cheap instructions. Also, if we have support for the SB (Speculation Barrier) instruction, use it instead of DSB+ISB when enabling DIT, since SB is cheaper. Change-Id: I1b3ecbd95ed42bfd10d646125704abf4e80b6d2e Reviewed-on: https://go-review.googlesource.com/c/go/+/729800 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-24internal/cpu,cmd/internal/obj/arm64: add SBRoland Shoemaker
Add the SB (speculation barrier) instruction, and an internal/cpu feature bit to check its availability. Change-Id: I7c2d887ae75598f7c11cc875ec15ec3be76c09f5 Reviewed-on: https://go-review.googlesource.com/c/go/+/729501 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-19internal/syscall/windows: use byte instead of bool for all BOOLEAN Windows ↵Alex Brainman
data types According to https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types BOOLEAN is defined as BYTE, and BYTE is equivalent to Go byte. This CL corrects CL 713480. It adjusts FILE_DISPOSITION_INFO.DeleteFile, FILE_DISPOSITION_INFORMATION.DeleteFile, FILE_RENAME_INFORMATION.ReplaceIfExists and FILE_LINK_INFORMATION.ReplaceIfExists to use byte instead of bool type. Updates #75922 Change-Id: Ifadc9696becb076b1403ca2e780d973e3d3dad69 Reviewed-on: https://go-review.googlesource.com/c/go/+/746061 Reviewed-by: Quim Muntal <quimmuntal@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
2026-02-19cmd/compile, go/*: move method type parameter checks from parsers to type ↵Robert Griesemer
checkers The parsers (cmd/compile/internal/syntax and go/parser) always accepted type parameters on methods for parser robustness but reported an error. With this change, the parsers accept the type parameters on methods, and then the type checkers (cmd/compile/internal/types2 and go/types) complain about them. Add test case for method type parameters when running the parsers only. Adjust some existing test cases as needed. This change is a necessary first step towards implementing generic methods but does not enable them. For #77273. Change-Id: I291fcf0aef0c917c74b32131c88b9e4ed71c5060 Reviewed-on: https://go-review.googlesource.com/c/go/+/738441 Reviewed-by: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
2026-02-18internal/runtime/gc/scan: require popcnt for x86khr@golang.org
The GOAMD64=v1 test disables popcnt instructions, which is a feature this package's amd64 assembly uses. Fixes #77674 Change-Id: I7be9bb665838f5da50275f96ef3df398412bb44a Reviewed-on: https://go-review.googlesource.com/c/go/+/746640 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@golang.org>