1
0
mirror of https://github.com/golang/go synced 2024-11-22 03:44:39 -07:00
Commit Graph

61401 Commits

Author SHA1 Message Date
Daniel McCarney
e738f06a12 crypto/internal/fips: add SHA2,SHA3,HMAC ACVP tests
Adds a new crypto/internal/fips test binary that operates as both a unit
test fetching/driving the BoringSSL acvptool, and an acvptool module
wraper when invoked by the unit test. Initial support for testing the
SHA2 and SHA3 family of digests, and the HMAC family of MACs is
included.

Test vectors and expected answers are maintained in a separate repo,
`github.com/cpu/go-acvp` and fetched through the module proxy as part of
the test process.

The BSSL acvptool "lowers" the NIST ACVP server JSON test vectors into
a simpler stdin/stdout protocol that can be implemented by a module
wrapper. The tool will fork our acvpwrapper binary, request the
supported configuration, and then provide test cases over stdin,
expecting results to be returned on stdout.

See "Testing other FIPS modules" from the BoringSSL ACVP.md
documentation for a more detailed description of the protocol used
between the acvptool and module wrappers.

Updates #69642
Updates #69536

Change-Id: I6b568c67f2a71144fbf31db467c6fd25710457f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/615816
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-10-28 15:01:02 +00:00
Filippo Valsorda
f0b51a2099 crypto/internal/fips: add service indicator mechanism
Placed the fipsIndicator field in some 64-bit alignment padding in the g
struct to avoid growing per-goroutine memory requirements on 64-bit
targets.

Fixes #69911
Updates #69536

Change-Id: I176419d0e3814574758cb88a47340a944f405604
Reviewed-on: https://go-review.googlesource.com/c/go/+/620795
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Derek Parker <parkerderek86@gmail.com>
2024-10-28 14:55:26 +00:00
Filippo Valsorda
ba1caa8b30 crypto/internal/fips/sha3: test alternative s390x implementation
The amd64 assembly is always-on, so we don't need to test disabling it.

Fixes #36466
For #69536

Change-Id: I2cd4befcde688a1ba202e61c7119e15454ff6854
Reviewed-on: https://go-review.googlesource.com/c/go/+/617535
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
2024-10-28 14:55:24 +00:00
Filippo Valsorda
d75fb40e52 crypto/internal/fips/sha3: reduce s390x divergence
It's a little annoying, but we can fit the IBM instructions on top of
the regular state, avoiding more intrusive interventions.

Going forward we should not accept assembly that replaces the whole
implementation, because it doubles the work to do any refactoring like
the one in this chain.

Also, it took me a while to find the specification of these
instructions, which should have been linked from the source for the next
person who'd have to touch this.

Finally, it's really painful to test this without a LUCI TryBot, per #67307.

For #69536

Change-Id: I90632a90f06b2aa2e863967de972b12dbaa5b2ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/617359
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2024-10-28 14:55:21 +00:00
Filippo Valsorda
312e7e9f8a crypto/internal/fips/sha3: restructure as an internal package
Main changes are

    - return concrete *Digest and *SHAKE instead of interfaces

    - make tests external (sha3_test) so they will be easy to move to
      the public package

    - drop most of the developer guidance docs (to be updated and
      reintroduced in the public package)

    - consolidate the _noasm.go files (matching the single _s390x.go)

    - move TestAllocations from build tags to testenv

    - temporarily disable s390x code, to refactor in a following CL

For #69536

Change-Id: Ie5fd3e2b589b9eb835b9e3174b7a79c2ac728ab1
Reviewed-on: https://go-review.googlesource.com/c/go/+/617357
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
2024-10-28 14:52:21 +00:00
Filippo Valsorda
7557a24927 crypto/internal/fips/sha3: import x/crypto/sha3@750a45fe5e4
For now just internally, pending a dedicated proposal for the exposed
package API.

In this CL the code is copied verbatim, for ease of review. Only the
imports were replaced with the corresponding internal ones, and
crypto.RegisterHash calls were disabled. Also, the 0.5MB keccakkats file
was dropped, supplanted by TestCSHAKEAccumulated and ACVP tests.

Updates #65269
Updates #69982
For #69536

