Skip to content

Commit 5b5cb0d

Browse files
committed
Merge Go 1.26.0 (remote-tracking branch 'upstream/release-branch.go1.26') into tailscale.go1.26
2 parents 5ba287c + d90b98e commit 5b5cb0d

File tree

8 files changed

+39
-24
lines changed

8 files changed

+39
-24
lines changed

VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
go1.26rc3
2-
time 2026-02-03T20:09:49Z
1+
go1.26.0
2+
time 2026-02-10T01:22:00Z

src/crypto/tls/conn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,7 @@ func (c *Conn) handshakeContext(ctx context.Context) (ret error) {
15311531
defer cancel()
15321532

15331533
if c.quic != nil {
1534-
c.quic.cancelc = handshakeCtx.Done()
1534+
c.quic.ctx = handshakeCtx
15351535
c.quic.cancel = cancel
15361536
} else if ctx.Done() != nil {
15371537
// Close the connection if ctx is canceled before the function returns.

src/crypto/tls/quic.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ type quicState struct {
162162
started bool
163163
signalc chan struct{} // handshake data is available to be read
164164
blockedc chan struct{} // handshake is waiting for data, closed when done
165-
cancelc <-chan struct{} // handshake has been canceled
165+
ctx context.Context // handshake context
166166
cancel context.CancelFunc
167167

168168
waitingForDrain bool
@@ -261,10 +261,11 @@ func (q *QUICConn) NextEvent() QUICEvent {
261261

262262
// Close closes the connection and stops any in-progress handshake.
263263
func (q *QUICConn) Close() error {
264-
if q.conn.quic.cancel == nil {
264+
if q.conn.quic.ctx == nil {
265265
return nil // never started
266266
}
267267
q.conn.quic.cancel()
268+
<-q.conn.quic.signalc
268269
for range q.conn.quic.blockedc {
269270
// Wait for the handshake goroutine to return.
270271
}
@@ -511,20 +512,16 @@ func (c *Conn) quicWaitForSignal() error {
511512
// Send on blockedc to notify the QUICConn that the handshake is blocked.
512513
// Exported methods of QUICConn wait for the handshake to become blocked
513514
// before returning to the user.
514-
select {
515-
case c.quic.blockedc <- struct{}{}:
516-
case <-c.quic.cancelc:
517-
return c.sendAlertLocked(alertCloseNotify)
518-
}
515+
c.quic.blockedc <- struct{}{}
519516
// The QUICConn reads from signalc to notify us that the handshake may
520517
// be able to proceed. (The QUICConn reads, because we close signalc to
521518
// indicate that the handshake has completed.)
522-
select {
523-
case c.quic.signalc <- struct{}{}:
524-
c.hand.Write(c.quic.readbuf)
525-
c.quic.readbuf = nil
526-
case <-c.quic.cancelc:
519+
c.quic.signalc <- struct{}{}
520+
if c.quic.ctx.Err() != nil {
521+
// The connection has been canceled.
527522
return c.sendAlertLocked(alertCloseNotify)
528523
}
524+
c.hand.Write(c.quic.readbuf)
525+
c.quic.readbuf = nil
529526
return nil
530527
}

src/crypto/tls/quic_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"fmt"
1212
"reflect"
1313
"strings"
14+
"sync"
1415
"testing"
1516
)
1617

@@ -480,6 +481,24 @@ func TestQUICStartContextPropagation(t *testing.T) {
480481
}
481482
}
482483

484+
func TestQUICContextCancelation(t *testing.T) {
485+
ctx, cancel := context.WithCancel(context.Background())
486+
config := &QUICConfig{TLSConfig: testConfig.Clone()}
487+
config.TLSConfig.MinVersion = VersionTLS13
488+
cli := newTestQUICClient(t, config)
489+
cli.conn.SetTransportParameters(nil)
490+
srv := newTestQUICServer(t, config)
491+
srv.conn.SetTransportParameters(nil)
492+
// Verify that canceling the connection context concurrently does not cause any races.
493+
// See https://go.dev/issue/77274.
494+
var wg sync.WaitGroup
495+
wg.Go(func() {
496+
_ = runTestQUICConnection(ctx, cli, srv, nil)
497+
})
498+
wg.Go(cancel)
499+
wg.Wait()
500+
}
501+
483502
func TestQUICDelayedTransportParameters(t *testing.T) {
484503
clientConfig := &QUICConfig{TLSConfig: testConfig.Clone()}
485504
clientConfig.TLSConfig.MinVersion = VersionTLS13

src/log/slog/multi_handler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ func NewMultiHandler(handlers ...Handler) *MultiHandler {
1717
}
1818

1919
// MultiHandler is a [Handler] that invokes all the given Handlers.
20-
// Its Enable method reports whether any of the handlers' Enabled methods return true.
21-
// Its Handle, WithAttr and WithGroup methods call the corresponding method on each of the enabled handlers.
20+
// Its Enabled method reports whether any of the handlers' Enabled methods return true.
21+
// Its Handle, WithAttrs and WithGroup methods call the corresponding method on each of the enabled handlers.
2222
type MultiHandler struct {
2323
multi []Handler
2424
}

src/runtime/pprof/pprof.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ import (
171171
// holds a lock for 1s while 5 other goroutines are waiting for the entire
172172
// second to acquire the lock, its unlock call stack will report 5s of
173173
// contention.
174-
175174
type Profile struct {
176175
name string
177176
mu sync.Mutex

src/simd/archsimd/_gen/simdgen/ops/Others/categories.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
- go: SHA256TwoRounds
8484
commutative: false
8585
documentation: !string |-
86-
// NAME does 2 rounds of B loop to calculate updated state variables in SHA1 algorithm defined in FIPS 180-4.
86+
// NAME does 2 rounds of B loop to calculate updated state variables in SHA256 algorithm defined in FIPS 180-4.
8787
// x = {h, g, d, c}
8888
// y = {f, e, b, a}
8989
// z = {W0+K0, W1+K1}
@@ -95,14 +95,14 @@
9595
- go: SHA256Message1
9696
commutative: false
9797
documentation: !string |-
98-
// NAME does the sigma and addtion of 1 in SHA1 algorithm defined in FIPS 180-4.
98+
// NAME does the sigma and addition of 1 in SHA256 algorithm defined in FIPS 180-4.
9999
// x = {W0, W1, W2, W3}
100100
// y = {W4, 0, 0, 0}
101101
// result = {W0+σ(W1), W1+σ(W2), W2+σ(W3), W3+σ(W4)}
102102
- go: SHA256Message2
103103
commutative: false
104104
documentation: !string |-
105-
// NAME does the sigma and addition of 3 in SHA1 algorithm defined in FIPS 180-4.
105+
// NAME does the sigma and addition of 3 in SHA256 algorithm defined in FIPS 180-4.
106106
// x = result of 2
107107
// y = {0, 0, W14, W15}
108108
// result = {W16, W17, W18, W19}

src/simd/archsimd/ops_amd64.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)