Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: golang/go
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: go1.21.6
Choose a base ref
...
head repository: golang/go
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: go1.21.7
Choose a head ref
  • 13 commits
  • 46 files changed
  • 11 contributors

Commits on Jan 10, 2024

  1. [release-branch.go1.21] runtime: don't print "unexpected SPWRITE" whe…

    …n printing traceback
    
    The system stack often starts with a stack transition function
    like "systemstack" or "mcall", which is marked as SPWRITE. When
    unwinding a system stack for printing, we want the traceback stop
    at the stack switching frame, but not print the "unexpected
    SPWRITE" message.
    
    Previously before CL 525835, we don't print the "unexpected
    SPWRITE" message if unwindPrintErrors is set, i.e. printing a
    stack trace. This CL restores this behavior.
    
    Another possibility is not printing the message only on the system
    stack. We don't expect a stack transition function to appear in a
    user G.
    
    Fixes #64935.
    
    Change-Id: I173e89ead2cd4fbf1f0f8cca225f28718b5baebe
    Reviewed-on: https://go-review.googlesource.com/c/go/+/531815
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Michael Pratt <mpratt@google.com>
    Reviewed-by: Michael Knyszek <mknyszek@google.com>
    (cherry picked from commit 15a274b)
    Reviewed-on: https://go-review.googlesource.com/c/go/+/553476
    Reviewed-by: Cherry Mui <cherryyz@google.com>
    Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
    TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
    cherrymui authored and gopherbot committed Jan 10, 2024
    Configuration menu
    Copy the full SHA
    caafb50 View commit details
    Browse the repository at this point in the history
  2. [release-branch.go1.21] runtime: allow update of system stack bounds …

    …on callback from C thread
    
    [This cherry-pick combines CL 527715, CL 527775, CL 527797, and
    CL 529216.]
    
    [This is a redo of CL 525455 with the test fixed on darwin by defining
    _XOPEN_SOURCE, and disabled with android, musl, and openbsd, which do
    not provide getcontext.]
    
    Since CL 495855, Ms are cached for C threads calling into Go, including
    the stack bounds of the system stack.
    
    Some C libraries (e.g., coroutine libraries) do manual stack management
    and may change stacks between calls to Go on the same thread.
    
    Changing the stack if there is more Go up the stack would be
    problematic. But if the calls are completely independent there is no
    particular reason for Go to care about the changing stack boundary.
    
    Thus, this CL allows the stack bounds to change in such cases. The
    primary downside here (besides additional complexity) is that normal
    systems that do not manipulate the stack may not notice unintentional
    stack corruption as quickly as before.
    
    Note that callbackUpdateSystemStack is written to be usable for the
    initial setup in needm as well as updating the stack in cgocallbackg.
    
    For #62440.
    For #62130.
    For #63209.
    
    Change-Id: I0fe0134f865932bbaff1fc0da377c35c013bd768
    Reviewed-on: https://go-review.googlesource.com/c/go/+/527715
    Run-TryBot: Michael Pratt <mpratt@google.com>
    TryBot-Result: Gopher Robot <gobot@golang.org>
    Auto-Submit: Michael Pratt <mpratt@google.com>
    Reviewed-by: Cherry Mui <cherryyz@google.com>
    (cherry picked from commit 4f9fe6d)
    (cherry picked from commit e8ba057)
    (cherry picked from commit a843991)
    (cherry picked from commit d110d7c)
    Reviewed-on: https://go-review.googlesource.com/c/go/+/530480
    Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
    TryBot-Bypass: Michael Pratt <mpratt@google.com>
    prattmic authored and gopherbot committed Jan 10, 2024
    Configuration menu
    Copy the full SHA
    491c1e7 View commit details
    Browse the repository at this point in the history
  3. [release-branch.go1.21] runtime: clear g0 stack bounds in dropm

    After CL 527715, needm uses callbackUpdateSystemStack to set the stack
    bounds for g0 on an M from the extra M list. Since
    callbackUpdateSystemStack is also used for recursive cgocallback, it
    does nothing if the stack is already in bounds.
    
    Currently, the stack bounds in an extra M may contain stale bounds from
    a previous thread that used this M and then returned it to the extra
    list in dropm.
    
    Typically a new thread will not have an overlapping stack with an old
    thread, but because the old thread has exited there is a small chance
    that the C memory allocator will allocate the new thread's stack
    partially or fully overlapping with the old thread's stack.
    
    If this occurs, then callbackUpdateSystemStack will not update the stack
    bounds. If in addition, the overlap is partial such that SP on
    cgocallback is close to the recorded stack lower bound, then Go may
    quickly "overflow" the stack and crash with "morestack on g0".
    
    Fix this by clearing the stack bounds in dropm, which ensures that
    callbackUpdateSystemStack will unconditionally update the bounds in
    needm.
    
    For #62440.
    Fixes #63209.
    
    Change-Id: Ic9e2052c2090dd679ed716d1a23a86d66cbcada7
    Reviewed-on: https://go-review.googlesource.com/c/go/+/537695
    Reviewed-by: Cherry Mui <cherryyz@google.com>
    Run-TryBot: Michael Pratt <mpratt@google.com>
    Auto-Submit: Michael Pratt <mpratt@google.com>
    TryBot-Bypass: Michael Pratt <mpratt@google.com>
    (cherry picked from commit 1af424c)
    Reviewed-on: https://go-review.googlesource.com/c/go/+/549495
    Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
    prattmic authored and gopherbot committed Jan 10, 2024
    Configuration menu
    Copy the full SHA
    7e34c43 View commit details
    Browse the repository at this point in the history
  4. [release-branch.go1.21] slices: explicitly discard results of some fu…

    …nctions
    
    This will otherwise trigger an "unusedresult" vet check.
    
    For #64978.
    Fixes #65023.
    Fixes #60058.
    
    Change-Id: Ie19aded0f808d394f389452c3ff7f3edc1ed710d
    Reviewed-on: https://go-review.googlesource.com/c/go/+/554196
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Bryan Mills <bcmills@google.com>
    (cherry picked from commit 8088b6d)
    Reviewed-on: https://go-review.googlesource.com/c/go/+/554756
    Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
    Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
    Reviewed-by: Alan Donovan <adonovan@google.com>
    adonovan authored and gopherbot committed Jan 10, 2024
    Configuration menu
    Copy the full SHA
    2540b14 View commit details
    Browse the repository at this point in the history