Change-Id: Ia4735b50c99b9573a5c4889733c4a119930fe658
Reviewed-on: https://go-review.googlesource.com/c/go/+/616717
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: Carlos Amedee <carlos@golang.org>
2024-10-28 14:49:43 +00:00
Filippo Valsorda
0138c1abef Revert "crypto/rand: add randcrash=0 GODEBUG"
A GODEBUG is actually a security risk here: most programs will start to
ignore errors from Read because they can't happen (which is the intended
behavior), but then if a program is run with GODEBUG=randcrash=0 it will
use a partial buffer in case an error occurs, which may be catastrophic.

Note that the proposal was accepted without the GODEBUG, which was only
added later.

This (partially) reverts CL 608435. I kept the tests.

Updates #66821

Change-Id: I3fd20f9cae0d34115133fe935f0cfc7a741a2662
Reviewed-on: https://go-review.googlesource.com/c/go/+/622115
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
2024-10-28 14:46:33 +00:00
changwang ma
7a256adbaf os: add File.Close for TestFileStatNUL
Change-Id: I9f8b0beed16f38d71055cdc7606306d93fb535c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/622655
Reviewed-by: Cherry Mui <cherryyz@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>
2024-10-28 13:39:27 +00:00
changwang ma
c77ca70f44 cmd/link, go/internal/gccgoimporter: get ar from env by default in tests
Change-Id: Ib64b1f641fcf795a51aaf31639d37927dab519e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/622237
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: Cherry Mui <cherryyz@google.com>
2024-10-28 13:39:24 +00:00
Mauri de Souza Meneguzzo
c5d424bfca internal/runtime/atomic: add arm native implementations of And8/Or8
With LDREXB/STREXB now available for the arm assembler we can implement these operations natively. The instructions are armv6k+ but for simplicity I only use them on armv7.

Benchmark results for a raspberry Pi 3 model B+:

	goos: linux
	goarch: arm
	pkg: internal/runtime/atomic
	cpu: ARMv7 Processor rev 4 (v7l)
			 │   old.txt    │               new.txt               │
			 │    sec/op    │   sec/op     vs base                │
	And8-4             127.65n ± 0%   68.74n ± 0%  -46.15% (p=0.000 n=10)

Change-Id: Ic87f307c35f7d7f56010980302f253056f6d54dc
GitHub-Last-Rev: a7351802fd
GitHub-Pull-Request: golang/go#70002
Cq-Include-Trybots: luci.golang.try:gotip-linux-arm
Reviewed-on: https://go-review.googlesource.com/c/go/+/622075
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-28 13:37:30 +00:00
Cherry Mui
bbdc65bb38 test: add a test for wasm memory usage
Test that a small Wasm program uses 8 MB of linear memory. This
reflects the current allocator. We test an exact value, but if the
allocator changes, we can update or relax this.

Updates #69018.

Change-Id: Ifc0bb420af008bd30cde4745b3efde3ce091b683
Reviewed-on: https://go-review.googlesource.com/c/go/+/622378
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-28 13:27:58 +00:00
David Chase
889abb17e1 cmd/compile: use a non-fragile test for "does f contain closure c?"
The old test relied on naming conventions.  The new test
uses an explicit parent pointer chain initialized when the
closures are created (in the same place that the names
used in the older fragile test were assigned).

Fixes #70035.

Change-Id: Ie834103c7096e4505faaff3bed1fc6e918a21211
Reviewed-on: https://go-review.googlesource.com/c/go/+/622656
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-26 02:44:00 +00:00
Ian Lance Taylor
6dc99aa7eb cmd/link: for asan align coverage counter section to 8 bytes
Fixes #66966

Change-Id: I92777a7d7d8afaa82ffcd605aa3e607289b645f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/622477
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-25 22:15:10 +00:00
Ruslan Semagin
46b576be72 net/http/pprof: replace sort.Slice with slices.SortFunc
Change-Id: Ie416ed0d7abcb64e63d999b8cee5975a0fc13875
Reviewed-on: https://go-review.googlesource.com/c/go/+/622496
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-10-25 21:42:41 +00:00
Michael Anthony Knyszek
4bf98186b5 runtime: fix mallocgc for asan
This change finally fully fixes mallocgc for asan after the recent
refactoring. Here is everything that changed:

Fix the accounting for the alloc header; large objects don't have them.

