Skip to content

Sync/gh go1.26 with upstream#1

Open
haritzsaiz wants to merge 7 commits into
release-branch.go1.26from
sync/gh-go1.26-with-upstream
Open

Sync/gh go1.26 with upstream#1
haritzsaiz wants to merge 7 commits into
release-branch.go1.26from
sync/gh-go1.26-with-upstream

Conversation

@haritzsaiz

Copy link
Copy Markdown

This pull request introduces several important runtime, os, and syscall improvements and bug fixes, as well as test coverage for recent changes. The most significant updates include ensuring that all directory changes via (*File).Chdir are properly logged for test caching, improving error handling and context propagation in signal handling, and fixing a runtime memory allocation bug. Additional changes enhance syscall safety after process forks and clarify documentation.

Testlog integration and working directory tracking:

  • Added calls to testlog.Logger().Chdir in (*File).Chdir on both POSIX and Plan 9 systems to ensure all working directory changes are recorded for the Go test cache, and added a new test TestFileChdirTestlog to verify this behavior (src/os/file_posix.go, src/os/file_plan9.go, src/os/os_test.go). [1] [2] [3] [4] [5]

Signal handling and context improvements:

  • Implemented the Is method for signalError to allow it to be compared with context.Canceled, and added a test to check that NotifyContext propagates the correct cause (src/os/signal/signal.go, src/os/signal/signal_test.go). [1] [2]

Runtime and memory management fixes:

  • Fixed a bug in moveSliceNoCap to correctly calculate and return the new slice capacity, preventing incorrect memory handling (src/runtime/slice.go).
  • Added a new regression test test/fixedbugs/issue80004.go to check for pointer bitmask errors in memory allocation that could cause the garbage collector to misinterpret non-pointer fields as pointers.

Syscall safety and documentation:

  • Annotated several syscall-related functions on Darwin with //go:norace to prevent race instrumentation after fork or in signal handlers, and clarified the documentation about stack growth and pointer safety (src/syscall/exec_libc2.go, src/syscall/syscall_darwin.go). [1] [2] [3] [4] [5] [6] [7] [8]

Other changes:

  • Minor updates to go version declarations in test data for module and script files (src/cmd/go/testdata/mod/example.com_importcrypto_v1.0.0.txt, src/cmd/go/testdata/script/mod_get_fips140_issue73649.txt). [1] [2]
  • Updated CPU feature checks for AVX512 instructions in garbage collector scan logic (src/internal/runtime/gc/scan/scan_amd64.go).

mvdan and others added 7 commits June 16, 2026 13:11
os.Chdir notifies the testlog hook with the new working directory, but
(*File).Chdir does not, so cmd/go's test cache loses track of the cwd
when a test uses (*File).Chdir to restore the previous directory (as
testing.T.Chdir does in its cleanup). Subsequent relative paths from
later tests in the same package are then resolved against the wrong
directory in computeTestInputsID, and the cache fails to invalidate
when those files change.

Fix it by emitting the same testlog Chdir entry from (*File).Chdir
after a successful Fchdir, mirroring os.Chdir.

Fixes golang#79039.
Updates golang#79019.

Change-Id: I7099d3a1d2ce3e5f4882a0e93c4d642f23f7eca8
Reviewed-on: https://go-review.googlesource.com/c/go/+/771960
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
(cherry picked from commit c7e6da5)
Reviewed-on: https://go-review.googlesource.com/c/go/+/784242
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
FIPS140 crypto files will be bound into the virtual filesystem using the
fsys package. So IsStandardPackage needs to use fsys.ReadDir to check
that the fips140 packages are standard packages rather than os.ReadDir
because os.ReadDir doesn't know about the overlay.

It would be nice if we could pass in a io/fs.FS to IsStandardPackage but
the FS paths are slash paths and don't play well with windows paths. So
we pass in ReadDir instead. Maybe in the future we could create an
alternative interface to pass the filesystem through but that's a bigger
project.

For golang#73649
Fixes golang#79721

Change-Id: I576f03cfc52a63cec0598e058e1354676a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/762581
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Auto-Submit: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
(cherry picked from commit be193f3)
Reviewed-on: https://go-review.googlesource.com/c/go/+/784861
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
…text.Canceled

For golang#77639
Fixes golang#79499

Change-Id: I90e5d6f68c02749ac6e407f1c3565312efafb033
Reviewed-on: https://go-review.googlesource.com/c/go/+/779860
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit 8494d25)
Reviewed-on: https://go-review.googlesource.com/c/go/+/784100
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
…entea

The KMOVB instruction (in scan_amd64.s) requires that flag.

Fixes golang#79920

Change-Id: Id03285932589e349c7a2cc214dc7ea5b448c0a39
Reviewed-on: https://go-review.googlesource.com/c/go/+/788600
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/788860
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
…o a whole multiple of element size

The allocator doesn't accept total sizes that are not a multiple
of the element size.

Fixes golang#80007

Change-Id: I177d67c1ecc15ec9d09b160bbcc2bfb7a3a1891f
Reviewed-on: https://go-review.googlesource.com/c/go/+/790600
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
(cherry picked from commit 1a15699)
Reviewed-on: https://go-review.googlesource.com/c/go/+/791260
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
On darwin, rawSyscall, rawSyscall6, and rawSyscall9 are Go
functions (not assembly as on Linux) that get race-detector
instrumentation. When forkAndExecInChild calls rawSyscall in
the forked child process, the TSan ThreadState pointer is
invalid, causing SIGSEGV in TraceSwitchPartImpl.

Add //go:norace to these functions so the race detector does
not instrument them. Also update the stale comment in
exec_libc2.go that referred to rawSyscall as assembly.

For golang#79804.
Fixes golang#79806.

Change-Id: Ia1d5ffea9bc9729ce5392daaf00b45ab1f779d71
GitHub-Last-Rev: 21d5744
GitHub-Pull-Request: golang#79805
Reviewed-on: https://go-review.googlesource.com/c/go/+/786620
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
(cherry picked from commit 0607ffa)
Reviewed-on: https://go-review.googlesource.com/c/go/+/791800
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
…nc/gh-go1.26-with-upstream

Signed-off-by: hsaiz <hsaizsierra@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants