From 0fdca725c754dd48a3b84c94d7f147100f751677 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Thu, 5 Aug 2021 11:32:43 -0700 Subject: [release-branch.go1.17] sync: remove TestWaitGroupMisuse2 and TestWaitGroupMisuse3 These tests are inherently nondeterministic: They exercise a racy code path for up to one million iterations, and require that an error occur at least once. TestWaitGroupMisuse2 in particular is an ongoing source of trybot flakiness. Updates #38163. Fixes #52306. Change-Id: Ibbbda2c998c915333487ad262d3df6829de01c2b Reviewed-on: https://go-review.googlesource.com/c/go/+/340249 Trust: Damien Neil Trust: Dmitri Shuralyov Run-TryBot: Damien Neil TryBot-Result: Go Bot Reviewed-by: Dmitry Vyukov (cherry picked from commit 011fd002457da0823da5f06b099fcf6e21444b00) Reviewed-on: https://go-review.googlesource.com/c/go/+/399821 Run-TryBot: Dmitri Shuralyov TryBot-Result: Gopher Robot Reviewed-by: Dmitri Shuralyov Reviewed-by: Damien Neil --- src/sync/waitgroup_test.go | 126 --------------------------------------------- 1 file changed, 126 deletions(-) diff --git a/src/sync/waitgroup_test.go b/src/sync/waitgroup_test.go index c569e0faa2..4ded218d2d 100644 --- a/src/sync/waitgroup_test.go +++ b/src/sync/waitgroup_test.go @@ -5,8 +5,6 @@ package sync_test import ( - "internal/race" - "runtime" . "sync" "sync/atomic" "testing" @@ -48,12 +46,6 @@ func TestWaitGroup(t *testing.T) { } } -func knownRacy(t *testing.T) { - if race.Enabled { - t.Skip("skipping known-racy test under the race detector") - } -} - func TestWaitGroupMisuse(t *testing.T) { defer func() { err := recover() @@ -68,124 +60,6 @@ func TestWaitGroupMisuse(t *testing.T) { t.Fatal("Should panic") } -// pollUntilEqual blocks until v, loaded atomically, is -// equal to the target. -func pollUntilEqual(v *uint32, target uint32) { - for { - for i := 0; i < 1e3; i++ { - if atomic.LoadUint32(v) == target { - return - } - } - // yield to avoid deadlock with the garbage collector - // see issue #20072 - runtime.Gosched() - } -} - -func TestWaitGroupMisuse2(t *testing.T) { - knownRacy(t) - if runtime.NumCPU() <= 4 { - t.Skip("NumCPU<=4, skipping: this test requires parallelism") - } - defer func() { - err := recover() - if err != "sync: negative WaitGroup counter" && - err != "sync: WaitGroup misuse: Add called concurrently with Wait" && - err != "sync: WaitGroup is reused before previous Wait has returned" { - t.Fatalf("Unexpected panic: %#v", err) - } - }() - defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(4)) - done := make(chan interface{}, 2) - // The detection is opportunistic, so we want it to panic - // at least in one run out of a million. - for i := 0; i < 1e6; i++ { - var wg WaitGroup - var here uint32 - wg.Add(1) - go func() { - defer func() { - done <- recover() - }() - atomic.AddUint32(&here, 1) - pollUntilEqual(&here, 3) - wg.Wait() - }() - go func() { - defer func() { - done <- recover() - }() - atomic.AddUint32(&here, 1) - pollUntilEqual(&here, 3) - wg.Add(1) // This is the bad guy. - wg.Done() - }() - atomic.AddUint32(&here, 1) - pollUntilEqual(&here, 3) - wg.Done() - for j := 0; j < 2; j++ { - if err := <-done; err != nil { - panic(err) - } - } - } - t.Fatal("Should panic") -} - -func TestWaitGroupMisuse3(t *testing.T) { - knownRacy(t) - if runtime.NumCPU() <= 1 { - t.Skip("NumCPU==1, skipping: this test requires parallelism") - } - defer func() { - err := recover() - if err != "sync: negative WaitGroup counter" && - err != "sync: WaitGroup misuse: Add called concurrently with Wait" && - err != "sync: WaitGroup is reused before previous Wait has returned" { - t.Fatalf("Unexpected panic: %#v", err) - } - }() - defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(4)) - done := make(chan interface{}, 3) - // The detection is opportunistically, so we want it to panic - // at least in one run out of a million. - for i := 0; i < 1e6; i++ { - var wg WaitGroup - wg.Add(1) - go func() { - defer func() { - done <- recover() - }() - wg.Done() - }() - go func() { - defer func() { - done <- recover() - }() - wg.Wait() - // Start reusing the wg before waiting for the Wait below to return. - wg.Add(1) - go func() { - wg.Done() - }() - wg.Wait() - }() - go func() { - defer func() { - done <- recover() - }() - wg.Wait() - }() - for j := 0; j < 3; j++ { - if err := <-done; err != nil { - panic(err) - } - } - } - t.Fatal("Should panic") -} - func TestWaitGroupRace(t *testing.T) { // Run this test for about 1ms. for i := 0; i < 1000; i++ { -- cgit v1.2.3-54-g00ecf From 9511f6deb62d1ef8c023dc4480517f1e4a57e3e7 Mon Sep 17 00:00:00 2001 From: Roland Shoemaker Date: Mon, 21 Mar 2022 17:26:26 -0700 Subject: [release-branch.go1.17] crypto/x509: properly handle issuerUniqueID and subjectUniqueID Updates #51754 Fixes #51858 Change-Id: I3bfa15db3497de9fb82d6391d87fca1ae9ba6543 Reviewed-on: https://go-review.googlesource.com/c/go/+/394297 Trust: Roland Shoemaker Run-TryBot: Roland Shoemaker Auto-Submit: Roland Shoemaker TryBot-Result: Gopher Robot Reviewed-by: Damien Neil (cherry picked from commit 9a53b472b5ed41f9fe79a73f1236ed3f45f8871a) Reviewed-on: https://go-review.googlesource.com/c/go/+/399501 --- src/crypto/x509/parser.go | 4 ++-- src/crypto/x509/x509_test.go | 48 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/crypto/x509/parser.go b/src/crypto/x509/parser.go index 9a500a8098..635e74bd89 100644 --- a/src/crypto/x509/parser.go +++ b/src/crypto/x509/parser.go @@ -941,10 +941,10 @@ func parseCertificate(der []byte) (*Certificate, error) { } if cert.Version > 1 { - if !tbs.SkipOptionalASN1(cryptobyte_asn1.Tag(1).Constructed().ContextSpecific()) { + if !tbs.SkipOptionalASN1(cryptobyte_asn1.Tag(1).ContextSpecific()) { return nil, errors.New("x509: malformed issuerUniqueID") } - if !tbs.SkipOptionalASN1(cryptobyte_asn1.Tag(2).Constructed().ContextSpecific()) { + if !tbs.SkipOptionalASN1(cryptobyte_asn1.Tag(2).ContextSpecific()) { return nil, errors.New("x509: malformed subjectUniqueID") } if cert.Version == 3 { diff --git a/src/crypto/x509/x509_test.go b/src/crypto/x509/x509_test.go index 449379fbb1..f32dc7d9bf 100644 --- a/src/crypto/x509/x509_test.go +++ b/src/crypto/x509/x509_test.go @@ -3311,3 +3311,51 @@ func TestLargeOID(t *testing.T) { t.Fatalf("ParseCertificate to failed to parse certificate with large OID: %s", err) } } + +const uniqueIDPEM = `-----BEGIN CERTIFICATE----- +MIIFsDCCBJigAwIBAgIIrOyC1ydafZMwDQYJKoZIhvcNAQEFBQAwgY4xgYswgYgG +A1UEAx6BgABNAGkAYwByAG8AcwBvAGYAdAAgAEYAbwByAGUAZgByAG8AbgB0ACAA +VABNAEcAIABIAFQAVABQAFMAIABJAG4AcwBwAGUAYwB0AGkAbwBuACAAQwBlAHIA +dABpAGYAaQBjAGEAdABpAG8AbgAgAEEAdQB0AGgAbwByAGkAdAB5MB4XDTE0MDEx +ODAwNDEwMFoXDTE1MTExNTA5Mzc1NlowgZYxCzAJBgNVBAYTAklEMRAwDgYDVQQI +EwdqYWthcnRhMRIwEAYDVQQHEwlJbmRvbmVzaWExHDAaBgNVBAoTE3N0aG9ub3Jl +aG90ZWxyZXNvcnQxHDAaBgNVBAsTE3N0aG9ub3JlaG90ZWxyZXNvcnQxJTAjBgNV +BAMTHG1haWwuc3Rob25vcmVob3RlbHJlc29ydC5jb20wggEiMA0GCSqGSIb3DQEB +AQUAA4IBDwAwggEKAoIBAQCvuu0qpI+Ko2X84Twkf84cRD/rgp6vpgc5Ebejx/D4 +PEVON5edZkazrMGocK/oQqIlRxx/lefponN/chlGcllcVVPWTuFjs8k+Aat6T1qp +4iXxZekAqX+U4XZMIGJD3PckPL6G2RQSlF7/LhGCsRNRdKpMWSTbou2Ma39g52Kf +gsl3SK/GwLiWpxpcSkNQD1hugguEIsQYLxbeNwpcheXZtxbBGguPzQ7rH8c5vuKU +BkMOzaiNKLzHbBdFSrua8KWwCJg76Vdq/q36O9GlW6YgG3i+A4pCJjXWerI1lWwX +Ktk5V+SvUHGey1bkDuZKJ6myMk2pGrrPWCT7jP7WskChAgMBAAGBCQBCr1dgEleo +cKOCAfswggH3MIHDBgNVHREEgbswgbiCHG1haWwuc3Rob25vcmVob3RlbHJlc29y +dC5jb22CIGFzaGNoc3ZyLnN0aG9ub3JlaG90ZWxyZXNvcnQuY29tgiRBdXRvRGlz +Y292ZXIuc3Rob25vcmVob3RlbHJlc29ydC5jb22CHEF1dG9EaXNjb3Zlci5ob3Rl +bHJlc29ydC5jb22CCEFTSENIU1ZSghdzdGhvbm9yZWhvdGVscmVzb3J0LmNvbYIP +aG90ZWxyZXNvcnQuY29tMCEGCSsGAQQBgjcUAgQUHhIAVwBlAGIAUwBlAHIAdgBl +AHIwHQYDVR0OBBYEFMAC3UR4FwAdGekbhMgnd6lMejtbMAsGA1UdDwQEAwIFoDAT +BgNVHSUEDDAKBggrBgEFBQcDATAJBgNVHRMEAjAAMIG/BgNVHQEEgbcwgbSAFGfF +6xihk+gJJ5TfwvtWe1UFnHLQoYGRMIGOMYGLMIGIBgNVBAMegYAATQBpAGMAcgBv +AHMAbwBmAHQAIABGAG8AcgBlAGYAcgBvAG4AdAAgAFQATQBHACAASABUAFQAUABT +ACAASQBuAHMAcABlAGMAdABpAG8AbgAgAEMAZQByAHQAaQBmAGkAYwBhAHQAaQBv +AG4AIABBAHUAdABoAG8AcgBpAHQAeYIIcKhXEmBXr0IwDQYJKoZIhvcNAQEFBQAD +ggEBABlSxyCMr3+ANr+WmPSjyN5YCJBgnS0IFCwJAzIYP87bcTye/U8eQ2+E6PqG +Q7Huj7nfHEw9qnGo+HNyPp1ad3KORzXDb54c6xEoi+DeuPzYHPbn4c3hlH49I0aQ +eWW2w4RslSWpLvO6Y7Lboyz2/Thk/s2kd4RHxkkWpH2ltPqJuYYg3X6oM5+gIFHJ +WGnh+ojZ5clKvS5yXh3Wkj78M6sb32KfcBk0Hx6NkCYPt60ODYmWtvqwtw6r73u5 +TnTYWRNvo2svX69TriL+CkHY9O1Hkwf2It5zHl3gNiKTJVaak8AuEz/CKWZneovt +yYLwhUhg3PX5Co1VKYE+9TxloiE= +-----END CERTIFICATE-----` + +func TestParseUniqueID(t *testing.T) { + b, _ := pem.Decode([]byte(uniqueIDPEM)) + if b == nil { + t.Fatalf("couldn't decode test certificate") + } + cert, err := ParseCertificate(b.Bytes) + if err != nil { + t.Fatalf("ParseCertificate to failed to parse certificate with unique identifier id: %s", err) + } + if len(cert.Extensions) != 7 { + t.Fatalf("unexpected number of extensions (probably because the extension section was not parsed): got %d, want 7", len(cert.Extensions)) + } +} -- cgit v1.2.3-54-g00ecf From 2150be1a9be0a333dbdb9759d8dd98905d987828 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Thu, 31 Mar 2022 16:51:32 -0400 Subject: [release-branch.go1.17] syscall: relax output check in TestGroupCleanupUserNamespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit “If you have a procedure with ten parameters, you probably missed some.” ― attr. Alan J. Perlis I argue that the same is true for hard-coded special cases. In TestGroupCleanupUserNamespace, instead of a curated list of strings observed in the wild we now check for a prefix, as was done for TestGroupCleanup in CL 24670. Updates #52088. Fixes #52148. Change-Id: I59c5b0c048113e306996c0f8247e09c714d2423a Reviewed-on: https://go-review.googlesource.com/c/go/+/397316 Trust: Bryan Mills Run-TryBot: Bryan Mills TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor (cherry picked from commit 434b2a5d0dbdfdce6327beb06ca03c02b3fd2785) Reviewed-on: https://go-review.googlesource.com/c/go/+/398235 Reviewed-by: Ian Lance Taylor --- src/syscall/exec_linux_test.go | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/syscall/exec_linux_test.go b/src/syscall/exec_linux_test.go index 85b59ad00d..d62b80b017 100644 --- a/src/syscall/exec_linux_test.go +++ b/src/syscall/exec_linux_test.go @@ -275,12 +275,14 @@ func TestGroupCleanup(t *testing.T) { t.Fatalf("Cmd failed with err %v, output: %s", err, out) } strOut := strings.TrimSpace(string(out)) + t.Logf("id: %s", strOut) + expected := "uid=0(root) gid=0(root)" // Just check prefix because some distros reportedly output a // context parameter; see https://golang.org/issue/16224. // Alpine does not output groups; see https://golang.org/issue/19938. if !strings.HasPrefix(strOut, expected) { - t.Errorf("id command output: %q, expected prefix: %q", strOut, expected) + t.Errorf("expected prefix: %q", expected) } } @@ -309,23 +311,14 @@ func TestGroupCleanupUserNamespace(t *testing.T) { t.Fatalf("Cmd failed with err %v, output: %s", err, out) } strOut := strings.TrimSpace(string(out)) + t.Logf("id: %s", strOut) - // Strings we've seen in the wild. - expected := []string{ - "uid=0(root) gid=0(root) groups=0(root)", - "uid=0(root) gid=0(root) groups=0(root),65534(nobody)", - "uid=0(root) gid=0(root) groups=0(root),65534(nogroup)", - "uid=0(root) gid=0(root) groups=0(root),65534", - "uid=0(root) gid=0(root) groups=0(root),65534(nobody),65534(nobody),65534(nobody),65534(nobody),65534(nobody),65534(nobody),65534(nobody),65534(nobody),65534(nobody),65534(nobody)", // Alpine; see https://golang.org/issue/19938 - "uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023", // CentOS with SELinux context, see https://golang.org/issue/34547 - "uid=0(root) gid=0(root) groups=0(root),65534(nobody) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023", // Fedora with SElinux context, see https://golang.org/issue/46752 - } - for _, e := range expected { - if strOut == e { - return - } + // As in TestGroupCleanup, just check prefix. + // The actual groups and contexts seem to vary from one distro to the next. + expected := "uid=0(root) gid=0(root) groups=0(root)" + if !strings.HasPrefix(strOut, expected) { + t.Errorf("expected prefix: %q", expected) } - t.Errorf("id command output: %q, expected one of %q", strOut, expected) } // TestUnshareHelperProcess isn't a real test. It's used as a helper process -- cgit v1.2.3-54-g00ecf From 78992411ded8288ed32790ece2b998f0a6c7d997 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 15 Apr 2022 13:46:00 -0700 Subject: [release-branch.go1.17] runtime: don't block preemption signal in new M's or ensureSigM No test because we already have a test in the syscall package. The issue reports 1 failure per 100,000 iterations, which is rare enough that our builders won't catch the problem. For #52226 Fixes #52374 Change-Id: I17633ff6cf676b6d575356186dce42cdacad0746 Reviewed-on: https://go-review.googlesource.com/c/go/+/400315 Run-TryBot: Ian Lance Taylor TryBot-Result: Gopher Robot Reviewed-by: Michael Knyszek Reviewed-by: Ian Lance Taylor (cherry picked from commit e3982660a73b04a87c08215cb5aaa16d816ea573) Reviewed-on: https://go-review.googlesource.com/c/go/+/400317 Reviewed-by: Austin Clements --- src/runtime/signal_unix.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 6096760b50..33c3f2ee65 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -1151,6 +1151,7 @@ func unminitSignals() { // blockableSig reports whether sig may be blocked by the signal mask. // We never want to block the signals marked _SigUnblock; // these are the synchronous signals that turn into a Go panic. +// We never want to block the preemption signal if it is being used. // In a Go program--not a c-archive/c-shared--we never want to block // the signals marked _SigKill or _SigThrow, as otherwise it's possible // for all running threads to block them and delay their delivery until @@ -1161,6 +1162,9 @@ func blockableSig(sig uint32) bool { if flags&_SigUnblock != 0 { return false } + if sig == sigPreempt && preemptMSupported && debug.asyncpreemptoff == 0 { + return false + } if isarchive || islibrary { return true } -- cgit v1.2.3-54-g00ecf From 4c5acd4b5729e3345a35ce43a8633d24dc1e42fc Mon Sep 17 00:00:00 2001 From: Maisem Ali Date: Mon, 21 Mar 2022 17:43:45 +0000 Subject: [release-branch.go1.17] net/http/httptest: fix race in Server.Close When run with race detector the test fails without the fix. For #51799 Fixes #52455 Change-Id: I273adb6d3a2b1e0d606b9c27ab4c6a9aa4aa8064 GitHub-Last-Rev: a5ddd146a2a65f2e817eed5133449c79b3af2562 GitHub-Pull-Request: golang/go#51805 Reviewed-on: https://go-review.googlesource.com/c/go/+/393974 Reviewed-by: Damien Neil Reviewed-by: Brad Fitzpatrick Trust: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick (cherry picked from commit 1d19cea740a5a044848aaab3dc119f60c947be1d) Reviewed-on: https://go-review.googlesource.com/c/go/+/401318 Reviewed-by: David Chase --- src/net/http/httptest/server.go | 29 ++++++++----------- src/net/http/httptest/server_test.go | 54 ++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 18 deletions(-) diff --git a/src/net/http/httptest/server.go b/src/net/http/httptest/server.go index 4f85ff55d8..1c0c0f6987 100644 --- a/src/net/http/httptest/server.go +++ b/src/net/http/httptest/server.go @@ -317,21 +317,17 @@ func (s *Server) wrap() { s.mu.Lock() defer s.mu.Unlock() - // Keep Close from returning until the user's ConnState hook - // (if any) finishes. Without this, the call to forgetConn - // below might send the count to 0 before we run the hook. - s.wg.Add(1) - defer s.wg.Done() - switch cs { case http.StateNew: - s.wg.Add(1) if _, exists := s.conns[c]; exists { panic("invalid state transition") } if s.conns == nil { s.conns = make(map[net.Conn]http.ConnState) } + // Add c to the set of tracked conns and increment it to the + // waitgroup. + s.wg.Add(1) s.conns[c] = cs if s.closed { // Probably just a socket-late-binding dial from @@ -358,7 +354,14 @@ func (s *Server) wrap() { s.closeConn(c) } case http.StateHijacked, http.StateClosed: - s.forgetConn(c) + // Remove c from the set of tracked conns and decrement it from the + // waitgroup, unless it was previously removed. + if _, ok := s.conns[c]; ok { + delete(s.conns, c) + // Keep Close from returning until the user's ConnState hook + // (if any) finishes. + defer s.wg.Done() + } } if oldHook != nil { oldHook(c, cs) @@ -378,13 +381,3 @@ func (s *Server) closeConnChan(c net.Conn, done chan<- struct{}) { done <- struct{}{} } } - -// forgetConn removes c from the set of tracked conns and decrements it from the -// waitgroup, unless it was previously removed. -// s.mu must be held. -func (s *Server) forgetConn(c net.Conn) { - if _, ok := s.conns[c]; ok { - delete(s.conns, c) - s.wg.Done() - } -} diff --git a/src/net/http/httptest/server_test.go b/src/net/http/httptest/server_test.go index 39568b358c..5313f65456 100644 --- a/src/net/http/httptest/server_test.go +++ b/src/net/http/httptest/server_test.go @@ -9,6 +9,7 @@ import ( "io" "net" "net/http" + "sync" "testing" ) @@ -203,6 +204,59 @@ func TestServerZeroValueClose(t *testing.T) { ts.Close() // tests that it doesn't panic } +// Issue 51799: test hijacking a connection and then closing it +// concurrently with closing the server. +func TestCloseHijackedConnection(t *testing.T) { + hijacked := make(chan net.Conn) + ts := NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + defer close(hijacked) + hj, ok := w.(http.Hijacker) + if !ok { + t.Fatal("failed to hijack") + } + c, _, err := hj.Hijack() + if err != nil { + t.Fatal(err) + } + hijacked <- c + })) + + var wg sync.WaitGroup + wg.Add(1) + go func() { + defer wg.Done() + req, err := http.NewRequest("GET", ts.URL, nil) + if err != nil { + t.Log(err) + } + // Use a client not associated with the Server. + var c http.Client + resp, err := c.Do(req) + if err != nil { + t.Log(err) + return + } + resp.Body.Close() + }() + + wg.Add(1) + conn := <-hijacked + go func(conn net.Conn) { + defer wg.Done() + // Close the connection and then inform the Server that + // we closed it. + conn.Close() + ts.Config.ConnState(conn, http.StateClosed) + }(conn) + + wg.Add(1) + go func() { + defer wg.Done() + ts.Close() + }() + wg.Wait() +} + func TestTLSServerWithHTTP2(t *testing.T) { modes := []struct { name string -- cgit v1.2.3-54-g00ecf From 04781d14d2d33acbaf70f77e3a58ae0f3c90757c Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Tue, 12 Apr 2022 13:38:17 -0700 Subject: [release-branch.go1.17] syscall: check correct group in Faccessat The Faccessat call checks the user, group, or other permission bits of a file to see if the calling process can access it. The test to see if the group permissions should be used was made with the wrong group id, using the process's group id rather than the file's group id. Fix this to use the correct group id. No test since we cannot easily change file permissions when not running as root and the test is meaningless if running as root. For #52313 Fixes #52439 Change-Id: I4e2c84754b0af7830b40fd15dedcbc58374d75ee Reviewed-on: https://go-review.googlesource.com/c/go/+/399539 Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Gopher Robot (cherry picked from commit f66925e854e71e0c54b581885380a490d7afa30c) Reviewed-on: https://go-review.googlesource.com/c/go/+/401078 Auto-Submit: Tatiana Bradley Run-TryBot: Tatiana Bradley Run-TryBot: Damien Neil Auto-Submit: Damien Neil Reviewed-by: Tatiana Bradley --- src/syscall/syscall_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/syscall/syscall_linux.go b/src/syscall/syscall_linux.go index dfce3d0a4b..3387f3bdc2 100644 --- a/src/syscall/syscall_linux.go +++ b/src/syscall/syscall_linux.go @@ -109,7 +109,7 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { gid = Getgid() } - if uint32(gid) == st.Gid || isGroupMember(gid) { + if uint32(gid) == st.Gid || isGroupMember(int(st.Gid)) { fmode = (st.Mode >> 3) & 7 } else { fmode = st.Mode & 7 -- cgit v1.2.3-54-g00ecf From feec92c42341ce45f00e7f45341e12a7fef78e53 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Mon, 14 Feb 2022 14:57:55 -0800 Subject: [release-branch.go1.17] cmd/compile: drop column info when line number saturates When line number saturates, we can end up getting non-monotonic position info, because the start of the next line after line=lineMax,col=2 is line=lineMax,col=1. Instead, if line==lineMax, make the column always 0 (no column info). If the line number is wrong, having column info probably isn't that helpful. Fixes #52095 Change-Id: If3d90472691b1f6163654f3505e2cb98467f2383 Reviewed-on: https://go-review.googlesource.com/c/go/+/385795 Trust: Keith Randall Reviewed-by: Than McIntosh (cherry picked from commit 1de2344af16125ae2fabed226f2fbb40a150238c) Reviewed-on: https://go-review.googlesource.com/c/go/+/401315 Reviewed-by: Keith Randall Run-TryBot: Keith Randall TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Reviewed-by: Austin Clements --- src/cmd/internal/src/pos.go | 5 ++++- src/cmd/internal/src/pos_test.go | 14 +++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/cmd/internal/src/pos.go b/src/cmd/internal/src/pos.go index b6816a56e0..373a22a7f2 100644 --- a/src/cmd/internal/src/pos.go +++ b/src/cmd/internal/src/pos.go @@ -389,9 +389,12 @@ func makeBogusLico() lico { } func makeLico(line, col uint) lico { - if line > lineMax { + if line >= lineMax { // cannot represent line, use max. line so we have some information line = lineMax + // Drop column information if line number saturates. + // Ensures line+col is monotonic. See issue 51193. + col = 0 } if col > colMax { // cannot represent column, use max. column so we have some information diff --git a/src/cmd/internal/src/pos_test.go b/src/cmd/internal/src/pos_test.go index d4cd0e7ff1..cdf4ab4081 100644 --- a/src/cmd/internal/src/pos_test.go +++ b/src/cmd/internal/src/pos_test.go @@ -140,8 +140,8 @@ func TestLico(t *testing.T) { {makeLico(1, 0), ":1", 1, 0}, {makeLico(1, 1), ":1:1", 1, 1}, {makeLico(2, 3), ":2:3", 2, 3}, - {makeLico(lineMax, 1), fmt.Sprintf(":%d:1", lineMax), lineMax, 1}, - {makeLico(lineMax+1, 1), fmt.Sprintf(":%d:1", lineMax), lineMax, 1}, // line too large, stick with max. line + {makeLico(lineMax, 1), fmt.Sprintf(":%d", lineMax), lineMax, 1}, + {makeLico(lineMax+1, 1), fmt.Sprintf(":%d", lineMax), lineMax, 1}, // line too large, stick with max. line {makeLico(1, colMax), ":1", 1, colMax}, {makeLico(1, colMax+1), ":1", 1, 0}, // column too large {makeLico(lineMax+1, colMax+1), fmt.Sprintf(":%d", lineMax), lineMax, 0}, @@ -170,8 +170,8 @@ func TestIsStmt(t *testing.T) { {makeLico(1, 1), ":1:1" + def, 1, 1}, {makeLico(1, 1).withIsStmt(), ":1:1" + is, 1, 1}, {makeLico(1, 1).withNotStmt(), ":1:1" + not, 1, 1}, - {makeLico(lineMax, 1), fmt.Sprintf(":%d:1", lineMax) + def, lineMax, 1}, - {makeLico(lineMax+1, 1), fmt.Sprintf(":%d:1", lineMax) + def, lineMax, 1}, // line too large, stick with max. line + {makeLico(lineMax, 1), fmt.Sprintf(":%d", lineMax) + def, lineMax, 1}, + {makeLico(lineMax+1, 1), fmt.Sprintf(":%d", lineMax) + def, lineMax, 1}, // line too large, stick with max. line {makeLico(1, colMax), ":1" + def, 1, colMax}, {makeLico(1, colMax+1), ":1" + def, 1, 0}, // column too large {makeLico(lineMax+1, colMax+1), fmt.Sprintf(":%d", lineMax) + def, lineMax, 0}, @@ -214,9 +214,9 @@ func TestLogue(t *testing.T) { {makeLico(1, 1).withXlogue(PosPrologueEnd), ":1:1" + defs + pro, 1, 1}, {makeLico(1, 1).withXlogue(PosEpilogueBegin), ":1:1" + defs + epi, 1, 1}, - {makeLico(lineMax, 1).withXlogue(PosDefaultLogue), fmt.Sprintf(":%d:1", lineMax) + defs + defp, lineMax, 1}, - {makeLico(lineMax, 1).withXlogue(PosPrologueEnd), fmt.Sprintf(":%d:1", lineMax) + defs + pro, lineMax, 1}, - {makeLico(lineMax, 1).withXlogue(PosEpilogueBegin), fmt.Sprintf(":%d:1", lineMax) + defs + epi, lineMax, 1}, + {makeLico(lineMax, 1).withXlogue(PosDefaultLogue), fmt.Sprintf(":%d", lineMax) + defs + defp, lineMax, 1}, + {makeLico(lineMax, 1).withXlogue(PosPrologueEnd), fmt.Sprintf(":%d", lineMax) + defs + pro, lineMax, 1}, + {makeLico(lineMax, 1).withXlogue(PosEpilogueBegin), fmt.Sprintf(":%d", lineMax) + defs + epi, lineMax, 1}, } { x := test.x if got := formatstr("", x.Line(), x.Col(), true) + fmt.Sprintf(":%d:%d", x.IsStmt(), x.Xlogue()); got != test.string { -- cgit v1.2.3-54-g00ecf From 5b45e19a537f88e0c04dfd91c330e2c52b088c1c Mon Sep 17 00:00:00 2001 From: Heschi Kreinick Date: Tue, 26 Apr 2022 12:34:35 -0400 Subject: [release-branch.go1.17] net: skip TestDialCancel on darwin-arm64 We're turning up Macs in a network environment that clashes with this test. I don't think it's critical to get it working, so skip it. For #49149. Fixes #52705. Change-Id: I925e3ecc5356c4cefd208bdcff3d98021215d0b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/402181 Reviewed-by: Alex Rakoczy Run-TryBot: Heschi Kreinick Auto-Submit: Heschi Kreinick TryBot-Result: Gopher Robot (cherry picked from commit 06b0a655a1f46abab2e3c173259ad184b557dd89) Reviewed-on: https://go-review.googlesource.com/c/go/+/405295 Run-TryBot: Dmitri Shuralyov Reviewed-by: Dmitri Shuralyov Reviewed-by: Heschi Kreinick --- src/net/dial_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/net/dial_test.go b/src/net/dial_test.go index 723038c7a2..8f6dd714db 100644 --- a/src/net/dial_test.go +++ b/src/net/dial_test.go @@ -751,6 +751,12 @@ func TestDialerKeepAlive(t *testing.T) { func TestDialCancel(t *testing.T) { mustHaveExternalNetwork(t) + if strings.HasPrefix(testenv.Builder(), "darwin-arm64") { + // The darwin-arm64 machines run in an environment that's not + // compatible with this test. + t.Skipf("builder %q gives no route to host for 198.18.0.0", testenv.Builder()) + } + blackholeIPPort := JoinHostPort(slowDst4, "1234") if !supportsIPv4() { blackholeIPPort = JoinHostPort(slowDst6, "1234") -- cgit v1.2.3-54-g00ecf From f7209f904d45b4c5426cb76992066cdd1cc2f74e Mon Sep 17 00:00:00 2001 From: Heschi Kreinick Date: Tue, 10 May 2022 10:49:40 -0400 Subject: [release-branch.go1.17] cmd/objdump: skip TestDisasm* on darwin-arm64 The macOS 12 builders have an incompatible version of XCode installed. We fixed the bug on 1.18 but not 1.17. Updates #49700. Change-Id: Id356786aad351568ba6665430f093f5f78bb4357 Reviewed-on: https://go-review.googlesource.com/c/go/+/405474 Reviewed-by: David Chase Reviewed-by: Dmitri Shuralyov Reviewed-by: Dmitri Shuralyov --- src/cmd/objdump/objdump_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cmd/objdump/objdump_test.go b/src/cmd/objdump/objdump_test.go index f231a7c6e0..1ce21c46ab 100644 --- a/src/cmd/objdump/objdump_test.go +++ b/src/cmd/objdump/objdump_test.go @@ -106,6 +106,9 @@ var ppcGnuNeed = []string{ } func mustHaveDisasm(t *testing.T) { + if strings.HasPrefix(testenv.Builder(), "darwin-arm64") { + t.Skipf("builder %q has an incompatible version of XCode installed, see go.dev/issue/49700", testenv.Builder()) + } switch runtime.GOARCH { case "mips", "mipsle", "mips64", "mips64le": t.Skipf("skipping on %s, issue 12559", runtime.GOARCH) -- cgit v1.2.3-54-g00ecf From 085c61ae517110168841be0afeb8f883d66fe95a Mon Sep 17 00:00:00 2001 From: Heschi Kreinick Date: Tue, 10 May 2022 11:37:53 -0400 Subject: [release-branch.go1.17] go1.17.10 Change-Id: I601b16bea35c7c468b25a1c6e817e0a9af0b531f Reviewed-on: https://go-review.googlesource.com/c/go/+/405478 TryBot-Result: Gopher Robot Run-TryBot: Heschi Kreinick Reviewed-by: David Chase --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 699d953a7f..d1ab52a8a2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -go1.17.9 \ No newline at end of file +go1.17.10 \ No newline at end of file -- cgit v1.2.3-54-g00ecf