Mask out extra bits set from unrolling the bitmap for slice backing
stores in writeHeapBitsSmall. The redzone in asan mode makes it so that
dataSize is no longer an exact multiple of typ.Size_ in this case (a
new assumption I have recently discovered) but we didn't mask out any
extra bits, so we'd accidentally set bits in other allocations. Oops.

Move the initHeapBits optimization for the 8-byte scan sizeclass on
64-bit platforms up to mallocgc, out from writeHeapBitsSmall. So, this
actually caused a problem with asan when the optimization first landed,
but we missed it. The issue was then masked once we started passing the
redzone down into writeHeapBitsSmall, since the optimization would no
longer erroneously fire on asan. What happened was that dataSize would
be 8 (because that was the user-provided alloc size) so we'd skip
writing heap bits, but it would turn out the redzone bumped the size
class, so we'd actually *have* to write the heap bits for that size
class. This is not really a problem now *but* it caused problems for me
when debugging, since I would try to remove the red zone from dataSize
and this would trigger this bug again. Ultimately, this whole situation
is confusing because the check in writeHeapBitsSmall is *not* the same
as the check in initHeapBits. By moving this check up to mallocgc, we
can make the checks align better by matching on the sizeclass, so this
should be less error-prone in the future.

Change-Id: I1e9819223be23f722f3bf21e63e812f5fb557194
Reviewed-on: https://go-review.googlesource.com/c/go/+/622041
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>
2024-10-25 20:35:44 +00:00
Andy Pan
3320ce94b6 internal/poll: handle the special case of sendfile(2) sending the full chunk
CL 622235 would fix #70000 while resulting in one extra sendfile(2) system
call when sendfile(2) returns (>0, EAGAIN).
That's also why I left sendfile_bsd.go behind, and didn't make it line up
with other two implementations: sendfile_linux.go and sendfile_solaris.go.

Unlike sendfile(2)'s on Linux and Solaris that always return (0, EAGAIN),
sendfile(2)'s on *BSD and macOS may return (>0, EAGAIN) when using a socket
marked for non-blocking I/O. In that case, the current code will try to re-call
sendfile(2) immediately, which will most likely get us a (0, EAGAIN).
After that, it goes to `dstFD.pd.waitWrite(dstFD.isFile)` below,
which should have been done in the first place.

Thus, the real problem that leads to #70000 is that the old code doesn't handle
the special case of sendfile(2) sending the exact number of bytes the caller requested.

Fixes #70000

Change-Id: I6073d6b9feb58b3d7e114ec21e4e80d9727bca66
Reviewed-on: https://go-review.googlesource.com/c/go/+/622255
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
2024-10-25 19:05:35 +00:00
Cherry Mui
22664f33b7 runtime: reserve fewer memory for aligned reservation on sbrk systems
Sometimes the runtime needs to reserve some memory with a large
alignment, which the OS usually won't directly satisfy. So, it
asks size+align bytes instead, and frees the unaligned portions.
On sbrk systems, this doesn't work that well, as freeing the tail
portion doesn't really free the memory to the OS. Instead, we
could simply round the current break up, then reserve the given
size, without wasting the tail portion.

Also, don't create heap arena hints on sbrk systems. We can only
grow the break sequentially, and reserving specific addresses
would not succeed anyway.

For #69018.

Change-Id: Iadc2c54d62b00ad7befa5bbf71146523483a8c47
Reviewed-on: https://go-review.googlesource.com/c/go/+/621715
Reviewed-by: 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>
2024-10-25 17:13:47 +00:00
qmuntal
0addb2a4ea runtime: document that Caller and Frame.File always use forward slashes
Document that Caller and Frame.File always use forward slashes
as path separators, even on Windows.

Fixes #3335

Change-Id: Ic5bbf8a1f14af64277dca4783176cd8f70726b91
Reviewed-on: https://go-review.googlesource.com/c/go/+/603275
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-10-25 16:18:18 +00:00
Youlin Feng
bb07aa644b cmd/compile: add shift optimization test
For #69635

Change-Id: Id5696dc9724c3b3afcd7b60a6994f98c5309eb0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/621755
Reviewed-by: Keith Randall <khr@golang.org>
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>
Auto-Submit: Michael Pratt <mpratt@google.com>
2024-10-25 15:35:29 +00:00
Oleksandr Redko
dd4fee7ec6 net/http/pprof: fix typo in the symbol profile description
Change-Id: I55e1c559bc73537c8cd42c213c56e2ddaf33aa44
Reviewed-on: https://go-review.googlesource.com/c/go/+/622097
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>
2024-10-25 15:32:34 +00:00
Lin Runze
b45c7f1661 cmd/internal/obj: add prologue_end DWARF stmt for riscv64
This patch adds prologue_end statement to the DWARF info for riscv64,
which delve debugger uses for skip stacksplit prologue.

Change-Id: I4e5d9c26202385f65b3118b16f53f66de9d327f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/620295
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-10-25 13:46:59 +00:00
Joel Sing
e5e552b816 cmd/internal/obj/riscv: update references to RISC-V specification
Update references to version 20240411 of the RISC-V specifications.
Reorder and regroup instructions to maintain ordering.

Change-Id: Iea2a5d22ad677e04948e9a9325986ad301c03f35
Reviewed-on: https://go-review.googlesource.com/c/go/+/616115
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
2024-10-25 12:05:29 +00:00
Ian Lance Taylor
2ef8e41f95 net/smtp: ignore HELO error in QUIT
Fixes #70011

Change-Id: I9d8b3ffbd66561eee0efffd54038960acd5fcf64
Reviewed-on: https://go-review.googlesource.com/c/go/+/622476
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-10-25 04:52:06 +00:00
Damien Neil
4226fc597b doc: document new http.Transport limit on 1xx responses
Fixes #65035