Commits on Jan 25, 2024

  1. [release-branch.go1.21] runtime: properly model rwmutex in lock ranking

    (This cherry-pick combines CL 549536 and the follow-up fix CL 555055.)
    
    Currently, lock ranking doesn't really try to model rwmutex. It records
    the internal locks rLock and wLock, but in a subpar fashion:
    
    1. wLock is held from lock to unlock, so it works OK, but it conflates
       write locks of all rwmutexes as rwmutexW, rather than allowing
       different rwmutexes to have different rankings.
    2. rLock is an internal implementation detail that is only taken when
       there is contention in rlock. As as result, the reader lock path is
       almost never checked.
    
    Add proper modeling. rwmutexR and rwmutexW remain as the ranks of the
    internal locks, which have their own ordering. The new init method is
    passed the ranks of the higher level lock that this represents, just
    like lockInit for mutex.
    
    execW ordered before MALLOC captures the case from #64722. i.e., there
    can be allocation between BeforeFork and AfterFork.
    
    For #64722.
    Fixes #64761.
    
    ------
    
    runtime: replace rwmutexR/W with per-rwmutex lock rank
    
    CL 549536 intended to decouple the internal implementation of rwmutex
    from the semantic meaning of an rwmutex read/write lock in the static
    lock ranking.
    
    Unfortunately, it was not thought through well enough. The internals
    were represented with the rwmutexR and rwmutexW lock ranks. The idea was
    that the internal lock ranks need not model the higher-level ordering,
    since those have separate rankings. That is incorrect; rwmutexW is held
    for the duration of a write lock, so it must be ranked before any lock
    taken while any write lock is held, which is precisely what we were
    trying to avoid.
    
    This is visible in violations like:
    
            0 : execW 11 0x0
            1 : rwmutexW 51 0x111d9c8
            2 : fin 30 0x111d3a0
            fatal error: lock ordering problem
    
    execW < fin is modeled, but rwmutexW < fin is missing.
    
    Fix this by eliminating the rwmutexR/W lock ranks shared across
    different types of rwmutex. Instead require users to define an
    additional "internal" lock rank to represent the implementation details
    of rwmutex.rLock. We can avoid an additional "internal" lock rank for
    rwmutex.wLock because the existing writeRank has the same semantics for
    semantic and internal locking. i.e., writeRank is held for the duration
    of a write lock, which is exactly how rwmutex.wLock is used, so we can
    use writeRank directly on wLock.
    
    For #64722.
    
    Cq-Include-Trybots: luci.golang.try:go1.21-linux-amd64-staticlockranking
    Change-Id: I23335b28faa42fb04f1bc9da02fdf54d1616cd28
    Reviewed-on: https://go-review.googlesource.com/c/go/+/549536
    Reviewed-by: Michael Knyszek <mknyszek@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    (cherry picked from commit 9b4b3e5)
    (cherry picked from commit dcbe772)
    Reviewed-on: https://go-review.googlesource.com/c/go/+/554976
    prattmic authored and cherrymui committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    2f91c16 View commit details
    Browse the repository at this point in the history
  2. [release-branch.go1.21] go/types, types2: don't lose position info of…

    … interface embeddings
    
    Accurate position information for embedded types in interfaces is
    crucial to identify the corresponding source file, and with that
    the Go language version associated with that file. (The position
    information is also important for proper error messages.)
    
    Before this CL, the position information for embedded types was
    discarded after type set computation, in the assumption that it
    was not needed anymore. However, substitutions that update the
    interface may lead to repeated type set computations which then
    won't have the correct position information.
    
    This CL does preserve the position information for embedded
    types until the end of type checking (cleanup phase), and also
    copy the position information during a substitution of the
    interface.
    
    The respective bug (#64759) doesn't seem to appear in 1.22 (most
    likely because it's hidden by some of the changes made with respect
    to the file version logic), but the existing code is still wrong.
    The backport of this code to 1.21 and 1.20 fixes the issue in those
    releases.
    
    For #64759.
    Fixes #65053.
    
    Change-Id: I80f4004c9d79cb02eac6739c324c477706615102
    Reviewed-on: https://go-review.googlesource.com/c/go/+/555296
    Run-TryBot: Robert Griesemer <gri@google.com>
    TryBot-Result: Gopher Robot <gobot@golang.org>
    Reviewed-by: Robert Findley <rfindley@google.com>
    Reviewed-by: Robert Griesemer <gri@google.com>
    Reviewed-on: https://go-review.googlesource.com/c/go/+/555415
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    griesemer authored and cherrymui committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    00f974e View commit details
    Browse the repository at this point in the history

