]> Cypherpunks repositories - gostls13.git/log
gostls13.git
6 months agoos: explicitly return nil for rootChown in root_openat.go
Jes Cok [Fri, 14 Feb 2025 13:50:24 +0000 (13:50 +0000)]
os: explicitly return nil for rootChown in root_openat.go

It is consistent with the same function in root_noopenat.go.

Change-Id: I6ddbf4dfcc725cb2023bc6bed961cc525b9c43d2
GitHub-Last-Rev: 0802150a6a8e5d4bd395b702ecc518df1e8dd4c0
GitHub-Pull-Request: golang/go#71743
Reviewed-on: https://go-review.googlesource.com/c/go/+/649417
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

6 months agocmd/internal/obj/riscv: support MOVD with floating point constants
Joel Sing [Mon, 1 Jul 2024 14:31:53 +0000 (00:31 +1000)]
cmd/internal/obj/riscv: support MOVD with floating point constants

Currently, we only support loading of values from memory (or other
registers). Add floating point constant support to MOVD. This is
implemented by storing the floating point constant to a symbol,
which is then loaded into the floating point register.

Change-Id: I6db242d27f606f0d5d084a3ab93538698d3a4f8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/631876
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agoruntime: use return for async preemption resumption on arm64
Joel Sing [Wed, 5 Feb 2025 13:38:51 +0000 (00:38 +1100)]
runtime: use return for async preemption resumption on arm64

Use return with register for async preemption resumption on arm64.
This has the same behaviour as the current use of JMP, however
is permitted when Branch Target Identification is being enforced,
while a JMP with register is considered an indirect call and
requires a `BTI J` marker at the resumption address.

Updates #66054

Change-Id: I135ac577073467bedd9efd8df15b76c97dc08767
Reviewed-on: https://go-review.googlesource.com/c/go/+/646782
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
6 months agocmd/go/internal: use pathpkg name more
cuishuang [Thu, 21 Nov 2024 09:14:21 +0000 (17:14 +0800)]
cmd/go/internal: use pathpkg name more

The package "path" is already imported under the name pathpkg and used
many times in these files. It's not worth it to also make it available
under the name path, so keep using pathpkg.

Change-Id: I7f8fa7a11de338b9a7c0f58a48d5af68b5639cfe
Reviewed-on: https://go-review.googlesource.com/c/go/+/630475
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agocrypto/internal/fips140/edwards25519: make Scalar.SetCanonicalBytes constant time
Filippo Valsorda [Mon, 10 Feb 2025 10:30:52 +0000 (11:30 +0100)]
crypto/internal/fips140/edwards25519: make Scalar.SetCanonicalBytes constant time

Internally we only use SetCanonicalBytes as part of Ed25519
verification, where all inputs are public, so it doesn't need to be
constant time.

However, this code is replicated outside of the standard library. Even
there, an attack is not practical, so this should not be considered a
security vulnerability:

  - For specific scalars, this only leaks at most four bits of
    information, and always the same four bits (so it's not an adaptive
    attack).

  - For derived scalars, assuming they are valid and uniformly
    distributed, the loop would return true on the first iteration with
    probability (1 - 2⁻¹²⁷) due to the shape of the scalar field order.

Still, making it constant time is easy enough and saves the next person
from having to think about it.

This was previously reported by Yawning Angel, and then as part of a
security audit.

Change-Id: I6a6a46563c8abecb0b4a6f12033a71c4c4da6fa7
Reviewed-on: https://go-review.googlesource.com/c/go/+/648035
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>

6 months agointernal/godebugs: add fips140 as an opaque godebug setting
Ian Lance Taylor [Thu, 13 Feb 2025 22:40:01 +0000 (14:40 -0800)]
internal/godebugs: add fips140 as an opaque godebug setting

This permits using "godebug fips140=on" in go.mod and
using "//go:debug fips140=on" in the main package.

Change code references to the godebug setting to remove the #
which is no longer required.

For #71666

Change-Id: I3a60ecc55b03848dadd6d431eb43137b6df6568b
Reviewed-on: https://go-review.googlesource.com/c/go/+/649495
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
6 months agocrypto/rsa: add benchmarks for not and partially optimized keys
Filippo Valsorda [Tue, 17 Dec 2024 19:40:49 +0000 (20:40 +0100)]
crypto/rsa: add benchmarks for not and partially optimized keys

Updates #59695

Change-Id: I7944195c805cd9da819cdf2bd49ecb2423ccd73b
Reviewed-on: https://go-review.googlesource.com/c/go/+/637178
Auto-Submit: 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>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
6 months agodoc/godebug: mention GODEBUG=fips140
Ian Lance Taylor [Tue, 11 Feb 2025 23:53:20 +0000 (15:53 -0800)]
doc/godebug: mention GODEBUG=fips140

Fixes #71666

Change-Id: Ice816cf2943c5b6660f05934b4c7ca38545714b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/648520
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agocmd/compile: add type-based alias analysis
Andrey Bokhanko [Wed, 27 Nov 2024 17:47:58 +0000 (20:47 +0300)]
cmd/compile: add type-based alias analysis

Make ssa.disjoint call ssa.disjointTypes to disambiguate Values based on
their types. Only one type-based rule is employed: a Type can't alias
with a pointer (https://pkg.go.dev/unsafe#Pointer).

Fixes #70488

Change-Id: I5a7e75292c2b6b5a01fb9048e3e2360e31dbcdd9
Reviewed-on: https://go-review.googlesource.com/c/go/+/632176
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
6 months agobytes: add examples for Lines, SplitSeq, SplitAfterSeq, FieldsSeq and FieldsFuncSeq
cuishuang [Thu, 13 Feb 2025 07:28:21 +0000 (15:28 +0800)]
bytes: add examples for Lines, SplitSeq, SplitAfterSeq, FieldsSeq and FieldsFuncSeq

Change-Id: I0e755d5c73f14d2c98853bdd31a7f2e84c92a906
Reviewed-on: https://go-review.googlesource.com/c/go/+/648860
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agointernal/syscall/unix: correct fchmodat on openbsd
Joel Sing [Fri, 14 Feb 2025 17:45:04 +0000 (04:45 +1100)]
internal/syscall/unix: correct fchmodat on openbsd

This is incorrectly calling the fchownat trampoline - call fchmodat
as intended.

Change-Id: I7b1e758d456006303ca95b70df9e6b52d3020158
Reviewed-on: https://go-review.googlesource.com/c/go/+/649655
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Bypass: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Commit-Queue: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>

6 months agosyscall: skip testAmbientCaps tests if there is no nobody user
Carlos Ramos Carreño [Fri, 14 Feb 2025 10:14:29 +0000 (10:14 +0000)]
syscall: skip testAmbientCaps tests if there is no nobody user

When there is not a nobody user (for example inside Docker), the
tests TestAmbientCaps and TestAmbientCapsUserns should be skipped
instead of failing.

Fixes #71644

Change-Id: I7f92db19e2b6f449d8d897650a0ecd89f5150f4a
GitHub-Last-Rev: a4c4f5bb61929b4981dc0b92d773bd4ef13d7d3d
GitHub-Pull-Request: golang/go#71729
Reviewed-on: https://go-review.googlesource.com/c/go/+/649396
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
6 months agointernal/syscall/unix: fix fchownat linkname for AIX & Solaris
Damien Neil [Fri, 14 Feb 2025 17:06:21 +0000 (09:06 -0800)]
internal/syscall/unix: fix fchownat linkname for AIX & Solaris

Typo fix: libc_chownat => libc_fchownat

Change-Id: I6721a988c19e3438b967a73559159c948ed51a0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/649636
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agonet/http: use runtime.AddCleanup instead of runtime.SetFinalizer
Carlos Amedee [Tue, 11 Feb 2025 20:50:55 +0000 (15:50 -0500)]
net/http: use runtime.AddCleanup instead of runtime.SetFinalizer

Replace the usage of runtime.SetFinalizer with runtime.AddCleanup in
tests.

Updates #70907

Change-Id: Idd3f1c07f6a7709352ca09948fbcb4a0ad9418bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/648655
Auto-Submit: Carlos Amedee <carlos@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agointernal/trace: emit sync event before deferred spilled error
Michael Anthony Knyszek [Thu, 13 Feb 2025 19:45:52 +0000 (19:45 +0000)]
internal/trace: emit sync event before deferred spilled error

CL 648315 and CL 648195 fixed #71615 in the case where we fail to read
the next generation by emitting an extra sync event before returning an
error. But, it's possible we failed to even read the next spilled batch
when we read the first generation, and have been carrying the error from
trying to read a spilled batch since the last generation. In this case,
we don't emit a final sync event, meaning that there are still some
cases where #71615 happens.

This change emits the final sync event in this corner case. I believe
this is the final corner case. I could previously reproduce the issue
by running the test under stress2, but I can no longer reproduce any
failures after this change.

Fixes #71615, for real this time.

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

6 months agocrypto/rsa: normalize GenerateKey benchmark
Filippo Valsorda [Sat, 28 Dec 2024 21:32:59 +0000 (22:32 +0100)]
crypto/rsa: normalize GenerateKey benchmark

Benchmarking key generation is a pain. The number of random candidates
explored before finding a prime varies greatly, and on top of that some
rejections happen in the trial divisions step and some in the
Miller-Rabin step.

However, we can calculate on average how many candidates we should
reject before finding a prime, and of those how many should be divisible
by small primes. (And even the number of multiplications in a
Miller-Rabin iteration.) The new checked in sequence of candidates is
normalized to represent the average case.

It doesn't normalize the runtime of GCD, but running the benchmark with
20 different randomly generated "average cases" produces very consistent
results, so it must not matter much.

goos: darwin
goarch: arm64
pkg: crypto/rsa
cpu: Apple M2
                   │  regen.txt  │
                   │   sec/op    │
GenerateKey/2048-8   136.4m ± 0%

Changed slightly the excess masking in keygen.go to make it easier to
feed fixed candidates. This might also make it easier to share test
vectors in the future.

Change-Id: I66696c693f35da7bda27db537aa3bf3b991e970e
Reviewed-on: https://go-review.googlesource.com/c/go/+/639335
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agonet/http: unskip TestDisableContentLength/h2
Dmitri Shuralyov [Fri, 14 Feb 2025 00:15:49 +0000 (19:15 -0500)]
net/http: unskip TestDisableContentLength/h2

h2_bundle.go has been updated.

Change-Id: I055b8db9aab964621c980e4731011c89f7694405
Reviewed-on: https://go-review.googlesource.com/c/go/+/649496
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

6 months agocmd/go: use runtime.AddCleanup instead of runtime.SetFinalizer
Carlos Amedee [Mon, 6 Jan 2025 18:15:51 +0000 (13:15 -0500)]
cmd/go: use runtime.AddCleanup instead of runtime.SetFinalizer

Replace the usage of runtime.SetFinalizer with runtime.AddCleanup.
This changes a test and how when the Go command panics when a file is
left locked.

Updates #70907

Change-Id: I8d8c56d16486728f9bd4b910b81796ae506bda74
Reviewed-on: https://go-review.googlesource.com/c/go/+/640736
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agosync: use runtime.AddCleanup instead of runtime.SetFinalizer
Carlos Amedee [Mon, 6 Jan 2025 17:59:07 +0000 (12:59 -0500)]
sync: use runtime.AddCleanup instead of runtime.SetFinalizer

This changes the use of finalizers to the cleanup implementation in
tests.

Updates #70907

Change-Id: I7d7289999a83fa53f538698f34294f7d9651c921
Reviewed-on: https://go-review.googlesource.com/c/go/+/640735
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agocmd/asm,cmd/internal/obj/riscv: implement vector configuration setting instructions
Joel Sing [Sun, 24 Nov 2024 01:39:20 +0000 (12:39 +1100)]
cmd/asm,cmd/internal/obj/riscv: implement vector configuration setting instructions

Implement vector configuration setting instructions (VSETVLI,
VSETIVLI, VSETL).  These allow the vector length (vl) and vector
type (vtype) CSRs to be configured via a single instruction.
Unfortunately each instruction has its own dedicated encoding.

In the case of VSETVLI/VSETIVLI, the vector type is specified via
a series of special operands, which specify the selected element
width (E8, E16, E32, E64), the vector register group multiplier
(M1, M2, M4, M8, MF2, MF4, MF8), the vector tail policy (TU, TA)
and vector mask policy (MU, MA). Note that the order of these
special operands matches non-Go assemblers.

Partially based on work by Pengcheng Wang <wangpengcheng.pp@bytedance.com>.

Cq-Include-Trybots: luci.golang.try:gotip-linux-riscv64
Change-Id: I431f59c1e048a3e84754f0643a963da473a741fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/631936
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agocmd/dist: use slices.Index
qiulaidongfeng [Wed, 12 Feb 2025 16:41:13 +0000 (00:41 +0800)]
cmd/dist: use slices.Index

Change-Id: Ifcab176faa2ac55e60576cf6acd96a18d0e860ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/648859
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

6 months agotesting: panic in AllocsPerRun if parallel tests are running
Russ Cox [Wed, 20 Nov 2024 16:01:27 +0000 (11:01 -0500)]
testing: panic in AllocsPerRun if parallel tests are running

If other tests are running, AllocsPerRun's result will be inherently flaky.
Saw this with CL 630136 and #70327.

Proposed in #70464.

Fixes #70464.

Change-Id: I190afdf26bc31299f6e5e8665b4fb420ffd554ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/630137
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agocmd/link,cmd/internal: add R_GOT_PCREL_ITYPE_RELOC for riscv64
Meng Zhuo [Thu, 12 Sep 2024 12:03:59 +0000 (20:03 +0800)]
cmd/link,cmd/internal: add R_GOT_PCREL_ITYPE_RELOC for riscv64

This CL adds new relocation type for riscv64: R_GOT_PCREL_ITYPE_RELOC
which generate an AUIPC + I-type pair with relocation type of GOT_HI20
and PCREL_LO12_I.
According to RISCV elf psabi doc, medium position independent code
model, the GNU as example is:

```
# Calculate address of non-local symbol
.Ltmp3: aupipc a0, %got_pcrel_hi(symbol)
ld a0, %pcrel_lo(.Ltmp3)(a0)
```

Change-Id: I719dd05e009ca2d9291f0689b346c059f9c56918
Reviewed-on: https://go-review.googlesource.com/c/go/+/612635
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agonet/http, net/http/internal/httpcommon: add httpcommon package
Damien Neil [Thu, 13 Feb 2025 22:38:09 +0000 (14:38 -0800)]
net/http, net/http/internal/httpcommon: add httpcommon package

The golang.org/x/net/internal/httpcommon package is
a new package containing internal functions common to the
HTTP/2 and HTTP/3 implementations.

Update to golang.org/x/net@v0.35.1-0.20250213222735-884432780bfd,
which includes the httpcommon package.

Since net/http can't depend on a x/net/internal package,
add net/http/internal/httpcommon which bundles the x/net
package.

Change-Id: Iba6c4be7b3e2d9a9d79c4b5153497b0e04b4497b
Reviewed-on: https://go-review.googlesource.com/c/go/+/649296
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
6 months agoos: add Root.Chown
Damien Neil [Mon, 10 Feb 2025 23:35:17 +0000 (15:35 -0800)]
os: add Root.Chown

For #67002

Change-Id: I546537618cbe32217fa72264d49db2b1a1d3b6db
Reviewed-on: https://go-review.googlesource.com/c/go/+/648295
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agocmd/compile: make write barrier code amenable to paired loads/stores
Keith Randall [Sun, 24 Nov 2024 01:35:02 +0000 (17:35 -0800)]
cmd/compile: make write barrier code amenable to paired loads/stores

It currently isn't because it does load/store/load/store/...
Rework to do overwrite processing in pairs so it is instead
load/load/store/store/...

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

6 months agocmd/compile: regalloc: handle desired registers of 2-output insns
Keith Randall [Sat, 23 Nov 2024 18:58:47 +0000 (10:58 -0800)]
cmd/compile: regalloc: handle desired registers of 2-output insns

Particularly with 2-word load instructions, this becomes important.
Classic example is:

    func f(p *string) string {
        return *p
    }

We want the two loads to put the return values directly into
the two ABI return registers.

At this point in the stack, cmd/go is 1.1% smaller.

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

6 months agocmd/compile: pair loads and stores on arm64
khr@golang.org [Sun, 17 Nov 2024 20:07:34 +0000 (12:07 -0800)]
cmd/compile: pair loads and stores on arm64

Look for possible paired load/store operations on arm64.
I don't expect this would be a lot faster, but it will save
binary space, and indirectly through the icache at least a bit
of time.

Change-Id: I4dd73b0e6329c4659b7453998f9b75320fcf380b
Reviewed-on: https://go-review.googlesource.com/c/go/+/629256
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
6 months agocmd/compile: add variants of LDP/STP for arm64 load/store combining
khr@golang.org [Mon, 18 Nov 2024 00:42:37 +0000 (16:42 -0800)]
cmd/compile: add variants of LDP/STP for arm64 load/store combining

These will be used in a subsequent CL.

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

6 months agoos: explicitly return nil for {rootChmod,rootMkdir,rootRemove} in root_openat.go
Jes Cok [Thu, 13 Feb 2025 16:02:20 +0000 (16:02 +0000)]
os: explicitly return nil for {rootChmod,rootMkdir,rootRemove} in root_openat.go

It is consistent with same functions in root_noopenat.go.

Change-Id: I81415fd3922101499fcbbdec97e315add0671acb
GitHub-Last-Rev: 3444e8546ee1877feb644202ad2b05379b4b7e74
GitHub-Pull-Request: golang/go#71715
Reviewed-on: https://go-review.googlesource.com/c/go/+/649235
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agoos: consolidate and clarify File.Fd docs
Ian Lance Taylor [Tue, 11 Feb 2025 20:56:27 +0000 (12:56 -0800)]
os: consolidate and clarify File.Fd docs

Change-Id: Id062b969fe7d6908a0797b36a4a379e4d46ba557
Reviewed-on: https://go-review.googlesource.com/c/go/+/648516
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
6 months agocmd/compile: move []byte->string map key optimization to ssa
Keith Randall [Mon, 6 Jan 2025 23:28:22 +0000 (15:28 -0800)]
cmd/compile: move []byte->string map key optimization to ssa

If we call slicebytetostring immediately (with no intervening writes)
before calling map access or delete functions with the resulting
string as the key, then we can just use the ptr/len of the
slicebytetostring argument as the key. This avoids an allocation.

Fixes #44898
Update #71132

There's old code in cmd/compile/internal/walk/order.go that handles
some of these cases.

1. m[string(b)]
2. s := string(b); m[s]
3. m[[2]string{string(b1),string(b2)}]

The old code handled cases 1&3. The new code handles cases 1&2.
We'll leave the old code around to keep 3 working, although it seems
not terribly common.

Case 2 happens particularly after inlining, so it is pretty common.

Change-Id: I8913226ca79d2c65f4e2bd69a38ac8c976a57e43
Reviewed-on: https://go-review.googlesource.com/c/go/+/640656
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agocmd/compile: lower x*z + y to FMA if FMA enabled
Jakub Ciolek [Sun, 2 Feb 2025 22:42:43 +0000 (23:42 +0100)]
cmd/compile: lower x*z + y to FMA if FMA enabled

There is a generic opcode for FMA, but we don't use it in rewrite rules.
This is maybe because some archs, like WASM and MIPS don't have a late
lowering rule for it.

Fixes #71204

Intel Alder Lake 12600k (GOAMD64=v3):

math:

name                    old time/op  new time/op  delta
Acos-16                 4.58ns ± 0%  3.36ns ± 0%  -26.68%  (p=0.008 n=5+5)
Acosh-16                8.04ns ± 1%  6.44ns ± 0%  -19.95%  (p=0.008 n=5+5)
Asin-16                 4.28ns ± 0%  3.32ns ± 0%  -22.24%  (p=0.008 n=5+5)
Asinh-16                9.92ns ± 0%  8.62ns ± 0%  -13.13%  (p=0.008 n=5+5)
Atan-16                 2.31ns ± 0%  1.84ns ± 0%  -20.02%  (p=0.008 n=5+5)
Atanh-16                7.79ns ± 0%  7.03ns ± 0%   -9.67%  (p=0.008 n=5+5)
Atan2-16                3.93ns ± 0%  3.52ns ± 0%  -10.35%  (p=0.000 n=5+4)
Cbrt-16                 4.62ns ± 0%  4.41ns ± 0%   -4.57%  (p=0.016 n=4+5)
Ceil-16                 0.14ns ± 1%  0.14ns ± 2%     ~     (p=0.103 n=5+5)
Copysign-16             0.33ns ± 0%  0.33ns ± 0%   +0.03%  (p=0.029 n=4+4)
Cos-16                  4.87ns ± 0%  4.75ns ± 0%   -2.44%  (p=0.016 n=5+4)
Cosh-16                 4.86ns ± 0%  4.86ns ± 0%     ~     (p=0.317 n=5+5)
Erf-16                  2.71ns ± 0%  2.25ns ± 0%  -16.69%  (p=0.008 n=5+5)
Erfc-16                 3.06ns ± 0%  2.67ns ± 0%  -13.00%  (p=0.016 n=5+4)
Erfinv-16               3.88ns ± 0%  2.84ns ± 3%  -26.83%  (p=0.008 n=5+5)
Erfcinv-16              4.08ns ± 0%  3.01ns ± 1%  -26.27%  (p=0.008 n=5+5)
Exp-16                  3.29ns ± 0%  3.37ns ± 2%   +2.64%  (p=0.016 n=4+5)
ExpGo-16                8.44ns ± 0%  7.48ns ± 1%  -11.37%  (p=0.008 n=5+5)
Expm1-16                4.46ns ± 0%  3.69ns ± 2%  -17.26%  (p=0.016 n=4+5)
Exp2-16                 8.20ns ± 0%  7.39ns ± 2%   -9.94%  (p=0.008 n=5+5)
Exp2Go-16               8.26ns ± 0%  7.23ns ± 0%  -12.49%  (p=0.016 n=4+5)
Abs-16                  0.26ns ± 3%  0.22ns ± 1%  -16.34%  (p=0.008 n=5+5)
Dim-16                  0.38ns ± 1%  0.40ns ± 2%   +5.02%  (p=0.008 n=5+5)
Floor-16                0.11ns ± 1%  0.17ns ± 4%  +54.99%  (p=0.008 n=5+5)
Max-16                  1.24ns ± 0%  1.24ns ± 0%     ~     (p=0.619 n=5+5)
Min-16                  1.24ns ± 0%  1.24ns ± 0%     ~     (p=0.484 n=5+5)
Mod-16                  13.4ns ± 1%  12.8ns ± 0%   -4.21%  (p=0.016 n=5+4)
Frexp-16                1.70ns ± 0%  1.71ns ± 0%   +0.46%  (p=0.008 n=5+5)
Gamma-16                3.97ns ± 0%  3.97ns ± 0%     ~     (p=0.643 n=5+5)
Hypot-16                2.11ns ± 0%  2.11ns ± 0%     ~     (p=0.762 n=5+5)
HypotGo-16              2.48ns ± 4%  2.26ns ± 0%   -8.94%  (p=0.008 n=5+5)
Ilogb-16                1.67ns ± 0%  1.67ns ± 0%   -0.07%  (p=0.048 n=5+5)
J0-16                   19.8ns ± 0%  19.3ns ± 0%     ~     (p=0.079 n=4+5)
J1-16                   19.4ns ± 0%  18.9ns ± 0%   -2.63%  (p=0.000 n=5+4)
Jn-16                   41.5ns ± 0%  40.6ns ± 0%   -2.32%  (p=0.016 n=4+5)
Ldexp-16                2.26ns ± 0%  2.26ns ± 0%     ~     (p=0.683 n=5+5)
Lgamma-16               4.40ns ± 0%  4.21ns ± 0%   -4.21%  (p=0.008 n=5+5)
Log-16                  4.05ns ± 0%  4.05ns ± 0%     ~     (all equal)
Logb-16                 1.69ns ± 0%  1.69ns ± 0%     ~     (p=0.429 n=5+5)
Log1p-16                5.00ns ± 0%  3.99ns ± 0%  -20.14%  (p=0.008 n=5+5)
Log10-16                4.22ns ± 0%  4.21ns ± 0%   -0.15%  (p=0.008 n=5+5)
Log2-16                 2.27ns ± 0%  2.25ns ± 0%   -0.94%  (p=0.008 n=5+5)
Modf-16                 1.44ns ± 0%  1.44ns ± 0%     ~     (p=0.492 n=5+5)
Nextafter32-16          2.09ns ± 0%  2.09ns ± 0%     ~     (p=0.079 n=4+5)
Nextafter64-16          2.09ns ± 0%  2.09ns ± 0%     ~     (p=0.095 n=4+5)
PowInt-16               10.8ns ± 0%  10.8ns ± 0%     ~     (all equal)
PowFrac-16              25.3ns ± 0%  25.3ns ± 0%   -0.09%  (p=0.000 n=5+4)
Pow10Pos-16             0.52ns ± 1%  0.52ns ± 0%     ~     (p=0.810 n=5+5)
Pow10Neg-16             0.82ns ± 0%  0.82ns ± 0%     ~     (p=0.381 n=5+5)
Round-16                0.93ns ± 0%  0.93ns ± 0%     ~     (p=0.056 n=5+5)
RoundToEven-16          1.64ns ± 0%  1.64ns ± 0%     ~     (all equal)
Remainder-16            12.4ns ± 2%  12.0ns ± 0%   -3.27%  (p=0.008 n=5+5)
Signbit-16              0.37ns ± 0%  0.37ns ± 0%   -0.19%  (p=0.008 n=5+5)
Sin-16                  4.04ns ± 0%  3.92ns ± 0%   -3.13%  (p=0.000 n=4+5)
Sincos-16               5.99ns ± 0%  5.80ns ± 0%   -3.03%  (p=0.008 n=5+5)
Sinh-16                 5.22ns ± 0%  5.22ns ± 0%     ~     (p=0.651 n=5+4)
SqrtIndirect-16         0.41ns ± 0%  0.41ns ± 0%     ~     (p=0.333 n=4+5)
SqrtLatency-16          2.66ns ± 0%  2.66ns ± 0%     ~     (p=0.079 n=4+5)
SqrtIndirectLatency-16  2.66ns ± 0%  2.66ns ± 0%     ~     (p=1.000 n=5+5)
SqrtGoLatency-16        30.1ns ± 0%  28.6ns ± 1%   -4.84%  (p=0.008 n=5+5)
SqrtPrime-16             645ns ± 0%   645ns ± 0%     ~     (p=0.095 n=5+4)
Tan-16                  4.21ns ± 0%  4.09ns ± 0%   -2.76%  (p=0.029 n=4+4)
Tanh-16                 5.36ns ± 0%  5.36ns ± 0%     ~     (p=0.444 n=5+5)
Trunc-16                0.12ns ± 6%  0.11ns ± 1%   -6.79%  (p=0.008 n=5+5)
Y0-16                   19.2ns ± 0%  18.7ns ± 0%   -2.52%  (p=0.000 n=5+4)
Y1-16                   19.1ns ± 0%  18.4ns ± 0%     ~     (p=0.079 n=4+5)
Yn-16                   40.7ns ± 0%  39.5ns ± 0%   -2.82%  (p=0.008 n=5+5)
Float64bits-16          0.21ns ± 0%  0.21ns ± 0%     ~     (p=0.603 n=5+5)
Float64frombits-16      0.21ns ± 0%  0.21ns ± 0%     ~     (p=0.984 n=4+5)
Float32bits-16          0.21ns ± 0%  0.21ns ± 0%     ~     (p=0.778 n=4+5)
Float32frombits-16      0.21ns ± 0%  0.20ns ± 0%     ~     (p=0.397 n=5+5)
FMA-16                  0.82ns ± 0%  0.82ns ± 0%   +0.02%  (p=0.029 n=4+4)
[Geo mean]              2.87ns       2.74ns        -4.61%

math/cmplx:

name        old time/op  new time/op  delta
Abs-16      2.07ns ± 0%  2.05ns ± 0%   -0.70%  (p=0.016 n=5+4)
Acos-16     36.5ns ± 0%  35.7ns ± 0%   -2.33%  (p=0.029 n=4+4)
Acosh-16    37.0ns ± 0%  36.2ns ± 0%   -2.20%  (p=0.008 n=5+5)
Asin-16     36.5ns ± 0%  35.7ns ± 0%   -2.29%  (p=0.008 n=5+5)
Asinh-16    33.5ns ± 0%  31.6ns ± 0%   -5.51%  (p=0.008 n=5+5)
Atan-16     15.5ns ± 0%  13.9ns ± 0%  -10.61%  (p=0.008 n=5+5)
Atanh-16    15.0ns ± 0%  13.6ns ± 0%   -9.73%  (p=0.008 n=5+5)
Conj-16     0.11ns ± 5%  0.11ns ± 1%     ~     (p=0.421 n=5+5)
Cos-16      12.3ns ± 0%  12.2ns ± 0%   -0.60%  (p=0.000 n=4+5)
Cosh-16     12.1ns ± 0%  12.0ns ± 0%     ~     (p=0.079 n=4+5)
Exp-16      10.0ns ± 0%   9.8ns ± 0%   -1.77%  (p=0.008 n=5+5)
Log-16      14.5ns ± 0%  13.7ns ± 0%   -5.67%  (p=0.008 n=5+5)
Log10-16    14.5ns ± 0%  13.7ns ± 0%   -5.55%  (p=0.000 n=5+4)
Phase-16    5.11ns ± 0%  4.25ns ± 0%  -16.90%  (p=0.008 n=5+5)
Polar-16    7.12ns ± 0%  6.35ns ± 0%  -10.90%  (p=0.008 n=5+5)
Pow-16      64.3ns ± 0%  63.7ns ± 0%   -0.97%  (p=0.008 n=5+5)
Rect-16     5.74ns ± 0%  5.58ns ± 0%   -2.73%  (p=0.016 n=4+5)
Sin-16      12.2ns ± 0%  12.2ns ± 0%   -0.54%  (p=0.000 n=4+5)
Sinh-16     12.1ns ± 0%  12.0ns ± 0%   -0.58%  (p=0.000 n=5+4)
Sqrt-16     5.30ns ± 0%  5.18ns ± 0%   -2.36%  (p=0.008 n=5+5)
Tan-16      22.7ns ± 0%  22.6ns ± 0%   -0.33%  (p=0.008 n=5+5)
Tanh-16     21.2ns ± 0%  20.9ns ± 0%   -1.32%  (p=0.008 n=5+5)
[Geo mean]  11.3ns       10.8ns        -3.97%

Change-Id: Idcc4b357ba68477929c126289e5095b27a827b1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/646335
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
6 months agocmd: use cmd/internal/hash.New32 and Sum32 only
Russ Cox [Tue, 7 Jan 2025 16:28:44 +0000 (11:28 -0500)]
cmd: use cmd/internal/hash.New32 and Sum32 only

Do not use New16, New20, Sum16, Sum20 anymore.
As of CL 641096, these are just wrappers around New32 and Sum32.
Change call sites to use them directly.

Change-Id: Icea91a77449f6839b903894997057ba404bd04e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/641076
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 months agocmd/compile: implement signed loads from read-only memory
Keith Randall [Thu, 13 Feb 2025 16:04:03 +0000 (08:04 -0800)]
cmd/compile: implement signed loads from read-only memory

In addition to unsigned loads which already exist.

This helps code that does switches on strings to constant-fold
the switch away when the string being switched on is constant.

Fixes #71699

Change-Id: If3051af0f7255d2a573da6f96b153a987a7f159d
Reviewed-on: https://go-review.googlesource.com/c/go/+/649295
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@google.com>

6 months agoruntime: fix usleep on s390x/linux
Paul Murphy [Wed, 12 Feb 2025 14:45:34 +0000 (08:45 -0600)]
runtime: fix usleep on s390x/linux

The timespec argument takes the remainder in nanoseconds, not
microseconds. Convert the remaining time to nsec.

Fixes #71714

Change-Id: I36cbbe3a088830c5e3afcc9516ef42e96ee21268
Reviewed-on: https://go-review.googlesource.com/c/go/+/648915
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Axel Busch <axel.busch@ibm.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
6 months agocmd/go: do not apply kill timeout to go test with -bench
Sam Thanawalla [Mon, 10 Feb 2025 21:06:02 +0000 (21:06 +0000)]
cmd/go: do not apply kill timeout to go test with -bench

The testing package already does this. go test should do the same thing.

Fixes: #69181
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Change-Id: I942bd09c5832b48d498a2eb1f1500e1d294d0a2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/648236
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
6 months agogo/types: propagate *ast.LabeledStmt in blockBranches properly
Mateusz Poliwczak [Tue, 24 Dec 2024 07:23:13 +0000 (07:23 +0000)]
go/types: propagate *ast.LabeledStmt in blockBranches properly

Fixes #70974

Change-Id: I330c0ae53dcbcdb173ab514ee94f2ca53944df09
GitHub-Last-Rev: 7c2b740da6d6e94ac8787f04ad8942f3776ac56c
GitHub-Pull-Request: golang/go#70976
Reviewed-on: https://go-review.googlesource.com/c/go/+/638257
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
6 months agoio: use runtime.AddCleanup instead of runtime.SetFinalizer
Carlos Amedee [Mon, 23 Dec 2024 16:34:03 +0000 (11:34 -0500)]
io: use runtime.AddCleanup instead of runtime.SetFinalizer

Replace the usage of runtime.SetFinalizer with runtime.AddCleanup.

Updates #70907

Change-Id: Id604ca44ea67dcf8f87797e27347c6f4e9ad0b86
Reviewed-on: https://go-review.googlesource.com/c/go/+/638556
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Carlos Amedee <carlos@golang.org>
TryBot-Bypass: Carlos Amedee <carlos@golang.org>

6 months agogo/types: use documented version of gotypesalias GODEBUG
Mateusz Poliwczak [Sat, 14 Dec 2024 11:03:27 +0000 (11:03 +0000)]
go/types: use documented version of gotypesalias GODEBUG

This way the code would panic, in case it does not exist.

Change-Id: I95de7460c0386afdc5d3f6a847e9fcbd22446010
GitHub-Last-Rev: 9ae0502a091feed45169f5c1a7e2761f8ffa2841
GitHub-Pull-Request: golang/go#70845
Reviewed-on: https://go-review.googlesource.com/c/go/+/636097
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
6 months agoos: use AddCleanup to close files
Carlos Amedee [Mon, 23 Dec 2024 16:27:20 +0000 (11:27 -0500)]
os: use AddCleanup to close files

This changes the finalizer mechanism used to close files from
runtime.SetFinalizer to runtime.AddCleanup.

Updates #70907

Change-Id: I47582b81b0ed69609dd9dac158ec7bb8819c8c77
Reviewed-on: https://go-review.googlesource.com/c/go/+/638555
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agocrypto/internal/fips140test: fix TestACVP env vars
Daniel McCarney [Thu, 13 Feb 2025 15:31:53 +0000 (10:31 -0500)]
crypto/internal/fips140test: fix TestACVP env vars

Fix TestACVP environment construction to include both ACVP_WRAPPER and
GODEBUG.

Previously we were accidentally overwriting the cmd.Env, stomping the
ACVP_WRAPPER env var and replacing it with just the GODEBUG env var.
This in turn makes the tests start to fail when the test binary
subprocess is invoked without knowing it's fulfilling the role of the
wrapper, and not the test driver.

Change-Id: Ie6ee30c8b93b2051a671e12aaa63d2116c5eb8c8
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/649016
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>

6 months agoruntime/debug: document DefaultGODEBUG as a BuildSetting
Sean Liao [Fri, 12 Jul 2024 19:56:19 +0000 (20:56 +0100)]
runtime/debug: document DefaultGODEBUG as a BuildSetting

Fixes #66465

Change-Id: I60c017ddba29fa5b452b665d8521cd6c8e20438c
Reviewed-on: https://go-review.googlesource.com/c/go/+/597979
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: qiu laidongfeng2 <2645477756@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agocmd/dist: test GOFIPS140=latest rather than just the GODEBUG
Filippo Valsorda [Wed, 12 Feb 2025 11:37:52 +0000 (12:37 +0100)]
cmd/dist: test GOFIPS140=latest rather than just the GODEBUG

GOFIPS140=latest turns on the GODEBUG by default, and it's otherwise
untested.

Change-Id: I6a6a4656ff7ad313ce2c61ee4144ad2858bd148c
Reviewed-on: https://go-review.googlesource.com/c/go/+/648819
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
6 months agocrypto/internal/fips140test: require FIPS 140 mode for the ACVP wrapper
Filippo Valsorda [Thu, 6 Feb 2025 10:34:48 +0000 (11:34 +0100)]
crypto/internal/fips140test: require FIPS 140 mode for the ACVP wrapper

Change-Id: I6a6a46565c14cf1d924a8fcfbf6752e9646ec63d
Reviewed-on: https://go-review.googlesource.com/c/go/+/648818
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agocrypto/internal/fips140test: support disabling PAA/PAI
Filippo Valsorda [Wed, 5 Feb 2025 12:51:26 +0000 (13:51 +0100)]
crypto/internal/fips140test: support disabling PAA/PAI

FIPS 140-3 testing requires testing the module both with and without
platform hardware acceleration.

Change-Id: I6a6a4656faad883062d64bc8e2363d4c59bd8cce
Reviewed-on: https://go-review.googlesource.com/c/go/+/648817
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
6 months agocrypto/internal/fips140test: make TestCASTFailures standalone
Filippo Valsorda [Mon, 27 Jan 2025 12:02:27 +0000 (13:02 +0100)]
crypto/internal/fips140test: make TestCASTFailures standalone

We want it to work even when fips140test.test is cross-compiled and
moved to a different machine. Also, make it log more.

Change-Id: I6a6a46566712f05f6b551ecde75672baf2c0fc6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/644644
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>

6 months agocrypto/internal/fips140test: add functional tests
Filippo Valsorda [Mon, 27 Jan 2025 12:02:27 +0000 (13:02 +0100)]
crypto/internal/fips140test: add functional tests

Running TestIntegrityCheckFailure|TestCASTFailures|TestFIPS140 with -v
and the appropriate GOFIPS140 environment variables will produce logs
sufficient for the functional testing session of the FIPS 140-3
validation. The tests can also be cross-compiled with -c and executed on
the target.

Change-Id: I6a6a465606518923d3f288e030c0f1b977aa6415
Reviewed-on: https://go-review.googlesource.com/c/go/+/648816
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
6 months agointernal/abi: remove go122 flag
Keith Randall [Wed, 12 Feb 2025 23:24:10 +0000 (15:24 -0800)]
internal/abi: remove go122 flag

We no longer need this flag in case we need to rollback.

Change-Id: Id8b8f76380237f2d80a14037e88df4917c843f03
Reviewed-on: https://go-review.googlesource.com/c/go/+/649095
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@google.com>

6 months agocmd/pprof: update vendored github.com/google/pprof [generated]
Dmitri Shuralyov [Tue, 11 Feb 2025 23:08:32 +0000 (18:08 -0500)]
cmd/pprof: update vendored github.com/google/pprof [generated]

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-20250208200701-d0013a598941
go mod tidy
go mod vendor

Change-Id: I87e5621286d3db85f358fb86875aaf65bd7811a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/648916
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agoreflect, internal/abi: speed up TypeFor[T]
Mateusz Poliwczak [Wed, 12 Feb 2025 07:16:32 +0000 (07:16 +0000)]
reflect, internal/abi: speed up TypeFor[T]

goos: linux
goarch: amd64
pkg: reflect
cpu: AMD Ryzen 5 4600G with Radeon Graphics
                 │ /tmp/before  │              /tmp/after              │
                 │    sec/op    │    sec/op     vs base                │
TypeForString-12    2.091n ± 1%    1.174n ± 1%  -43.84% (p=0.000 n=20)
TypeForError-12    7.5810n ± 3%   0.9372n ± 1%  -87.64% (p=0.000 n=20)

Change-Id: I22022f99b2dd2029f02d9ed8477b209adf7e9496
GitHub-Last-Rev: 64d2ac5bb2f3b2a659663832a4641ff4fc83bddd
GitHub-Pull-Request: golang/go#71654
Reviewed-on: https://go-review.googlesource.com/c/go/+/648395
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

6 months agointernal/syscall: add cgo_import_dynamic for Fchmodat on AIX and Solaris
Damien Neil [Wed, 12 Feb 2025 17:23:14 +0000 (09:23 -0800)]
internal/syscall: add cgo_import_dynamic for Fchmodat on AIX and Solaris

For #67002

Change-Id: I1709fd51ba52c074501420943d311c785a49d851
Reviewed-on: https://go-review.googlesource.com/c/go/+/649015
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agocrypto/tls: document FIPS 140-3 mode behavior
Filippo Valsorda [Thu, 6 Feb 2025 10:34:20 +0000 (11:34 +0100)]
crypto/tls: document FIPS 140-3 mode behavior

Change-Id: I6a6a465612cf76d148b9758ee3fcdc8606497830
Reviewed-on: https://go-review.googlesource.com/c/go/+/648835
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agovet: add regression test for printf checker regression
Alan Donovan [Wed, 4 Sep 2024 16:30:47 +0000 (12:30 -0400)]
vet: add regression test for printf checker regression

Updates golang/go#68796

Change-Id: I5bfa80216deff76fd9aabe9882f93fbfaebef957
Reviewed-on: https://go-review.googlesource.com/c/go/+/610737
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
6 months agocmd/go: clarify vcs suffix to repo mapping
Sean Liao [Tue, 11 Feb 2025 16:30:22 +0000 (16:30 +0000)]
cmd/go: clarify vcs suffix to repo mapping

For #71635

Change-Id: I12ec2a810cfcaf2565b0d9c518b0921ec54e9f12
Reviewed-on: https://go-review.googlesource.com/c/go/+/648475
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
6 months agocmd/go: add errors obtaining c compiler version to cache key
Michael Matloob [Mon, 10 Feb 2025 20:17:54 +0000 (15:17 -0500)]
cmd/go: add errors obtaining c compiler version to cache key

If there's an error getting the version of the c compiler, add the error
to the input used to produce the cache key. In the case where we can't
parse the version, the text of the output of the command is part of the
error, so different unparseable versions will produce different cache
keys. Before, we wouldn't add anything to the key when there was an
error getting the version, so we wouldn't distinguish a missing compiler
from one where we couldn't parse the version.

Fixes #64589

Change-Id: I27f853e8ff40002e2f045b2210633b38f93d0130
Reviewed-on: https://go-review.googlesource.com/c/go/+/648196
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
6 months agoall: update vendored dependencies [generated]
Dmitri Shuralyov [Tue, 11 Feb 2025 22:59:59 +0000 (17:59 -0500)]
all: update vendored dependencies [generated]

The tree has opened for Go 1.25 development. 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

# Update a cmd/vet test case.
cat <<EOF | patch
diff --git a/src/cmd/vet/testdata/print/print.go b/src/cmd/vet/testdata/print/print.go
index a2ad0f1298..fffe571163 100644
--- a/src/cmd/vet/testdata/print/print.go
+++ b/src/cmd/vet/testdata/print/print.go
@@ -200,8 +200,8 @@ func PrintfTests() {
  // Bad argument reorderings.
  Printf("%[xd", 3)                      // ERROR "Printf format %\[xd is missing closing \]"
  Printf("%[x]d x", 3)                   // ERROR "Printf format has invalid argument index \[x\]"
- Printf("%[3]*s x", "hi", 2)            // ERROR "Printf format has invalid argument index \[3\]"
- _ = fmt.Sprintf("%[3]d x", 2)          // ERROR "Sprintf format has invalid argument index \[3\]"
+ Printf("%[3]*s x", "hi", 2)            // ERROR "Printf format %\[3\]\*s reads arg #3, but call has 2 args"
+ _ = fmt.Sprintf("%[3]d x", 2)          // ERROR "Sprintf format %\[3\]d reads arg #3, but call has 1 arg"
  Printf("%[2]*.[1]*[3]d x", 2, "hi", 4) // ERROR "Printf format %\[2]\*\.\[1\]\*\[3\]d uses non-int \x22hi\x22 as argument of \*"
  Printf("%[0]s x", "arg1")              // ERROR "Printf format has invalid argument index \[0\]"
  Printf("%[0]d x", 1)                   // ERROR "Printf format has invalid argument index \[0\]"
EOF

# Temporarily hold x/net back to leave out CL 643780 because it's
# causing an import cycle in net/http's generated h2_bundle.go.
cd src
sed -i '' 's|"golang.org/x/net/internal/httpcommon"||' net/http/h2_bundle.go
go get golang.org/x/net@v0.34.1-0.20250123000230-c72e89d6a9e4  # version before CL 643780
go mod tidy
go mod vendor
go generate net/http

Change-Id: I91967ceb797bbc741af024cd2d2dba29dc558384
Reviewed-on: https://go-review.googlesource.com/c/go/+/648735
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

6 months agoruntime: make TestSpuriousWakeupsNeverHangSemasleep more robust
Michael Anthony Knyszek [Tue, 11 Feb 2025 17:56:21 +0000 (17:56 +0000)]
runtime: make TestSpuriousWakeupsNeverHangSemasleep more robust

This change modifies this test (which involves an arbitrary timeout) to
be a little less flaky by double-checking that our subprocess program
completed even if the ticker fires and we've exceeded our timeout. The
logic behind this change is that the testing goroutine might get delayed
for any number of reasons, but the subprocess could still complete in
time. Still, the goroutine will wake up to handle the ticker and see its
over time, even though the event it was waiting for did actually happen.

I can't reproduce #71548 locally, so I suspect because this test calls
t.Parallel other load can delay the testing goroutine enough for this to
happen (especially with GODEBUG=gccheckmark=1, which pauses
everything to perform a full mark and sweep, and runtime tests love to
call runtime.GC).

For #71548.

Change-Id: I83e86a0115f65950886b57b5af0b4a517ef5f90f
Reviewed-on: https://go-review.googlesource.com/c/go/+/648576
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Commit-Queue: Michael Knyszek <mknyszek@google.com>

6 months agocmd/go: initialize req.Header when loading git credential
Quan Tong [Fri, 7 Feb 2025 11:42:26 +0000 (18:42 +0700)]
cmd/go: initialize req.Header when loading git credential

Fixes #71604

Change-Id: I3d733a50b4451dfb571aba91a28387ba9e0614dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/647615
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agocmd/go: document -modfile and other flags for 'go tool'
thepudds [Tue, 11 Feb 2025 17:59:54 +0000 (12:59 -0500)]
cmd/go: document -modfile and other flags for 'go tool'

Mention -modfile, -C, -overlay, and -modcacherw in the 'go tool'
documentation. We let a reference to 'go help build' give a pointer to
more detailed information.

The -modfile flag in particular is newly useful with the Go 1.24 support
for user-defined tools with 'go tool'.

Updates #48429
Updates #33926
Updates #71663
Fixes #71502

Change-Id: Ida67df50ff774a0886733d661a40e27c2cadc0f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/648577
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Conrad Irwin <conrad.irwin@gmail.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>

6 months agocmd/dist: correct gccheckmark test name
Cherry Mui [Wed, 12 Feb 2025 01:47:55 +0000 (20:47 -0500)]
cmd/dist: correct gccheckmark test name

The test actually runs with gccheckmark=1, not gcstoptheworld=2.
Make the name match.

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

6 months agomake.bat,race.bat: simplify --dist-tool handling
qmuntal [Tue, 11 Feb 2025 18:23:11 +0000 (18:23 +0000)]
make.bat,race.bat: simplify --dist-tool handling

make.bat accepts the --dist-tool flag on multiple flag positions
and also allows omitting the trailing dash. Doing so adds complexity
and is not aligned with the make.bash and make.rc behavior. Remove that
flexibility to simplify the code and make it more consistent. This also
fixes a bug where dist.exe wouldn't be removed from cmd\dist when
running make.bat --dist-tool.

Also, there is no need for race.bat to invoke make.bat with --dist-tool.
It uses it to get the GOHOSTARCH env value, but we can already get
that from the built-in PROCESSOR_ARCHITECTURE env variable.

Change-Id: Ia673562c1ae6aff9bd3ec7aa8cdd25ff187eeb79
Reviewed-on: https://go-review.googlesource.com/c/go/+/648615
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>
Reviewed-by: Cherry Mui <cherryyz@google.com>
6 months agocrypto/internal/fips140test: add cSHAKE ACVP tests
Daniel McCarney [Thu, 23 Jan 2025 19:34:46 +0000 (14:34 -0500)]
crypto/internal/fips140test: add cSHAKE ACVP tests

Adds ACVP test coverage for the SP 800-185 cSHAKE-128 and cSHAKE-256
algorithms based on the NIST spec:

  https://pages.nist.gov/ACVP/draft-celi-acvp-xof.html

Updates #69642

Change-Id: I4a6ef9a99dfe520f3177e0e7c258326475690f5f
Reviewed-on: https://go-review.googlesource.com/c/go/+/648455
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agocrypto/internal/fips140test: add KTS-IFC ACVP tests
Daniel McCarney [Wed, 22 Jan 2025 19:49:46 +0000 (14:49 -0500)]
crypto/internal/fips140test: add KTS-IFC ACVP tests

Adds ACVP test coverage for the SP 800-56Brev2 KTS-OAEP-basic algorithm
based on the NIST spec:

   https://pages.nist.gov/ACVP/draft-hammett-acvp-kas-ifc.html

Change-Id: I31240af30a73ee9f0ef00f47129738860378ea8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/648436
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agocrypto/internal/fips140test: add OneStepNoCounter ACVP tests
Daniel McCarney [Tue, 14 Jan 2025 19:56:20 +0000 (14:56 -0500)]
crypto/internal/fips140test: add OneStepNoCounter ACVP tests

Adds ACVP test coverage for the SP 800-56Crev2 IG D.P KDA
OneStepNoCounter mode algorithm based on the NIST spec:

  https://pages.nist.gov/ACVP/draft-hammett-acvp-kas-kdf-onestepnocounter.html

Coverage is added for all SHA2 and SHA3 HMACs.

Updates #69642

Change-Id: I337bf824a71fce6c796a1440b7f08c4f5413d92f
Reviewed-on: https://go-review.googlesource.com/c/go/+/648435
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>

6 months agoruntime: update HACKING.md with execution traces and debuglog
Michael Anthony Knyszek [Sat, 1 Feb 2025 05:51:33 +0000 (05:51 +0000)]
runtime: update HACKING.md with execution traces and debuglog

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

6 months agointernal/trace/tracev2: add guide for trace experiments
Michael Anthony Knyszek [Tue, 28 Jan 2025 20:59:54 +0000 (20:59 +0000)]
internal/trace/tracev2: add guide for trace experiments

Change-Id: I6fb354a57f3e73bd6589570868c7d68369adcf3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/645136
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>

6 months agointernal/trace: interpret string ID arguments for experimental events
Michael Anthony Knyszek [Tue, 28 Jan 2025 20:54:34 +0000 (20:54 +0000)]
internal/trace: interpret string ID arguments for experimental events

Currently one of the reasons experimental events are tricky to use is
because:
- There's no way to take advantage of the existing infrastructure, like
  strings and stacks, and
- There's no way to attach arbitrary data to an event (except through
  strings, possibly).

Fix this by abstracting away the raw arguments in an ExperimentalEvent
and requiring access to the arguments via a new method, ArgValue. This
returns a Value, which gives us an opportunity to construct a typed
value for the raw argument dynamically, and a way to access existing
tables. The type of the argument is deduced from conventions for the
argument's name. This seems more than sufficient for experimental
events.

To make this work, we also need to add a "string" variant to the Value
type. This may be a little confusing since they're primarily used for
metrics, but one could imagine other scenarios in which this is useful,
such as including build information in the trace as a metric, so I think
this is fine.

This change also updates the Value API to accomodate a String method for
use with things that expect a fmt.Stringer, which means renaming the
value assertion methods to have a "To" prefix.

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

6 months agointernal/trace: move fake P IDs to internal/trace/traceviewer
Michael Anthony Knyszek [Mon, 27 Jan 2025 21:47:24 +0000 (21:47 +0000)]
internal/trace: move fake P IDs to internal/trace/traceviewer

These fake P IDs really only belong to the traceviewer.

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

6 months agointernal/trace: clean up parser.go
Michael Anthony Knyszek [Mon, 27 Jan 2025 21:42:34 +0000 (21:42 +0000)]
internal/trace: clean up parser.go

parser.go is an old file that contains trace v1 definitions and a second
equivalent definition for stack frames. These are redundant and useless.
Delete these definitions and rename the file to fakep.go, which
describes the only thing left in this file, a bunch of fake P IDs used
by the trace viewer.

We should consider moving the fake P definitions elsewhere, too.

Change-Id: Ifd0768bd73c39009069445afe0155f1e352f00c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/644875
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>

6 months agoruntime: use internal/trace/tracev2 definitions
Michael Anthony Knyszek [Wed, 29 Jan 2025 17:17:04 +0000 (17:17 +0000)]
runtime: use internal/trace/tracev2 definitions

This change deduplicates trace wire format definitions between the
runtime and the trace parser by making the internal/trace/tracev2
package the source of truth.

Change-Id: Ia0721d3484a80417e40ac473ec32870bee73df09
Reviewed-on: https://go-review.googlesource.com/c/go/+/644221
Auto-Submit: 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>

6 months agointernal/trace: move maxArgs into tracev2 and validate specs
Michael Anthony Knyszek [Sat, 1 Feb 2025 05:26:17 +0000 (05:26 +0000)]
internal/trace: move maxArgs into tracev2 and validate specs

This change moves maxArgs to tracev2 and renames it MaxTimedEventArgs.
It also updates the tests to make sure the specs conform to this
requirement.

Change-Id: I7b0c888a4dfd83306a470a4c9b0f9e44fe2e7818
Reviewed-on: https://go-review.googlesource.com/c/go/+/646016
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

6 months agointernal/trace/tracev2: add test to validate spec invariants
Michael Anthony Knyszek [Sat, 1 Feb 2025 04:52:57 +0000 (04:52 +0000)]
internal/trace/tracev2: add test to validate spec invariants

This change adds a test to help guide people adding experiments to this
package by validating that the spec is written correctly.

Also, makes some minor tweaks to the package in order to get the tests
to pass.

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

6 months ago{all,clean,make,race,run}.bat: simplify error handling
qmuntal [Tue, 11 Feb 2025 08:17:08 +0000 (09:17 +0100)]
{all,clean,make,race,run}.bat: simplify error handling

The bat files can use "if" + parentheses to make it easier to
understand how the if-case is handled rather than the more cryptic
"if" + "goto".

While here, replace some "goto"s with direct "exit" calls.

Change-Id: I20e1804439b5088f8f1e5cbf8676f3d58560109d
Reviewed-on: https://go-review.googlesource.com/c/go/+/648375
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
6 months agonet/http/httptest: match net/http ContentLength behavior for http.NoBody
Sean Liao [Fri, 19 Jul 2024 22:28:54 +0000 (23:28 +0100)]
net/http/httptest: match net/http ContentLength behavior for http.NoBody

Fixes #68476

Change-Id: I05122e5ec5e6b290eec93f3db444fcf1de19c030
Reviewed-on: https://go-review.googlesource.com/c/go/+/599815
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Daniel Martí <mvdan@mvdan.cc>

6 months agocmd/go/internal/modload: don't set GIT_SSH_COMMAND
Sean Liao [Sun, 9 Feb 2025 13:32:27 +0000 (13:32 +0000)]
cmd/go/internal/modload: don't set GIT_SSH_COMMAND

Allows git core.sshcommand to take effect when set by the user.
This was originally added to work around an issue in
OpenSSH < 7.3 (2016), see https://go.dev/issue/13453 .
A fixed version of OpenSSH should be widely available enough
that it is no longer necessary

Fixes #71482

Change-Id: I6f44cc354e8a4063e226cac78ec27117fcc40e93
Reviewed-on: https://go-review.googlesource.com/c/go/+/647995
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Auto-Submit: Daniel Martí <mvdan@mvdan.cc>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
6 months agointernal/trace: increment sync counter before final Sync on error
Michael Anthony Knyszek [Mon, 10 Feb 2025 23:54:56 +0000 (23:54 +0000)]
internal/trace: increment sync counter before final Sync on error

CL 648195 was supposed to have fixed #71615, but it didn't include an
update to r.syncs. I can confirm this CL fixes the issue even when
running the test many times in a row.

Fixes #71615.

Change-Id: I97db3d639dc5bc8648a191696f90b0e5087307c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/648315
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>

6 months agostrings: add examples for Lines, SplitSeq, SplitAfterSeq, FieldsSeq and FieldsFuncSeq
cuishuang [Fri, 7 Feb 2025 09:11:36 +0000 (17:11 +0800)]
strings: add examples for Lines, SplitSeq, SplitAfterSeq, FieldsSeq and FieldsFuncSeq

Change-Id: I1e5085ff2ed7f3d75ac3dc34ab72be6b55729fb7
Reviewed-on: https://go-review.googlesource.com/c/go/+/647575
Auto-Submit: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agoos: add Root.Chmod
Damien Neil [Thu, 30 Jan 2025 23:53:06 +0000 (15:53 -0800)]
os: add Root.Chmod

For #67002

Change-Id: Id6c3a2096bd10f5f5f6921a0441dc6d9e6cdeb3b
Reviewed-on: https://go-review.googlesource.com/c/go/+/645718
Commit-Queue: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>

6 months agocrypto/internal/fips140test: add feedback KDF ACVP tests
Daniel McCarney [Fri, 3 Jan 2025 19:30:02 +0000 (14:30 -0500)]
crypto/internal/fips140test: add feedback KDF ACVP tests

Adds ACVP test coverage for the SP 800-108r1 KDF feedback mode algorithm
based on the NIST spec:

  https://pages.nist.gov/ACVP/draft-celi-acvp-kbkdf.html

The HKDF-based implementation in our FIPS module fixes some parameters,
requiring tailoring of the advertised capability to match. Notably:

* We only support fixedDataOrder "after fixed data"
* We only support a counter length of 8 bits
* We only support empty IVs

No acvp_test.config.json update accompanies this support because the
ACVP tests for this algorithm aren't amenable to fixed data testing.

Updates #69642

Change-Id: I729e899377a64d2b613d6435241aebabeef93bca
Reviewed-on: https://go-review.googlesource.com/c/go/+/640016
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>

6 months agocrypto/internal/fips140test: add RSA ACVP tests
Daniel McCarney [Fri, 10 Jan 2025 16:10:12 +0000 (11:10 -0500)]
crypto/internal/fips140test: add RSA ACVP tests

Adds ACVP test coverage for the RSA algorithm based on the NIST spec:
  https://pages.nist.gov/ACVP/draft-celi-acvp-rsa.html

Includes coverage for keyGen, sigGen and sigVer across a variety of
modulus sizes. For sigGen and sigVer both PKCS1v1.5 and PSS are
supported with a variety of SHA2 digests.

The static test data from go-acvp only includes sigVer vectors/expected.
The keyGen and sigGen test types aren't amenable to fixed data testing.

Updates #69642

Change-Id: Ia61a69115f2d2a984b95435a37d4c9c6db90a89a
Reviewed-on: https://go-review.googlesource.com/c/go/+/642135
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
6 months agocrypto/internal/fips140test: add counter KDF ACVP tests
Daniel McCarney [Thu, 19 Dec 2024 17:45:57 +0000 (12:45 -0500)]
crypto/internal/fips140test: add counter KDF ACVP tests

Adds ACVP test coverage for the SP 800-108r1 KDF counter mode algorithm
based on the NIST spec:

  https://pages.nist.gov/ACVP/draft-celi-acvp-kbkdf.html

The implementation in our FIPS module fixes some parameters, requiring
tailoring of the advertised capability to match. Notably:

* We only support macModes CMAC-AES-128, -192, and -256
* We only support supportedLengths 256 (matching the [32]byte output
  from CounterKDF.DeriveKey)
* We only support fixedDataOrder "before fixed data"
* We only support counterLength 16

No acvp_test.config.json update accompanies this support because the
ACVP tests for this algorithm aren't amenable to fixed data testing.

Updates #69642

Change-Id: I9e02d6c8cb6e209ac8e4c9fba926fffbad916098
Reviewed-on: https://go-review.googlesource.com/c/go/+/639776
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@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>

6 months agocrypto/internal/fips140test: add ctr DRBG ACVP tests
Daniel McCarney [Thu, 2 Jan 2025 20:09:39 +0000 (15:09 -0500)]
crypto/internal/fips140test: add ctr DRBG ACVP tests

Adds ACVP test coverage for the SP 800-90A rev 1 ctrDRBG algorithm based
on the NIST spec:
  https://pages.nist.gov/ACVP/draft-vassilev-acvp-drbg.html#section-7.2

The implementation in our FIPS module is a minimal implementation
tailored to the specific needs of stdlib crypto. As a result we
customize the ACVP capability registration so that:

* predResistanceEnabled is false
* only mode AES-256 is supported
* for that mode,
  * derFuncEnabled is false
  * persoStringLen is 0 to disable personalization
  * additionalInputLen is 384 to match the [48]byte argument in our API

Other capability values are chosen based on Table 4's ctrDRBG AES-256
w/o `derFuncEnabled` row:
  https://pages.nist.gov/ACVP/draft-vassilev-acvp-drbg.html#section-7.4

We do enable reseed in the capability, necessitating two acvptool
commands: one that expects only 6 args and doesn't reseed
("ctrDRBG/AES-256"), and one that expects 8 args and does
("ctrDRBG-reseed/AES-256").

Updates #69642

Change-Id: I0f01a2f9496f45b130ee7d10916708093236f473
Reviewed-on: https://go-review.googlesource.com/c/go/+/639795
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agointernal/trace: emit a Sync event even if the next generation is broken
Michael Anthony Knyszek [Mon, 10 Feb 2025 20:10:22 +0000 (20:10 +0000)]
internal/trace: emit a Sync event even if the next generation is broken

Since CL 644215 each Sync event now represents the coming generation,
with a final Sync event emitted even when there's nothing ahead. This
change however failed to emit a Sync event at the end of a completely
valid generation when the next generation was invalid, causing the
runtime test TestCrashWhileTracing to start failing.

Fix this by emitting a final Sync event even when the next generation is
broken. We hold onto the error in parsing the next generation and emit
it after that final Sync event.

(Should these "final" Sync events distinguish themselves in some way?)

Fixes #71615.

Change-Id: I1f8abee5abaa39e1219e6fa05e9f82f1478db4c9
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/648195
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
6 months agocrypto/internal/fips140test: add KAS-ECC-SSC ACVP tests
Daniel McCarney [Thu, 19 Dec 2024 19:02:05 +0000 (14:02 -0500)]
crypto/internal/fips140test: add KAS-ECC-SSC ACVP tests

Adds ACVP test coverage for the Sp800-56Ar3 KAS-ECC-SSC algorithm based
on the NIST spec:

  https://pages.nist.gov/ACVP/draft-hammett-acvp-kas-ssc-ecc.html

There's no acvp_test.config.json update for this algorithm as one test
type type requires random key generation and can't be separated from the
test type that doesn't, making it a bad fit for static data testing.

Updates #69642

Change-Id: I3b6538fad1c1e5c8b14b638ff3b933f11e98f75a
Reviewed-on: https://go-review.googlesource.com/c/go/+/637916
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agocrypto/internal/fips140test: add SSH KDF ACVP tests
Daniel McCarney [Sun, 15 Dec 2024 22:33:48 +0000 (17:33 -0500)]
crypto/internal/fips140test: add SSH KDF ACVP tests

Adds ACVP test coverage for the SP 800-135rev1 SSH KDF based on the NIST
spec:

  https://pages.nist.gov/ACVP/draft-celi-acvp-kdf-ssh.html

Only SHA1, SHA2-224, SHA2-256, SHA2-384, and SHA2-512 are valid hash
algorithms for the SSH KDF algorithm. We do not include SHA-1 since it
is out of scope for our FIPS module.

Similarly only TDES, AES-128, AES-192 and AES-256 are valid ciphers, and
we do not include TDES.

Updates #69642

Change-Id: I70e45b77a91bd8aa631da30fab54c97e974f433c
Reviewed-on: https://go-review.googlesource.com/c/go/+/636355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>

6 months agocmd/compile: avoid ifaceeq call if we know the interface is direct
Keith Randall [Mon, 9 Dec 2024 20:55:33 +0000 (12:55 -0800)]
cmd/compile: avoid ifaceeq call if we know the interface is direct

We can just use == if the interface is direct.

Fixes #70738

Change-Id: Ia9a644791a370fec969c04c42d28a9b58f16911f
Reviewed-on: https://go-review.googlesource.com/c/go/+/635435
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
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>

6 months agocmd/compile/internal/gc: handle errors from *bio.Writer
Mateusz Poliwczak [Sat, 8 Feb 2025 13:59:18 +0000 (13:59 +0000)]
cmd/compile/internal/gc: handle errors from *bio.Writer

The error is stored internally in *bio.Writer, more specifically
in *bufio.Writer and the current code does not handle it, ignoring
errors silently.

Change-Id: Iefa9bf7ddabb3c4fc03377e676a8098dcad9be6d
GitHub-Last-Rev: a5d36223312773039c37bb1c52fffc96fff04fba
GitHub-Pull-Request: golang/go#71621
Reviewed-on: https://go-review.googlesource.com/c/go/+/647915
Reviewed-by: 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>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Keith Randall <khr@golang.org>

6 months agocmd/go/internal/work: allow a bunch of loong64-specific flags
WANG Xuerui [Sun, 9 Feb 2025 10:57:49 +0000 (18:57 +0800)]
cmd/go/internal/work: allow a bunch of loong64-specific flags

Recognize and allow all LoongArch-specific CFLAGS as standardized
in the LoongArch Toolchain Conventions v1.1, and implemented in current
versions of GCC and Clang, to enable advanced cgo use cases on loong64.
These flags are also allowed for linker invocations in case of possible
LTO.

See: https://github.com/loongson/la-toolchain-conventions/blob/releases/v1.1/LoongArch-toolchain-conventions-EN.adoc#list

While at it, also add support for -mtls-dialect as some C programs
may benefit performance-wise from the optional TLSDESC usage. This flag
is not specific to loong64 though; it is available for amd64, arm,
arm64, loong64, riscv64 and x86.

Fixes #71597.

Change-Id: I35d2507edb71fa324ae429a3ae3c739644a9cac1
Reviewed-on: https://go-review.googlesource.com/c/go/+/647956
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
6 months agodatabase/sql: use t.Context in tests
apocelipes [Sat, 8 Feb 2025 01:15:29 +0000 (01:15 +0000)]
database/sql: use t.Context in tests

Replace "context.WithCancel(context.Background())" with "t.Context()".

Updates #36532

Change-Id: I78a8ba422f076f4c697910922cf6dc35c628b1a7
GitHub-Last-Rev: 2eacdbe9ea97ac8d928704c2b605b276626d95dd
GitHub-Pull-Request: golang/go#71599
Reviewed-on: https://go-review.googlesource.com/c/go/+/647555
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
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>
6 months agonet/http: use standard time formatting methods
Tom Thorogood [Sun, 9 Feb 2025 02:12:25 +0000 (12:42 +1030)]
net/http: use standard time formatting methods

time.Time has had an AppendFormat method since go1.5 so there's no
need to carry around a custom implementation.

Change-Id: I8e7e5a9ac34e8bf251f5d70555405777ce4e22a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/647955
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

6 months agointernal/trace: merge event and tracev2 packages
Michael Anthony Knyszek [Wed, 29 Jan 2025 17:16:02 +0000 (17:16 +0000)]
internal/trace: merge event and tracev2 packages

These two packages were historically separate in an attempt to provide a
unified description of trace v1 and trace v2 formats. In practice this
turned out to be pointless, since it made more sense to keep the trace
v1 parser in a self-contained bubble with a converter to v2. Future
trace wire format migrations should probably just follow the same
general strategy, if there's a substantial change. (Minor changes can be
handled more organically.)