Change-Id: I3b0586b5e2a0729e6b252d2bcd4139c99bc80733
Reviewed-on: https://go-review.googlesource.com/c/go/+/622335
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2024-10-25 03:22:33 +00:00
Youlin Feng
711552e98a cmd/compile: optimize type switch for a single runtime known type with a case var
Change-Id: I03ba70076d6dd3c0b9624d14699b7dd91a3c0e9b
Reviewed-on: https://go-review.googlesource.com/c/go/+/618476
Reviewed-by: Keith Randall <khr@golang.org>
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: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-10-25 02:56:11 +00:00
Cherry Mui
15c5580160 cmd/link: don't pass --build-id if C linker doesn't support it
On Solaris the default (non-GNU) C linker doesn't support the
--build-id flag (and I'm not aware of any alternative). So check
that the linker supports the flag before passing it.

Updates #41004, #63934.

Cq-Include-Trybots: luci.golang.try:gotip-solaris-amd64
Change-Id: I4379e5bf6eb495154d663ac4ed802ecb11fcf91c
Reviewed-on: https://go-review.googlesource.com/c/go/+/621639
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-24 19:25:58 +00:00
David Chase
c2b580a474 cmd/compile: spell "go.runtime" correctly for inline "cheap" test
Updates #69539.

Change-Id: I40885e9c23f35772f8ace645044afee0d55b70b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/622415
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2024-10-24 19:18:55 +00:00
Paul E. Murphy
1846dd5a31 cmd/compile/internal/ssa: fix PPC64 shift codegen regression
CL 621357 introduced new generic lowering rules which caused
several shift related codegen test failures.

Add new rules to fix the test regressions, and cleanup tests
which are changed but not regressed. Some CLRLSLDI tests are
removed as they are no test CLRLSLDI rules.

Fixes #70003

Change-Id: I1ecc5a7e63ab709a4a0cebf11fa078d5cf164034
Reviewed-on: https://go-review.googlesource.com/c/go/+/622236
Reviewed-by: Keith Randall <khr@golang.org>
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>
2024-10-24 17:32:18 +00:00
Michael Anthony Knyszek
2a98a1849f runtime: uphold goroutine profile invariants in coroswitch
Goroutine profiles require checking in with the profiler before any
goroutine starts running. coroswitch is a place where a goroutine may
start running, but where we do not check in with the profiler, which
leads to crashes. Fix this by checking in with the profiler the same way
execute does.

Fixes #69998.

Change-Id: Idef6dd31b70a73dd1c967b56c307c7a46a26ba73
Reviewed-on: https://go-review.googlesource.com/c/go/+/622016
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-24 17:09:10 +00:00
Michael Anthony Knyszek
fb2a7f8ce1 runtime: fix ASAN poison calculation in mallocgc
A previous CL broke the ASAN poisoning calculation in mallocgc by not
taking into account a possible allocation header, so the beginning of
the following allocation could have been poisoned.

This mostly isn't a problem, actually, since the following slot would
usually just have an allocation header in it that programs shouldn't be
touching anyway, but if we're going a word-past-the-end at the end of a
span, we could be poisoning a valid heap allocation.

Change-Id: I76a4f59bcef01af513a1640c4c212c0eb6be85b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/622295
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2024-10-24 16:55:08 +00:00
Filippo Valsorda
06cb3fbe62 crypto/internal/cryptotest: skip hardware support check on non-Linux builders
Non-Linux builder hardware is more varied, and the important thing is
that we test on at least one builder.

Fixes #70014
Fixes #70013
Fixes #70012

Change-Id: I33c4483c8b2792f6a15d6532e8cbae98b2888ea5
Reviewed-on: https://go-review.googlesource.com/c/go/+/622096
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: David Chase <drchase@google.com>
2024-10-24 16:48:11 +00:00
Damien Neil
bf2aa6c233 net/http: limit 1xx based on size, do not limit when delivered
Replace Transport's limit of 5 1xx responses with a limit based
on MaxResponseHeaderBytes: The total number of responses
(including 1xx reponses and the final response) must not exceed
this value.

When the user is reading 1xx responses using a Got1xxResponse
client trace hook, disable the limit: Each 1xx response is
individually limited by MaxResponseHeaderBytes, but there
is no limit on the total number of responses. The user is
responsible for imposing a limit if they want one.

For #65035

Change-Id: If4bbbbb0b808cb5016701d50963c89f0ce1229f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/615255
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-24 16:10:37 +00:00
Ian Lance Taylor
76f3208367 runtime: support cgo index into pointer-to-array
We were missing a case for calling a C function with an index
into a pointer-to-array.

Fixes #70016

Change-Id: I9c74d629e58722813c1aaa0f0dc225a5a64d111b
Reviewed-on: https://go-review.googlesource.com/c/go/+/621576
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2024-10-24 14:34:01 +00:00
Joel Sing
4646556ba4 cmd/internal/obj,cmd/asm: add vector registers to riscv64 assembler
This adds V0 through V31 as vector registers, which are available on CPUs
that support the V extension.

Change-Id: Ibffee3f9a2cf1d062638715b3744431d72d451ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/595404
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: 鹏程汪 <wangpengcheng.pp@bytedance.com>
2024-10-24 12:32:56 +00:00
Joel Sing
77c53c16e9 cmd/internal/obj/riscv: add vector instruction encodings
Regenerate the riscv instruction encoding table with the V extension
enabled. Add constants and names for the resulting 375 instructions.

Change-Id: Icce688493aeb1e9880fb76a0618643f57e481273
Reviewed-on: https://go-review.googlesource.com/c/go/+/595403
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: 鹏程汪 <wangpengcheng.pp@bytedance.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-10-24 12:32:14 +00:00
Xiaolin Zhao
252fbaf30f cmd/compile: fold MOV*nop and MOV*const on loong64
Change-Id: I4bb1082518fc08fc0a1cb66970746d5b4f13c934
Reviewed-on: https://go-review.googlesource.com/c/go/+/621356
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-10-24 09:47:44 +00:00
Filippo Valsorda
651e839df8 crypto/sha256,crypto/sha512: skip TestAllocations without optimizations
Fixes #70004
Fixes #70005

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-noopt
Change-Id: I6766a722f124646262fa0d2a1ff245f8b93bc920
Reviewed-on: https://go-review.googlesource.com/c/go/+/622095
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-10-24 08:58:59 +00:00
Xiaolin Zhao
91d07ac71c cmd/compile: inline constant sized memclrNoHeapPointers calls on loong64
Tested that on loong64, the optimization effect is negative for
constant size cases greater than 512.
So only enable inlining for constant size cases less than 512.

goos: linux
goarch: loong64
pkg: runtime
cpu: Loongson-3A6000 @ 2500.00MHz
                      |  bench.old   |              bench.new               |
                      |    sec/op    |    sec/op     vs base                |
MemclrKnownSize1        2.4070n ± 0%   0.4004n ± 0%  -83.37% (p=0.000 n=20)
MemclrKnownSize2        2.1365n ± 0%   0.4004n ± 0%  -81.26% (p=0.000 n=20)
MemclrKnownSize4        2.4445n ± 0%   0.4004n ± 0%  -83.62% (p=0.000 n=20)
MemclrKnownSize8        2.4200n ± 0%   0.4004n ± 0%  -83.45% (p=0.000 n=20)
MemclrKnownSize16       2.8030n ± 0%   0.8007n ± 0%  -71.43% (p=0.000 n=20)
MemclrKnownSize32        2.803n ± 0%    1.602n ± 0%  -42.85% (p=0.000 n=20)
MemclrKnownSize64        3.250n ± 0%    2.402n ± 0%  -26.08% (p=0.000 n=20)
MemclrKnownSize112       6.006n ± 0%    2.819n ± 0%  -53.06% (p=0.000 n=20)
MemclrKnownSize128       6.006n ± 0%    3.240n ± 0%  -46.05% (p=0.000 n=20)
MemclrKnownSize192       6.807n ± 0%    5.205n ± 0%  -23.53% (p=0.000 n=20)
MemclrKnownSize248       7.608n ± 0%    6.301n ± 0%  -17.19% (p=0.000 n=20)
MemclrKnownSize256       7.608n ± 0%    6.707n ± 0%  -11.84% (p=0.000 n=20)
MemclrKnownSize512       13.61n ± 0%    13.61n ± 0%        ~ (p=0.374 n=20)
MemclrKnownSize1024      26.43n ± 0%    26.43n ± 0%        ~ (p=0.826 n=20)
MemclrKnownSize4096      103.3n ± 0%    103.3n ± 0%        ~ (p=1.000 n=20)
MemclrKnownSize512KiB    26.29µ ± 0%    26.29µ ± 0%   -0.00% (p=0.012 n=20)
geomean                  10.05n         5.006n       -50.18%

                      |  bench.old   |               bench.new                |
                      |     B/s      |      B/s       vs base                 |
MemclrKnownSize1        396.2Mi ± 0%   2381.9Mi ± 0%  +501.21% (p=0.000 n=20)
MemclrKnownSize2        892.8Mi ± 0%   4764.0Mi ± 0%  +433.59% (p=0.000 n=20)
MemclrKnownSize4        1.524Gi ± 0%    9.305Gi ± 0%  +510.56% (p=0.000 n=20)
MemclrKnownSize8        3.079Gi ± 0%   18.609Gi ± 0%  +504.42% (p=0.000 n=20)
MemclrKnownSize16       5.316Gi ± 0%   18.609Gi ± 0%  +250.05% (p=0.000 n=20)
MemclrKnownSize32       10.63Gi ± 0%    18.61Gi ± 0%   +75.00% (p=0.000 n=20)
MemclrKnownSize64       18.34Gi ± 0%    24.81Gi ± 0%   +35.27% (p=0.000 n=20)
MemclrKnownSize112      17.37Gi ± 0%    37.01Gi ± 0%  +113.08% (p=0.000 n=20)
MemclrKnownSize128      19.85Gi ± 0%    36.80Gi ± 0%   +85.39% (p=0.000 n=20)
MemclrKnownSize192      26.27Gi ± 0%    34.35Gi ± 0%   +30.77% (p=0.000 n=20)
MemclrKnownSize248      30.36Gi ± 0%    36.66Gi ± 0%   +20.75% (p=0.000 n=20)
MemclrKnownSize256      31.34Gi ± 0%    35.55Gi ± 0%   +13.43% (p=0.000 n=20)
MemclrKnownSize512      35.02Gi ± 0%    35.03Gi ± 0%    +0.00% (p=0.030 n=20)
MemclrKnownSize1024     36.09Gi ± 0%    36.09Gi ± 0%         ~ (p=0.101 n=20)
MemclrKnownSize4096     36.93Gi ± 0%    36.93Gi ± 0%    +0.00% (p=0.003 n=20)
MemclrKnownSize512KiB   18.57Gi ± 0%    18.57Gi ± 0%    +0.00% (p=0.041 n=20)
geomean                 10.13Gi         20.33Gi       +100.72%

Change-Id: I460a56f7ccc9f820ca2c1934c1c517b9614809ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/621355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-10-24 08:55:31 +00:00
limeidan
0f58a7be8a cmd/compile/internal: optimize condition branch implementation
os: linux
goarch: loong64
pkg: test/bench/go1
cpu: Loongson-3A6000 @ 2500.00MHz
                      │     old      │                new                 │
                      │    sec/op    │   sec/op     vs base               │
BinaryTree17              7.521 ± 1%    7.551 ± 2%       ~ (p=0.190 n=10)
Fannkuch11                2.736 ± 0%    2.667 ± 0%  -2.51% (p=0.000 n=10)
FmtFprintfEmpty          34.42n ± 0%   35.22n ± 0%  +2.32% (p=0.000 n=10)
FmtFprintfString         61.24n ± 0%   56.84n ± 0%  -7.18% (p=0.000 n=10)
FmtFprintfInt            68.04n ± 0%   65.65n ± 0%  -3.51% (p=0.000 n=10)
FmtFprintfIntInt         111.9n ± 0%   106.0n ± 0%  -5.32% (p=0.000 n=10)
FmtFprintfPrefixedInt    131.4n ± 0%   122.5n ± 0%  -6.77% (p=0.000 n=10)
FmtFprintfFloat          241.1n ± 0%   235.1n ± 0%  -2.51% (p=0.000 n=10)
FmtManyArgs              553.7n ± 0%   518.9n ± 0%  -6.28% (p=0.000 n=10)
GobDecode                7.223m ± 1%   7.291m ± 1%  +0.94% (p=0.004 n=10)
GobEncode                6.741m ± 1%   6.622m ± 2%  -1.77% (p=0.011 n=10)
Gzip                     288.9m ± 0%   280.3m ± 0%  -3.00% (p=0.000 n=10)
Gunzip                   34.07m ± 0%   33.33m ± 0%  -2.18% (p=0.000 n=10)
HTTPClientServer         60.15µ ± 0%   60.63µ ± 0%  +0.80% (p=0.000 n=10)
JSONEncode              10.052m ± 1%   9.840m ± 0%  -2.12% (p=0.000 n=10)
JSONDecode               50.96m ± 0%   51.32m ± 0%  +0.70% (p=0.002 n=10)
Mandelbrot200            4.525m ± 0%   4.602m ± 0%  +1.69% (p=0.000 n=10)
GoParse                  5.018m ± 0%   4.996m ± 0%  -0.44% (p=0.000 n=10)
RegexpMatchEasy0_32      58.74n ± 0%   59.95n ± 0%  +2.06% (p=0.000 n=10)
RegexpMatchEasy0_1K      464.9n ± 0%   466.1n ± 0%  +0.26% (p=0.000 n=10)
RegexpMatchEasy1_32      64.88n ± 0%   59.64n ± 0%  -8.08% (p=0.000 n=10)
RegexpMatchEasy1_1K      557.2n ± 0%   564.4n ± 0%  +1.29% (p=0.000 n=10)
RegexpMatchMedium_32     879.3n ± 0%   912.8n ± 1%  +3.81% (p=0.000 n=10)
RegexpMatchMedium_1K     28.08µ ± 0%   28.70µ ± 0%  +2.20% (p=0.000 n=10)
RegexpMatchHard_32       1.456µ ± 0%   1.414µ ± 0%  -2.88% (p=0.000 n=10)
RegexpMatchHard_1K       43.81µ ± 0%   42.23µ ± 0%  -3.61% (p=0.000 n=10)
Revcomp                  472.4m ± 0%   474.5m ± 1%  +0.45% (p=0.000 n=10)
Template                 83.45m ± 0%   83.39m ± 0%       ~ (p=0.481 n=10)
TimeParse                291.3n ± 0%   283.8n ± 0%  -2.57% (p=0.000 n=10)
TimeFormat               322.8n ± 0%   313.1n ± 0%  -3.02% (p=0.000 n=10)
geomean                  54.32µ        53.45µ       -1.61%

Change-Id: If68fdd952ec6137c77e25ce8932358cac28da324
Reviewed-on: https://go-review.googlesource.com/c/go/+/620977
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
2024-10-24 08:23:34 +00:00
Robert Griesemer
bfc8c5b85a go/types, types2: simplify cycle reporting code (minor cleanup)
Change-Id: I49c7107d9624c9a8aa97dcc87e2d4722b9ba0a20
Reviewed-on: https://go-review.googlesource.com/c/go/+/622055
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-10-24 01:29:42 +00:00
Damien Neil
bd388c0216 internal/poll: keep copying after successful Sendfile return on BSD
The BSD implementation of poll.SendFile incorrectly halted
copying after succesfully writing one full chunk of data.
Adjust the copy loop to match the Linux and Solaris
implementations.

In testing, empirically macOS appears to sometimes return
EAGAIN from sendfile after successfully copying a full
chunk. Add a check to all implementations to return nil
after successfully copying all data if the last sendfile
call returns EAGAIN.

For #70000

Change-Id: I57ba649491fc078c7330310b23e1cfd85135c8ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/622235
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-10-24 01:18:06 +00:00
Sean Liao
28b09d5846 net/http/pprof: include Symbol in Index
Fixes #69897

Change-Id: I5887f34504b39018e16f269e087b43bc6a80964b
Reviewed-on: https://go-review.googlesource.com/c/go/+/620455
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>
2024-10-23 20:21:29 +00:00
Carlos Amedee
6ea87f9209 doc/next: document the minimum Linux kernel version for 1.24
The minimum Linux kernel version for Go 1.24 is now set to 3.2.

Updates #67001
For #68545

Change-Id: I509f09c8ed7f3067af14066cf139008db0cb06ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/622015
Auto-Submit: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2024-10-23 19:37:35 +00:00
Shuo Wang
87a89fa451 runtime: add the checkPtraceScope to skip certain tests
When the kernel parameter ptrace_scope is set to 2 or 3,
certain test cases in runtime-gdb_test.go will fail.
We should skip these tests.

Fixes #69932

Change-Id: I685d1217f1521d7f8801680cf6b71d8e7a265188
GitHub-Last-Rev: 063759e04c
GitHub-Pull-Request: golang/go#69933
Reviewed-on: https://go-review.googlesource.com/c/go/+/620857
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-10-23 17:24:33 +00:00
qmuntal
0b4168f6ab syscall: only remove write data access when O_APPEND is set on Windows
There is no need to remove all write accesses when O_APPEND is set,
only the FILE_WRITE_DATA access. This will allow files opened with
O_APPEND and O_WRONLY to be have their attributes and ACLs modified.

Change-Id: I6fe3b25e87b141a9eb30805f395fec31242fd35d
Reviewed-on: https://go-review.googlesource.com/c/go/+/620615
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-10-23 17:23:13 +00:00
Siddhartha Bagaria
87c03bdf62 cmd/link: fix flags order in linkerFlagSupported
Flags from CGo directives should be placed before extldflags so that
extldflags get more preference. This is also the order followed by the
final link command.

Fixes #69350

Change-Id: I2cfb22ae4ea7a160cc614440e88ef2eb82ea7399
Reviewed-on: https://go-review.googlesource.com/c/go/+/614275
Reviewed-by: Cherry Mui <cherryyz@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@golang.org>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
2024-10-23 16:19:08 +00:00
Cuong Manh Le
0f2353997a hash/maphash: sync wyhash with runtime implementation
Fixes #69940

Change-Id: I40535d2647f9456d2196241bf7414b1e92b53c2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/621756
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-10-23 16:06:43 +00:00
Filippo Valsorda
cb69354de3 crypto/internal/fips/subtle: provide XORBytes
This is needed from inside the module, and we generally don't want to
import the crypto tree from it.

For #69536

Change-Id: I69e91e4df89ecac0016c671ccd28e733a7131533
Reviewed-on: https://go-review.googlesource.com/c/go/+/616716
Reviewed-by: Michael Pratt <mpratt@google.com>
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: Daniel McCarney <daniel@binaryparadox.net>
2024-10-23 15:21:50 +00:00
Filippo Valsorda
fdf6605109 crypto/hmac: move implementation to crypto/internal/fips
For #69536

Change-Id: I38508a8de4ac321554a2c12ac70bcf9e25fad1aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/616636
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: Michael Pratt <mpratt@google.com>
2024-10-23 15:21:47 +00:00
Filippo Valsorda
8eeac50cb5 crypto/sha256,crypto/sha512: move implementation to crypto/internal/fips
For #69536

Change-Id: I1efa916e6e9fcddeffa52bc3d23286e6465dae54
Reviewed-on: https://go-review.googlesource.com/c/go/+/615235
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
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: Michael Pratt <mpratt@google.com>
2024-10-23 15:21:45 +00:00