diff -Nru golang-1.17-1.17.5/debian/changelog golang-1.17-1.17.6/debian/changelog --- golang-1.17-1.17.5/debian/changelog 2021-12-09 17:00:09.000000000 +0000 +++ golang-1.17-1.17.6/debian/changelog 2022-01-07 11:54:37.000000000 +0000 @@ -1,3 +1,9 @@ +golang-1.17 (1.17.6-1longsleep1+focal) focal; urgency=medium + + * New upstream version 1.17.6 + + -- Simon Eisenmann Fri, 07 Jan 2022 12:54:37 +0100 + golang-1.17 (1.17.5-1longsleep1+focal) focal; urgency=medium * New upstream version 1.17.5 diff -Nru golang-1.17-1.17.5/misc/cgo/testcarchive/carchive_test.go golang-1.17-1.17.6/misc/cgo/testcarchive/carchive_test.go --- golang-1.17-1.17.5/misc/cgo/testcarchive/carchive_test.go 2021-12-09 13:46:37.000000000 +0000 +++ golang-1.17-1.17.6/misc/cgo/testcarchive/carchive_test.go 2022-01-06 19:14:25.000000000 +0000 @@ -10,12 +10,14 @@ "debug/elf" "flag" "fmt" + "io" "log" "os" "os/exec" "path/filepath" "regexp" "runtime" + "strconv" "strings" "syscall" "testing" @@ -263,6 +265,173 @@ } } +// checkArchive verifies that the created library looks OK. +// We just check a couple of things now, we can add more checks as needed. +func checkArchive(t *testing.T, arname string) { + t.Helper() + + switch GOOS { + case "aix", "darwin", "ios", "windows": + // We don't have any checks for non-ELF libraries yet. + if _, err := os.Stat(arname); err != nil { + t.Errorf("archive %s does not exist: %v", arname, err) + } + default: + checkELFArchive(t, arname) + } +} + +// checkELFArchive checks an ELF archive. +func checkELFArchive(t *testing.T, arname string) { + t.Helper() + + f, err := os.Open(arname) + if err != nil { + t.Errorf("archive %s does not exist: %v", arname, err) + return + } + defer f.Close() + + // TODO(iant): put these in a shared package? But where? + const ( + magic = "!\n" + fmag = "`\n" + + namelen = 16 + datelen = 12 + uidlen = 6 + gidlen = 6 + modelen = 8 + sizelen = 10 + fmaglen = 2 + hdrlen = namelen + datelen + uidlen + gidlen + modelen + sizelen + fmaglen + ) + + type arhdr struct { + name string + date string + uid string + gid string + mode string + size string + fmag string + } + + var magbuf [len(magic)]byte + if _, err := io.ReadFull(f, magbuf[:]); err != nil { + t.Errorf("%s: archive too short", arname) + return + } + if string(magbuf[:]) != magic { + t.Errorf("%s: incorrect archive magic string %q", arname, magbuf) + } + + off := int64(len(magic)) + for { + if off&1 != 0 { + var b [1]byte + if _, err := f.Read(b[:]); err != nil { + if err == io.EOF { + break + } + t.Errorf("%s: error skipping alignment byte at %d: %v", arname, off, err) + } + off++ + } + + var hdrbuf [hdrlen]byte + if _, err := io.ReadFull(f, hdrbuf[:]); err != nil { + if err == io.EOF { + break + } + t.Errorf("%s: error reading archive header at %d: %v", arname, off, err) + return + } + + var hdr arhdr + hdrslice := hdrbuf[:] + set := func(len int, ps *string) { + *ps = string(bytes.TrimSpace(hdrslice[:len])) + hdrslice = hdrslice[len:] + } + set(namelen, &hdr.name) + set(datelen, &hdr.date) + set(uidlen, &hdr.uid) + set(gidlen, &hdr.gid) + set(modelen, &hdr.mode) + set(sizelen, &hdr.size) + hdr.fmag = string(hdrslice[:fmaglen]) + hdrslice = hdrslice[fmaglen:] + if len(hdrslice) != 0 { + t.Fatalf("internal error: len(hdrslice) == %d", len(hdrslice)) + } + + if hdr.fmag != fmag { + t.Errorf("%s: invalid fmagic value %q at %d", arname, hdr.fmag, off) + return + } + + size, err := strconv.ParseInt(hdr.size, 10, 64) + if err != nil { + t.Errorf("%s: error parsing size %q at %d: %v", arname, hdr.size, off, err) + return + } + + off += hdrlen + + switch hdr.name { + case "__.SYMDEF", "/", "/SYM64/": + // The archive symbol map. + case "//", "ARFILENAMES/": + // The extended name table. + default: + // This should be an ELF object. + checkELFArchiveObject(t, arname, off, io.NewSectionReader(f, off, size)) + } + + off += size + if _, err := f.Seek(off, os.SEEK_SET); err != nil { + t.Errorf("%s: failed to seek to %d: %v", arname, off, err) + } + } +} + +// checkELFArchiveObject checks an object in an ELF archive. +func checkELFArchiveObject(t *testing.T, arname string, off int64, obj io.ReaderAt) { + t.Helper() + + ef, err := elf.NewFile(obj) + if err != nil { + t.Errorf("%s: failed to open ELF file at %d: %v", arname, off, err) + return + } + defer ef.Close() + + // Verify section types. + for _, sec := range ef.Sections { + want := elf.SHT_NULL + switch sec.Name { + case ".text", ".data": + want = elf.SHT_PROGBITS + case ".bss": + want = elf.SHT_NOBITS + case ".symtab": + want = elf.SHT_SYMTAB + case ".strtab": + want = elf.SHT_STRTAB + case ".init_array": + want = elf.SHT_INIT_ARRAY + case ".fini_array": + want = elf.SHT_FINI_ARRAY + case ".preinit_array": + want = elf.SHT_PREINIT_ARRAY + } + if want != elf.SHT_NULL && sec.Type != want { + t.Errorf("%s: incorrect section type in elf file at %d for section %q: got %v want %v", arname, off, sec.Name, sec.Type, want) + } + } +} + func TestInstall(t *testing.T) { if !testWork { defer os.RemoveAll(filepath.Join(GOPATH, "pkg")) @@ -321,6 +490,7 @@ t.Fatal(err) } checkLineComments(t, "libgo2.h") + checkArchive(t, "libgo2.a") ccArgs := append(cc, "-o", "testp"+exeSuffix, "main2.c", "libgo2.a") if runtime.Compiler == "gccgo" { @@ -361,6 +531,7 @@ t.Fatal(err) } checkLineComments(t, "libgo2.h") + checkArchive(t, "libgo2.a") ccArgs := append(cc, "-o", "testp"+exeSuffix, "main5.c", "libgo2.a") if runtime.Compiler == "gccgo" { @@ -411,6 +582,7 @@ t.Fatal(err) } checkLineComments(t, "libgo2.h") + checkArchive(t, "libgo2.a") ccArgs := append(cc, "-o", "testp"+exeSuffix, "main5.c", "libgo2.a") if runtime.Compiler == "gccgo" { @@ -528,6 +700,7 @@ t.Fatal(err) } checkLineComments(t, "libgo3.h") + checkArchive(t, "libgo3.a") ccArgs := append(cc, "-o", "testp"+exeSuffix, "main3.c", "libgo3.a") if runtime.Compiler == "gccgo" { @@ -565,6 +738,7 @@ t.Fatal(err) } checkLineComments(t, "libgo4.h") + checkArchive(t, "libgo4.a") ccArgs := append(cc, "-o", "testp"+exeSuffix, "main4.c", "libgo4.a") if runtime.Compiler == "gccgo" { @@ -752,6 +926,7 @@ t.Fatal(err) } checkLineComments(t, "libgo6.h") + checkArchive(t, "libgo6.a") ccArgs := append(cc, "-o", "testp6"+exeSuffix, "main6.c", "libgo6.a") if runtime.Compiler == "gccgo" { @@ -795,6 +970,7 @@ t.Fatal(err) } checkLineComments(t, "libgo2.h") + checkArchive(t, "libgo2.a") exe := "./testnoshared" + exeSuffix @@ -899,6 +1075,7 @@ t.Fatal(err) } checkLineComments(t, "libgo7.h") + checkArchive(t, "libgo7.a") ccArgs := append(cc, "-o", "testp7"+exeSuffix, "main7.c", "libgo7.a") if runtime.Compiler == "gccgo" { diff -Nru golang-1.17-1.17.5/src/cmd/compile/internal/ssagen/ssa.go golang-1.17-1.17.6/src/cmd/compile/internal/ssagen/ssa.go --- golang-1.17-1.17.5/src/cmd/compile/internal/ssagen/ssa.go 2021-12-09 13:46:37.000000000 +0000 +++ golang-1.17-1.17.6/src/cmd/compile/internal/ssagen/ssa.go 2022-01-06 19:14:25.000000000 +0000 @@ -5118,6 +5118,18 @@ for _, p := range params.InParams() { // includes receiver for interface calls ACArgs = append(ACArgs, p.Type) } + + // Split the entry block if there are open defers, because later calls to + // openDeferSave may cause a mismatch between the mem for an OpDereference + // and the call site which uses it. See #49282. + if s.curBlock.ID == s.f.Entry.ID && s.hasOpenDefers { + b := s.endBlock() + b.Kind = ssa.BlockPlain + curb := s.f.NewBlock(ssa.BlockPlain) + b.AddEdgeTo(curb) + s.startBlock(curb) + } + for i, n := range args { callArgs = append(callArgs, s.putArg(n, t.Params().Field(i).Type)) } diff -Nru golang-1.17-1.17.5/src/cmd/go.mod golang-1.17-1.17.6/src/cmd/go.mod --- golang-1.17-1.17.5/src/cmd/go.mod 2021-12-09 13:46:37.000000000 +0000 +++ golang-1.17-1.17.6/src/cmd/go.mod 2022-01-06 19:14:25.000000000 +0000 @@ -12,7 +12,7 @@ require ( github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639 // indirect - golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e // indirect + golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e // indirect golang.org/x/sys v0.0.0-20210511113859-b0526f3d8744 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect ) diff -Nru golang-1.17-1.17.5/src/cmd/go.sum golang-1.17-1.17.6/src/cmd/go.sum --- golang-1.17-1.17.5/src/cmd/go.sum 2021-12-09 13:46:37.000000000 +0000 +++ golang-1.17-1.17.6/src/cmd/go.sum 2022-01-06 19:14:25.000000000 +0000 @@ -10,8 +10,8 @@ golang.org/x/arch v0.0.0-20210502124803-cbf565b21d1e/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e h1:8foAy0aoO5GkqCvAEJ4VC4P3zksTg4X4aJCDpZzmgQI= -golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= +golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e h1:1SzTfNOXwIS2oWiMF+6qu0OUDKb0dauo6MoDUQyu+yU= +golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= diff -Nru golang-1.17-1.17.5/src/cmd/link/internal/ld/elf.go golang-1.17-1.17.6/src/cmd/link/internal/ld/elf.go --- golang-1.17-1.17.5/src/cmd/link/internal/ld/elf.go 2021-12-09 13:46:37.000000000 +0000 +++ golang-1.17-1.17.6/src/cmd/link/internal/ld/elf.go 2022-01-06 19:14:25.000000000 +0000 @@ -1084,7 +1084,12 @@ } if sect.Vaddr < sect.Seg.Vaddr+sect.Seg.Filelen { - sh.Type = uint32(elf.SHT_PROGBITS) + switch sect.Name { + case ".init_array": + sh.Type = uint32(elf.SHT_INIT_ARRAY) + default: + sh.Type = uint32(elf.SHT_PROGBITS) + } } else { sh.Type = uint32(elf.SHT_NOBITS) } diff -Nru golang-1.17-1.17.5/src/cmd/vendor/modules.txt golang-1.17-1.17.6/src/cmd/vendor/modules.txt --- golang-1.17-1.17.5/src/cmd/vendor/modules.txt 2021-12-09 13:46:37.000000000 +0000 +++ golang-1.17-1.17.6/src/cmd/vendor/modules.txt 2022-01-06 19:14:25.000000000 +0000 @@ -24,7 +24,7 @@ golang.org/x/arch/arm64/arm64asm golang.org/x/arch/ppc64/ppc64asm golang.org/x/arch/x86/x86asm -# golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e +# golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e ## explicit; go 1.17 golang.org/x/crypto/ed25519 golang.org/x/crypto/ed25519/internal/edwards25519 diff -Nru golang-1.17-1.17.5/src/crypto/x509/x509_test.go golang-1.17-1.17.6/src/crypto/x509/x509_test.go --- golang-1.17-1.17.5/src/crypto/x509/x509_test.go 2021-12-09 13:46:37.000000000 +0000 +++ golang-1.17-1.17.6/src/crypto/x509/x509_test.go 2022-01-06 19:14:25.000000000 +0000 @@ -3216,3 +3216,98 @@ t.Fatalf("ParseCertificate to failed to parse certificate with optional authority key identifier fields: %s", err) } } + +const largeOIDPEM = ` +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + da:ba:53:19:1b:09:4b:82:b2:89:26:7d:c7:6f:a0:02 + Signature Algorithm: sha256WithRSAEncryption + Issuer: O = Acme Co + Validity + Not Before: Dec 21 16:59:27 2021 GMT + Not After : Dec 21 16:59:27 2022 GMT + Subject: O = Acme Co + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public-Key: (2048 bit) + Modulus: + 00:bf:17:16:d8:bc:29:9c:16:e5:76:b4:93:15:78: + ad:6e:45:c5:4a:63:46:a1:b2:76:71:65:51:9c:14: + c4:ea:74:13:e4:34:df:2f:2c:65:11:e8:56:52:69: + 11:f9:0e:fc:77:bb:63:a8:7c:1a:c6:a1:7b:6e:6c: + e7:18:25:25:c9:e8:fb:06:7f:a2:a9:98:fe:2a:bc: + 8a:b3:75:b6:b8:7d:b6:c9:6b:29:08:32:22:10:cb: + 8d:d6:60:c8:83:ad:f5:58:91:d6:11:e8:55:56:fb: + 8f:a3:a2:9f:48:cb:79:e4:65:4a:8c:a6:52:64:9f: + 99:38:35:d4:d5:ac:6f:cf:a0:cb:42:8c:07:eb:21: + 17:31:3a:eb:91:7b:62:43:a4:75:5f:ef:a7:2f:94: + f8:69:0b:d4:ec:09:e6:00:c0:8c:dd:07:63:0b:e4: + 77:aa:60:18:3c:a0:e0:ae:0a:ea:0e:52:3b:b4:fa: + 6a:30:1b:50:62:21:73:53:33:01:60:a1:6b:99:58: + 00:f3:77:c6:0f:46:19:ca:c2:5d:cd:f5:e2:52:4d: + 84:94:23:d3:32:2f:ae:5f:da:43:a1:19:95:d2:17: + dd:49:14:b4:d9:48:1c:08:13:93:8e:d5:09:43:21: + b6:ce:52:e8:87:bb:d2:60:0d:c6:4e:bf:c5:93:6a: + c6:bf + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: critical + Digital Signature, Key Encipherment + X509v3 Extended Key Usage: + TLS Web Server Authentication + X509v3 Basic Constraints: critical + CA:FALSE + X509v3 Subject Alternative Name: + DNS:longOID.example + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.311.21.8.1492336001 + + Signature Algorithm: sha256WithRSAEncryption + 72:77:8b:de:48:fb:6d:9a:94:b1:be:d4:90:7d:4c:e6:d3:79: + fa:fb:fc:3e:d5:3d:e9:a0:ce:28:2b:2f:94:77:3f:87:f8:9c: + 9f:91:1c:f3:f6:58:91:15:6b:24:b9:ca:ae:9f:ee:ca:c8:31: + db:1a:3d:bb:6b:83:6d:bc:81:8b:a1:79:d5:3e:bb:dd:93:fe: + 35:3e:b7:99:e0:d6:eb:58:0c:fd:42:73:dc:49:da:e2:b7:ae: + 15:ee:e6:cc:aa:ef:91:41:9a:18:46:8d:4a:39:65:a2:85:3c: + 7f:0c:41:f8:0b:9c:e8:1f:35:36:60:8d:8c:e0:8e:18:b1:06: + 57:d0:4e:c4:c3:cd:8f:6f:e7:76:02:52:da:03:43:61:2b:b3: + bf:19:fd:73:0d:6a:0b:b4:b6:cb:a9:6f:70:4e:53:2a:54:07: + b3:74:fd:85:49:57:5b:23:8d:8c:6b:53:2b:09:e8:41:a5:80: + 3f:69:1b:11:d1:6b:13:35:2e:f9:d6:50:15:d9:91:38:42:43: + e9:17:af:67:d9:96:a4:d1:6a:4f:cc:b4:a7:8e:48:1f:00:72: + 69:de:4d:f1:73:a4:47:12:67:e9:f9:07:3e:79:75:90:42:b8: + d4:b5:fd:d1:7e:35:04:f7:00:04:cf:f1:36:be:0f:27:81:1f: + a6:ba:88:6c +-----BEGIN CERTIFICATE----- +MIIDHTCCAgWgAwIBAgIRANq6UxkbCUuCsokmfcdvoAIwDQYJKoZIhvcNAQELBQAw +EjEQMA4GA1UEChMHQWNtZSBDbzAeFw0yMTEyMjExNjU5MjdaFw0yMjEyMjExNjU5 +MjdaMBIxEDAOBgNVBAoTB0FjbWUgQ28wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw +ggEKAoIBAQC/FxbYvCmcFuV2tJMVeK1uRcVKY0ahsnZxZVGcFMTqdBPkNN8vLGUR +6FZSaRH5Dvx3u2OofBrGoXtubOcYJSXJ6PsGf6KpmP4qvIqzdba4fbbJaykIMiIQ +y43WYMiDrfVYkdYR6FVW+4+jop9Iy3nkZUqMplJkn5k4NdTVrG/PoMtCjAfrIRcx +OuuRe2JDpHVf76cvlPhpC9TsCeYAwIzdB2ML5HeqYBg8oOCuCuoOUju0+mowG1Bi +IXNTMwFgoWuZWADzd8YPRhnKwl3N9eJSTYSUI9MyL65f2kOhGZXSF91JFLTZSBwI +E5OO1QlDIbbOUuiHu9JgDcZOv8WTasa/AgMBAAGjbjBsMA4GA1UdDwEB/wQEAwIF +oDATBgNVHSUEDDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMBoGA1UdEQQTMBGC +D2xvbmdPSUQuZXhhbXBsZTAbBgNVHSAEFDASMBAGDisGAQQBgjcVCIXHzPsBMA0G +CSqGSIb3DQEBCwUAA4IBAQByd4veSPttmpSxvtSQfUzm03n6+/w+1T3poM4oKy+U +dz+H+JyfkRzz9liRFWskucqun+7KyDHbGj27a4NtvIGLoXnVPrvdk/41PreZ4Nbr +WAz9QnPcSdrit64V7ubMqu+RQZoYRo1KOWWihTx/DEH4C5zoHzU2YI2M4I4YsQZX +0E7Ew82Pb+d2AlLaA0NhK7O/Gf1zDWoLtLbLqW9wTlMqVAezdP2FSVdbI42Ma1Mr +CehBpYA/aRsR0WsTNS751lAV2ZE4QkPpF69n2Zak0WpPzLSnjkgfAHJp3k3xc6RH +Emfp+Qc+eXWQQrjUtf3RfjUE9wAEz/E2vg8ngR+muohs +-----END CERTIFICATE-----` + +func TestLargeOID(t *testing.T) { + // See Issue 49678. + b, _ := pem.Decode([]byte(largeOIDPEM)) + if b == nil { + t.Fatalf("couldn't decode test certificate") + } + _, err := ParseCertificate(b.Bytes) + if err != nil { + t.Fatalf("ParseCertificate to failed to parse certificate with large OID: %s", err) + } +} diff -Nru golang-1.17-1.17.5/src/go.mod golang-1.17-1.17.6/src/go.mod --- golang-1.17-1.17.5/src/go.mod 2021-12-09 13:46:37.000000000 +0000 +++ golang-1.17-1.17.6/src/go.mod 2022-01-06 19:14:25.000000000 +0000 @@ -3,8 +3,8 @@ go 1.17 require ( - golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e - golang.org/x/net v0.0.0-20211209100829-84cba5454caf + golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e + golang.org/x/net v0.0.0-20220106012031-21a9c9cfe9c3 ) require ( diff -Nru golang-1.17-1.17.5/src/go.sum golang-1.17-1.17.6/src/go.sum --- golang-1.17-1.17.5/src/go.sum 2021-12-09 13:46:37.000000000 +0000 +++ golang-1.17-1.17.6/src/go.sum 2022-01-06 19:14:25.000000000 +0000 @@ -1,8 +1,8 @@ -golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e h1:8foAy0aoO5GkqCvAEJ4VC4P3zksTg4X4aJCDpZzmgQI= -golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= +golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e h1:1SzTfNOXwIS2oWiMF+6qu0OUDKb0dauo6MoDUQyu+yU= +golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211209100829-84cba5454caf h1:Chci/BE/+xVqrcWnObL99NS8gtXyJrhHDlygBQrggHM= -golang.org/x/net v0.0.0-20211209100829-84cba5454caf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220106012031-21a9c9cfe9c3 h1:3S9JjS9zI0UiDupLpAuaeuciTu/gEk5jf35rQgqOhXQ= +golang.org/x/net v0.0.0-20220106012031-21a9c9cfe9c3/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210511113859-b0526f3d8744 h1:yhBbb4IRs2HS9PPlAg6DMC6mUOKexJBNsLf4Z+6En1Q= diff -Nru golang-1.17-1.17.5/src/internal/abi/abi.go golang-1.17-1.17.6/src/internal/abi/abi.go --- golang-1.17-1.17.5/src/internal/abi/abi.go 2021-12-09 13:46:37.000000000 +0000 +++ golang-1.17-1.17.6/src/internal/abi/abi.go 2022-01-06 19:14:25.000000000 +0000 @@ -33,6 +33,24 @@ ReturnIsPtr IntArgRegBitmap } +func (r *RegArgs) Dump() { + print("Ints:") + for _, x := range r.Ints { + print(" ", x) + } + println() + print("Floats:") + for _, x := range r.Floats { + print(" ", x) + } + println() + print("Ptrs:") + for _, x := range r.Ptrs { + print(" ", x) + } + println() +} + // IntArgRegBitmap is a bitmap large enough to hold one bit per // integer argument/return register. type IntArgRegBitmap [(IntArgRegs + 7) / 8]uint8 diff -Nru golang-1.17-1.17.5/src/net/http/h2_bundle.go golang-1.17-1.17.6/src/net/http/h2_bundle.go --- golang-1.17-1.17.5/src/net/http/h2_bundle.go 2021-12-09 13:46:37.000000000 +0000 +++ golang-1.17-1.17.6/src/net/http/h2_bundle.go 2022-01-06 19:14:25.000000000 +0000 @@ -9901,7 +9901,8 @@ // Pop dequeues the next frame to write. Returns false if no frames can // be written. Frames with a given wr.StreamID() are Pop'd in the same - // order they are Push'd. No frames should be discarded except by CloseStream. + // order they are Push'd, except RST_STREAM frames. No frames should be + // discarded except by CloseStream. Pop() (wr http2FrameWriteRequest, ok bool) } @@ -9921,6 +9922,7 @@ // stream is the stream on which this frame will be written. // nil for non-stream frames like PING and SETTINGS. + // nil for RST_STREAM streams, which use the StreamError.StreamID field instead. stream *http2stream // done, if non-nil, must be a buffered channel with space for @@ -10600,11 +10602,11 @@ } func (ws *http2randomWriteScheduler) Push(wr http2FrameWriteRequest) { - id := wr.StreamID() - if id == 0 { + if wr.isControl() { ws.zero.push(wr) return } + id := wr.StreamID() q, ok := ws.sq[id] if !ok { q = ws.queuePool.get() @@ -10614,7 +10616,7 @@ } func (ws *http2randomWriteScheduler) Pop() (http2FrameWriteRequest, bool) { - // Control frames first. + // Control and RST_STREAM frames first. if !ws.zero.empty() { return ws.zero.shift(), true } diff -Nru golang-1.17-1.17.5/src/reflect/all_test.go golang-1.17-1.17.6/src/reflect/all_test.go --- golang-1.17-1.17.5/src/reflect/all_test.go 2021-12-09 13:46:37.000000000 +0000 +++ golang-1.17-1.17.6/src/reflect/all_test.go 2022-01-06 19:14:25.000000000 +0000 @@ -6270,6 +6270,29 @@ *CallGC = false } +func TestCallArgLive(t *testing.T) { + type T struct{ X, Y *string } // pointerful aggregate + + F := func(t T) { *t.X = "ok" } + + // In reflect.Value.Call, trigger a garbage collection in reflect.call + // between marshaling argument and the actual call. + *CallGC = true + + x := new(string) + runtime.SetFinalizer(x, func(p *string) { + if *p != "ok" { + t.Errorf("x dead prematurely") + } + }) + v := T{x, nil} + + ValueOf(F).Call([]Value{ValueOf(v)}) + + // Stop garbage collecting during reflect.call. + *CallGC = false +} + func TestMakeFuncStackCopy(t *testing.T) { target := func(in []Value) []Value { runtime.GC() diff -Nru golang-1.17-1.17.5/src/reflect/value.go golang-1.17-1.17.6/src/reflect/value.go --- golang-1.17-1.17.5/src/reflect/value.go 2021-12-09 13:46:37.000000000 +0000 +++ golang-1.17-1.17.6/src/reflect/value.go 2022-01-06 19:14:25.000000000 +0000 @@ -352,7 +352,7 @@ return v.call("CallSlice", in) } -var callGC bool // for testing; see TestCallMethodJump +var callGC bool // for testing; see TestCallMethodJump and TestCallArgLive const debugReflectCall = false @@ -509,12 +509,16 @@ // Copy values to "integer registers." if v.flag&flagIndir != 0 { offset := add(v.ptr, st.offset, "precomputed value offset") - memmove(unsafe.Pointer(®Args.Ints[st.ireg]), offset, st.size) - } else { if st.kind == abiStepPointer { // Duplicate this pointer in the pointer area of the // register space. Otherwise, there's the potential for // this to be the last reference to v.ptr. + regArgs.Ptrs[st.ireg] = *(*unsafe.Pointer)(offset) + } + memmove(unsafe.Pointer(®Args.Ints[st.ireg]), offset, st.size) + } else { + if st.kind == abiStepPointer { + // See the comment in abiStepPointer case above. regArgs.Ptrs[st.ireg] = v.ptr } regArgs.Ints[st.ireg] = uintptr(v.ptr) @@ -539,6 +543,15 @@ // Mark pointers in registers for the return path. regArgs.ReturnIsPtr = abi.outRegPtrs + if debugReflectCall { + regArgs.Dump() + } + + // For testing; see TestCallArgLive. + if callGC { + runtime.GC() + } + // Call. call(frametype, fn, stackArgs, uint32(frametype.size), uint32(abi.retOffset), uint32(frameSize), ®Args) diff -Nru golang-1.17-1.17.5/src/runtime/export_test.go golang-1.17-1.17.6/src/runtime/export_test.go --- golang-1.17-1.17.5/src/runtime/export_test.go 2021-12-09 13:46:37.000000000 +0000 +++ golang-1.17-1.17.6/src/runtime/export_test.go 2022-01-06 19:14:25.000000000 +0000 @@ -1066,7 +1066,19 @@ // // This should not be higher than 0x100*pallocChunkBytes to support // mips and mipsle, which only have 31-bit address spaces. -var BaseChunkIdx = ChunkIdx(chunkIndex(((0xc000*pageAlloc64Bit + 0x100*pageAlloc32Bit) * pallocChunkBytes) + arenaBaseOffset*sys.GoosAix)) +var BaseChunkIdx = func() ChunkIdx { + var prefix uintptr + if pageAlloc64Bit != 0 { + prefix = 0xc000 + } else { + prefix = 0x100 + } + baseAddr := prefix * pallocChunkBytes + if sys.GoosAix != 0 { + baseAddr += arenaBaseOffset + } + return ChunkIdx(chunkIndex(baseAddr)) +}() // PageBase returns an address given a chunk index and a page index // relative to that chunk. diff -Nru golang-1.17-1.17.5/src/runtime/malloc.go golang-1.17-1.17.6/src/runtime/malloc.go --- golang-1.17-1.17.5/src/runtime/malloc.go 2021-12-09 13:46:37.000000000 +0000 +++ golang-1.17-1.17.6/src/runtime/malloc.go 2022-01-06 19:14:25.000000000 +0000 @@ -199,15 +199,21 @@ // we further limit it to 31 bits. // // On ios/arm64, although 64-bit pointers are presumably - // available, pointers are truncated to 33 bits. Furthermore, - // only the top 4 GiB of the address space are actually available - // to the application, but we allow the whole 33 bits anyway for - // simplicity. - // TODO(mknyszek): Consider limiting it to 32 bits and using - // arenaBaseOffset to offset into the top 4 GiB. + // available, pointers are truncated to 33 bits in iOS <14. + // Furthermore, only the top 4 GiB of the address space are + // actually available to the application. In iOS >=14, more + // of the address space is available, and the OS can now + // provide addresses outside of those 33 bits. Pick 40 bits + // as a reasonable balance between address space usage by the + // page allocator, and flexibility for what mmap'd regions + // we'll accept for the heap. We can't just move to the full + // 48 bits because this uses too much address space for older + // iOS versions. + // TODO(mknyszek): Once iOS <14 is deprecated, promote ios/arm64 + // to a 48-bit address space like every other arm64 platform. // // WebAssembly currently has a limit of 4GB linear memory. - heapAddrBits = (_64bit*(1-sys.GoarchWasm)*(1-sys.GoosIos*sys.GoarchArm64))*48 + (1-_64bit+sys.GoarchWasm)*(32-(sys.GoarchMips+sys.GoarchMipsle)) + 33*sys.GoosIos*sys.GoarchArm64 + heapAddrBits = (_64bit*(1-sys.GoarchWasm)*(1-sys.GoosIos*sys.GoarchArm64))*48 + (1-_64bit+sys.GoarchWasm)*(32-(sys.GoarchMips+sys.GoarchMipsle)) + 40*sys.GoosIos*sys.GoarchArm64 // maxAlloc is the maximum size of an allocation. On 64-bit, // it's theoretically possible to allocate 1< 0; i++ { - if i == 4 { + if i == 5 { + return false + } + // Avoid overflowing int on a 32-bit platform. + // We don't want different behavior based on the architecture. + if ret >= 1<<(31-7) { return false } ret <<= 7 diff -Nru golang-1.17-1.17.5/src/vendor/modules.txt golang-1.17-1.17.6/src/vendor/modules.txt --- golang-1.17-1.17.5/src/vendor/modules.txt 2021-12-09 13:46:37.000000000 +0000 +++ golang-1.17-1.17.6/src/vendor/modules.txt 2022-01-06 19:14:25.000000000 +0000 @@ -1,4 +1,4 @@ -# golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e +# golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e ## explicit; go 1.17 golang.org/x/crypto/chacha20 golang.org/x/crypto/chacha20poly1305 @@ -8,7 +8,7 @@ golang.org/x/crypto/hkdf golang.org/x/crypto/internal/subtle golang.org/x/crypto/poly1305 -# golang.org/x/net v0.0.0-20211209100829-84cba5454caf +# golang.org/x/net v0.0.0-20220106012031-21a9c9cfe9c3 ## explicit; go 1.17 golang.org/x/net/dns/dnsmessage golang.org/x/net/http/httpguts diff -Nru golang-1.17-1.17.5/test/fixedbugs/issue49282.go golang-1.17-1.17.6/test/fixedbugs/issue49282.go --- golang-1.17-1.17.5/test/fixedbugs/issue49282.go 1970-01-01 00:00:00.000000000 +0000 +++ golang-1.17-1.17.6/test/fixedbugs/issue49282.go 2022-01-06 19:14:25.000000000 +0000 @@ -0,0 +1,44 @@ +// compile + +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package p + +//go:noinline +func g(d uintptr, a, m []int, s struct { + a, b, c, d, e int +}, u uint) { + _ = a + _ = m + _ = s + func() { + for i := 0; i < 5; i++ { + _ = a + _ = m + _, _ = s, s + } + }() +} + +var One float64 = 1.0 + +func f(d uintptr) { + var a, m []int + var s struct { + a, b, c, d, e int + } + + g(d, a, m, s, uint(One)) // Uint of not-a-constant inserts a conditional, necessary to bug + + defer func() uint { + return 0 + }() +} + +var d uintptr + +func h() { + f(d) +} diff -Nru golang-1.17-1.17.5/VERSION golang-1.17-1.17.6/VERSION --- golang-1.17-1.17.5/VERSION 2021-12-09 13:46:43.000000000 +0000 +++ golang-1.17-1.17.6/VERSION 2022-01-06 19:14:29.000000000 +0000 @@ -1 +1 @@ -go1.17.5 \ No newline at end of file +go1.17.6 \ No newline at end of file