Commits on Jan 31, 2024

  1. [release-branch.go1.21] crypto/x509: properly gate test on macos version

    Fixes the gating of TestIssue51759 by shelling out to sw_vers to check
    what version of macOS we are on.
    
    For #64677
    Fixes #65380
    
    Change-Id: I5eef4fa39e5449e7b2aa73864625c3abf002aef8
    Reviewed-on: https://go-review.googlesource.com/c/go/+/549195
    Reviewed-by: Bryan Mills <bcmills@google.com>
    Auto-Submit: Roland Shoemaker <roland@golang.org>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    (cherry picked from commit 400e24a)
    Reviewed-on: https://go-review.googlesource.com/c/go/+/559517
    Auto-Submit: Michael Pratt <mpratt@google.com>
    Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
    rolandshoemaker authored and gopherbot committed Jan 31, 2024
    Configuration menu
    Copy the full SHA
    3960318 View commit details
    Browse the repository at this point in the history
  2. [release-branch.go1.21] cmd/go/internal/toolchain: apply the -modcach…

    …erw flag when downloading a module to determine what toolchain it needs
    
    Fixes #64497.
    Updates #64282.
    
    Change-Id: I3f211c599ee70cb58254d0bc07eeb3c135124e58
    Reviewed-on: https://go-review.googlesource.com/c/go/+/555436
    Auto-Submit: Bryan Mills <bcmills@google.com>
    Reviewed-by: Russ Cox <rsc@golang.org>
    (cherry picked from commit cc38c68)
    Reviewed-on: https://go-review.googlesource.com/c/go/+/559198
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Bryan C. Mills authored and mknyszek committed Jan 31, 2024
    Configuration menu
    Copy the full SHA
    6552f3d View commit details
    Browse the repository at this point in the history
  3. [release-branch.go1.21] runtime: fix Pinner.Pin documentation

    Fixes #63768
    
    Change-Id: I01a9bb8f9af22a6b3f6534d431e3ea623875ed48
    GitHub-Last-Rev: 7c5dd4e
    GitHub-Pull-Request: #64920
    Reviewed-on: https://go-review.googlesource.com/c/go/+/553395
    Reviewed-by: Michael Knyszek <mknyszek@google.com>
    Auto-Submit: Michael Knyszek <mknyszek@google.com>
    Reviewed-by: Cherry Mui <cherryyz@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    TryBot-Result: Gopher Robot <gobot@golang.org>
    qiulaidongfeng authored and gopherbot committed Jan 31, 2024
    Configuration menu
    Copy the full SHA
    916e6cd View commit details
    Browse the repository at this point in the history

Commits on Feb 1, 2024

  1. [release-branch.go1.21] Revert "crypto/internal/boring: upgrade modul…

    …e to fips-20220613" +1
    
    This reverts CL 553855 ("crypto/internal/boring: upgrade module to
    fips-20220613") and CL 553856 ("crypto/tls: align FIPS-only mode with
    BoringSSL policy").
    
    Fixes #65323
    Updates #65321
    Updates #64717
    Updates #62372
    
    Change-Id: I0938b97e5b4904e6532448b8ae76e920d03d0508
    Reviewed-on: https://go-review.googlesource.com/c/go/+/558796
    Reviewed-by: Michael Knyszek <mknyszek@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>
    (cherry picked from commit 09b5de4)
    Reviewed-on: https://go-review.googlesource.com/c/go/+/560275
    FiloSottile authored and mknyszek committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    db74bfb View commit details
    Browse the repository at this point in the history
  2. [release-branch.go1.21] cmd/go/internal/generate: call modload.InitWo…

    …rkFile
    
    This is necessary for go generate to enter workspace mode for
    recognizing package paths in the workspace.
    
    For #56098
    Fixes #65351
    
    Change-Id: I25f68de24f4189259353f63194823516e9d3d505
    Reviewed-on: https://go-review.googlesource.com/c/go/+/559195
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Bryan Mills <bcmills@google.com>
    (cherry picked from commit b91bad7)
    Reviewed-on: https://go-review.googlesource.com/c/go/+/559235
    matloob authored and mknyszek committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    01c93ad View commit details
    Browse the repository at this point in the history

Commits on Feb 2, 2024

  1. [release-branch.go1.21] cmd/internal/obj/arm64: fix frame pointer res…

    …tore in epilogue
    
    For leaf but nonzero-frame functions.
    
    Currently we're not restoring it properly. We also need to restore
    it before popping the stack frame, so that the frame won't get
    clobbered by a signal handler in the meantime.
    
    For #63830
    Fixes #65449
    
    Needs a test, but I'm not at all sure how we would actually do that. Leaving for inspiration.
    
    Change-Id: I273a25f2a838f05a959c810145cccc5428eaf164
    Reviewed-on: https://go-review.googlesource.com/c/go/+/538635
    Reviewed-by: Cherry Mui <cherryyz@google.com>
    Reviewed-by: Eric Fang <eric.fang@arm.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: David Chase <drchase@google.com>
    (cherry picked from commit c9888bd)
    Reviewed-on: https://go-review.googlesource.com/c/go/+/560735
    TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
    Reviewed-by: Keith Randall <khr@golang.org>
    randall77 authored and mknyszek committed Feb 2, 2024
    Configuration menu
    Copy the full SHA
    2fdad8a View commit details
    Browse the repository at this point in the history

Commits on Feb 6, 2024

  1. [release-branch.go1.21] go1.21.7

    Change-Id: I2c0bbd094a1e9a12576869437a362da40f76f22d
    Reviewed-on: https://go-review.googlesource.com/c/go/+/562117
    Reviewed-by: Michael Knyszek <mknyszek@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Auto-Submit: Gopher Robot <gobot@golang.org>
    Reviewed-by: David Chase <drchase@google.com>
    gopherbot committed Feb 6, 2024
    Configuration menu
    Copy the full SHA
    f292080 View commit details
    Browse the repository at this point in the history
Loading