Change-Id: Ic765df62065fe53cfae59b505297527c3fa42dfb
Reviewed-on: https://go-review.googlesource.com/c/go/+/645395
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>
6 months agointernal/trace/internal/testgen: force trace version selection
Michael Anthony Knyszek [Fri, 24 Jan 2025 21:04:01 +0000 (21:04 +0000)]
internal/trace/internal/testgen: force trace version selection

Currently testgen only generates Go 1.22 tests. Allow generating tests
for different versions, especially now that we've tightened up which
events can be emitted by different versions.

Change-Id: Ia64309c6934f34eace03b3229d05fca5acfc7366
Reviewed-on: https://go-review.googlesource.com/c/go/+/644220
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>

6 months agointernal/trace: be stricter about allowed events in v2 trace versions
Michael Anthony Knyszek [Fri, 24 Jan 2025 20:56:47 +0000 (20:56 +0000)]
internal/trace: be stricter about allowed events in v2 trace versions

Currently all v2 trace versions, Go 1.22 and Go 1.23, share a full set
of specs. This is mostly OK, but it means quite a few events will be
accepted for 1.22 traces that should be rejected. This change fixes that
by limiting which event specs are returned by version.Version.Specs for
Go 1.22.

While we're here, let's be stricter about event names too, and move
tracev2.EventString to be a method on the version, so we can be more
precise. An intended consequence of this move is that tracev2 no longer
depends on fmt, since we will want the runtime to depend on tracev2 in
the near future.

Change-Id: If7285460c8ba59ab73da00993b7b12e61cdfe6a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/644219
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>
6 months agointernal/trace: rename go122 to tracev2
Michael Anthony Knyszek [Fri, 24 Jan 2025 20:36:51 +0000 (20:36 +0000)]
internal/trace: rename go122 to tracev2

This change follows up from the previous one which renamed oldtrace to
tracev1, defining everything Go 1.22+ as trace v2.

This change also re-maps some packages in preparation for sharing with
other parts of the standard library, like the runtime. It also cleans up
some other uses of 'go122' that are just a bit misleading. The mappings
are as follows:

- internal/trace/event -> internal/trace/tracev2/event
- internal/trace/event/go122 -> internal/trace/tracev2
- internal/trace/internal/testgen/go122 ->
  internal/trace/internal/testgen

The CL updates all import paths and runs gofmt -w -s on the entire
subdirectory.

Change-Id: I35476c679a96d4eafad6b94bac5f88aa7b085d2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/644218
Auto-Submit: 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>

6 months agoruntime: establish happens-before between goroutine and bubble exit
Damien Neil [Fri, 7 Feb 2025 17:55:15 +0000 (09:55 -0800)]
runtime: establish happens-before between goroutine and bubble exit

synctest.Run waits for all bubbled goroutines to exit before returning.
Establish a happens-before relationship between the bubbled goroutines
exiting and Run returning.

For #67434

Change-Id: Ibda7ec2075ae50838c0851e60dc5b3c6f3ca70fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/647755
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>
6 months agoos: hide SetFinalizer from users of Root
Michael Anthony Knyszek [Fri, 7 Feb 2025 23:22:50 +0000 (23:22 +0000)]
os: hide SetFinalizer from users of Root

Currently Root embeds a root and calls SetFinalizer on &r.root. This
sets the finalizer on the outer root, which is visible to users of
os.Root, and thus they can mutate the finalizer attached to it.

This change modifies Root to not embed its inner root, but rather to
refer to it by pointer. This allows us to set the finalizer on this
independent inner object, preventing users of os.Root from changing the
finalizer. This follows the same pattern as os.File's finalizer.

Fixes #71617.

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

6 months agocrypto/internal/fips140test: add TLS-v1.3 ACVP tests
Daniel McCarney [Sat, 14 Dec 2024 19:36:21 +0000 (14:36 -0500)]
crypto/internal/fips140test: add TLS-v1.3 ACVP tests

Adds ACVP test coverage for the SP 800-56Crev2 IG 2.4.B TLS v1.3 KDF
based on the NIST spec:

  https://pages.nist.gov/ACVP/draft-hammett-acvp-kdf-tls-v1.3.html

Only SHA2-256 and SHA2-384 are valid hash algorithms for the TLS1.3 KDF
algorithm.

The BoringSSL acvptool "lowers" the more complicated TLS 1.3 KDF ACVP
test cases into simple invocations of our module wrapper's pre-existing
HKDF commands, and the new "HKDFExtract/$HASH" and
"HKDFExpandLabel/$HASH" commands added in this branch.

Updates #69642

Change-Id: I5fb1af5b5b33c1845b27cf8968e6523e89bcc589
Reviewed-on: https://go-review.googlesource.com/c/go/+/636117
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
6 months agocrypto/internal/fips140test: add TLS-v1.2 ACVP tests
Daniel McCarney [Sat, 14 Dec 2024 17:53:29 +0000 (12:53 -0500)]
crypto/internal/fips140test: add TLS-v1.2 ACVP tests

Adds ACVP test coverage for the SP 800-135rev1 RFC 7627 TLS v1.2 KDF
based on the NIST spec:

  https://pages.nist.gov/ACVP/draft-celi-acvp-kdf-tls.html

Only SHA2-256, SHA2-384 and SHA2-512 are valid hash algorithms for the
TLSKDF algorithm.

Updates #69642

Change-Id: I553d4f6a1d6652ed486af0e2c94730c8063fb47f
Reviewed-on: https://go-review.googlesource.com/c/go/+/636116
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: David Chase <drchase@google.com>
6 months agocrypto/internal/fips140test: add KDA HKDF ACVP tests
Daniel McCarney [Fri, 13 Dec 2024 21:21:45 +0000 (16:21 -0500)]
crypto/internal/fips140test: add KDA HKDF ACVP tests

Adds ACVP test coverage for the SP 800-56Crev2 HKDF KDA based on the
NIST spec:

 https://pages.nist.gov/ACVP/draft-hammett-acvp-kas-kdf-hkdf.html

Updates #69642

Change-Id: Ie4f48f9b0181eaf6c2201a9796d366a31c474eba
Reviewed-on: https://go-review.googlesource.com/c/go/+/636115
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>