summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:22:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:22:03 +0000
commit52b4757d798fb3fa2072230515c3ca1e22635941 (patch)
tree359ed7901c3ea0075b5cbee1aad4f48eb8ee3a31
parentAdding upstream version 1.21.8. (diff)
downloadgolang-1.21-upstream/1.21.9.tar.xz
golang-1.21-upstream/1.21.9.zip
Adding upstream version 1.21.9.upstream/1.21.9
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r--VERSION4
-rw-r--r--src/cmd/compile/internal/types2/typeset.go11
-rw-r--r--src/cmd/go/testdata/script/test_ppc64_linker_funcs.txt4
-rw-r--r--src/cmd/internal/moddeps/moddeps_test.go2
-rw-r--r--src/cmd/internal/obj/ppc64/obj9.go19
-rw-r--r--src/cmd/link/internal/ppc64/asm.go17
-rw-r--r--src/go.mod2
-rw-r--r--src/go.sum4
-rw-r--r--src/go/types/typeset.go11
-rw-r--r--src/internal/types/testdata/fixedbugs/issue66064.go15
-rw-r--r--src/net/http/h2_bundle.go33
-rw-r--r--src/vendor/modules.txt2
12 files changed, 88 insertions, 36 deletions
diff --git a/VERSION b/VERSION
index bb16977..88ae476 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-go1.21.8
-time 2024-02-29T18:18:48Z
+go1.21.9
+time 2024-03-29T15:27:02Z
diff --git a/src/cmd/compile/internal/types2/typeset.go b/src/cmd/compile/internal/types2/typeset.go
index 8d33597..14039ac 100644
--- a/src/cmd/compile/internal/types2/typeset.go
+++ b/src/cmd/compile/internal/types2/typeset.go
@@ -255,9 +255,8 @@ func computeInterfaceTypeSet(check *Checker, pos syntax.Pos, ityp *Interface) *_
allTerms := allTermlist
allComparable := false
for i, typ := range ityp.embeddeds {
- // The embedding position is nil for imported interfaces
- // and also for interface copies after substitution (but
- // in that case we don't need to report errors again).
+ // The embedding position is nil for imported interfaces.
+ // We don't need to do version checks in those cases.
var pos syntax.Pos // embedding position
if ityp.embedPos != nil {
pos = (*ityp.embedPos)[i]
@@ -270,7 +269,7 @@ func computeInterfaceTypeSet(check *Checker, pos syntax.Pos, ityp *Interface) *_
assert(!isTypeParam(typ))
tset := computeInterfaceTypeSet(check, pos, u)
// If typ is local, an error was already reported where typ is specified/defined.
- if check != nil && check.isImportedConstraint(typ) && !check.verifyVersionf(pos, go1_18, "embedding constraint interface %s", typ) {
+ if pos.IsKnown() && check != nil && check.isImportedConstraint(typ) && !check.verifyVersionf(pos, go1_18, "embedding constraint interface %s", typ) {
continue
}
comparable = tset.comparable
@@ -279,7 +278,7 @@ func computeInterfaceTypeSet(check *Checker, pos syntax.Pos, ityp *Interface) *_
}
terms = tset.terms
case *Union:
- if check != nil && !check.verifyVersionf(pos, go1_18, "embedding interface element %s", u) {
+ if pos.IsKnown() && check != nil && !check.verifyVersionf(pos, go1_18, "embedding interface element %s", u) {
continue
}
tset := computeUnionTypeSet(check, unionSets, pos, u)
@@ -293,7 +292,7 @@ func computeInterfaceTypeSet(check *Checker, pos syntax.Pos, ityp *Interface) *_
if u == Typ[Invalid] {
continue
}
- if check != nil && !check.verifyVersionf(pos, go1_18, "embedding non-interface type %s", typ) {
+ if pos.IsKnown() && check != nil && !check.verifyVersionf(pos, go1_18, "embedding non-interface type %s", typ) {
continue
}
terms = termlist{{false, typ}}
diff --git a/src/cmd/go/testdata/script/test_ppc64_linker_funcs.txt b/src/cmd/go/testdata/script/test_ppc64_linker_funcs.txt
index 735b5dc..d789f89 100644
--- a/src/cmd/go/testdata/script/test_ppc64_linker_funcs.txt
+++ b/src/cmd/go/testdata/script/test_ppc64_linker_funcs.txt
@@ -14,6 +14,10 @@ go build -ldflags='-linkmode=internal'
exec ./abitest
stdout success
+go build -buildmode=pie -o abitest.pie -ldflags='-linkmode=internal'
+exec ./abitest.pie
+stdout success
+
-- go.mod --
module abitest
diff --git a/src/cmd/internal/moddeps/moddeps_test.go b/src/cmd/internal/moddeps/moddeps_test.go
index ae890b6..718e120 100644
--- a/src/cmd/internal/moddeps/moddeps_test.go
+++ b/src/cmd/internal/moddeps/moddeps_test.go
@@ -33,6 +33,8 @@ import (
// See issues 36852, 41409, and 43687.
// (Also see golang.org/issue/27348.)
func TestAllDependencies(t *testing.T) {
+ t.Skip("TODO(#65051): 1.21.9 contains unreleased changes from vendored modules")
+
goBin := testenv.GoToolPath(t)
// Ensure that all packages imported within GOROOT
diff --git a/src/cmd/internal/obj/ppc64/obj9.go b/src/cmd/internal/obj/ppc64/obj9.go
index 02831b8..57660ce 100644
--- a/src/cmd/internal/obj/ppc64/obj9.go
+++ b/src/cmd/internal/obj/ppc64/obj9.go
@@ -36,8 +36,25 @@ import (
"cmd/internal/sys"
"internal/abi"
"log"
+ "strings"
)
+// Is this a symbol which should never have a TOC prologue generated?
+// These are special functions which should not have a TOC regeneration
+// prologue.
+func isNOTOCfunc(name string) bool {
+ switch {
+ case name == "runtime.duffzero":
+ return true
+ case name == "runtime.duffcopy":
+ return true
+ case strings.HasPrefix(name, "runtime.elf_"):
+ return true
+ default:
+ return false
+ }
+}
+
func progedit(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) {
p.From.Class = 0
p.To.Class = 0
@@ -643,7 +660,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
q = p
- if NeedTOCpointer(c.ctxt) && c.cursym.Name != "runtime.duffzero" && c.cursym.Name != "runtime.duffcopy" {
+ if NeedTOCpointer(c.ctxt) && !isNOTOCfunc(c.cursym.Name) {
// When compiling Go into PIC, without PCrel support, all functions must start
// with instructions to load the TOC pointer into r2:
//
diff --git a/src/cmd/link/internal/ppc64/asm.go b/src/cmd/link/internal/ppc64/asm.go
index d537bc5..3def3e6 100644
--- a/src/cmd/link/internal/ppc64/asm.go
+++ b/src/cmd/link/internal/ppc64/asm.go
@@ -475,24 +475,9 @@ func rewriteABIFuncReloc(ctxt *ld.Link, ldr *loader.Loader, tname string, r load
r.SetAdd(int64((n - minReg) * offMul))
firstUse = !ldr.AttrReachable(ts)
if firstUse {
- ldr.SetAttrReachable(ts, true)
// This function only becomes reachable now. It has been dropped from
// the text section (it was unreachable until now), it needs included.
- //
- // Similarly, TOC regeneration should not happen for these functions,
- // remove it from this save/restore function.
- if ldr.AttrShared(ts) {
- sb := ldr.MakeSymbolUpdater(ts)
- sb.SetData(sb.Data()[8:])
- sb.SetSize(sb.Size() - 8)
- relocs := sb.Relocs()
- // Only one PCREL reloc to .TOC. should be present.
- if relocs.Count() != 1 {
- log.Fatalf("Unexpected number of relocs in %s\n", ldr.SymName(ts))
- }
- sb.ResetRelocs()
-
- }
+ ldr.SetAttrReachable(ts, true)
}
return ts, firstUse
}
diff --git a/src/go.mod b/src/go.mod
index 3b24053..b647051 100644
--- a/src/go.mod
+++ b/src/go.mod
@@ -4,7 +4,7 @@ go 1.21
require (
golang.org/x/crypto v0.11.1-0.20230711161743-2e82bdd1719d
- golang.org/x/net v0.12.1-0.20231027154334-5ca955b1789c
+ golang.org/x/net v0.12.1-0.20240327214420-1a2eef3ba536
)
require (
diff --git a/src/go.sum b/src/go.sum
index caf8ff0..670b76c 100644
--- a/src/go.sum
+++ b/src/go.sum
@@ -1,7 +1,7 @@
golang.org/x/crypto v0.11.1-0.20230711161743-2e82bdd1719d h1:LiA25/KWKuXfIq5pMIBq1s5hz3HQxhJJSu/SUGlD+SM=
golang.org/x/crypto v0.11.1-0.20230711161743-2e82bdd1719d/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
-golang.org/x/net v0.12.1-0.20231027154334-5ca955b1789c h1:d+VvAxu4S13DWtf73R5eY//VaCk3aUcVdyYjM1SX7zw=
-golang.org/x/net v0.12.1-0.20231027154334-5ca955b1789c/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
+golang.org/x/net v0.12.1-0.20240327214420-1a2eef3ba536 h1:QEPT0Le4+itOUqHbs7yUz5y7FoAOuK1ibDlfTcVguHM=
+golang.org/x/net v0.12.1-0.20240327214420-1a2eef3ba536/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
diff --git a/src/go/types/typeset.go b/src/go/types/typeset.go
index 4cd118a..a7d4485 100644
--- a/src/go/types/typeset.go
+++ b/src/go/types/typeset.go
@@ -253,9 +253,8 @@ func computeInterfaceTypeSet(check *Checker, pos token.Pos, ityp *Interface) *_T
allTerms := allTermlist
allComparable := false
for i, typ := range ityp.embeddeds {
- // The embedding position is nil for imported interfaces
- // and also for interface copies after substitution (but
- // in that case we don't need to report errors again).
+ // The embedding position is nil for imported interfaces.
+ // We don't need to do version checks in those cases.
var pos token.Pos // embedding position
if ityp.embedPos != nil {
pos = (*ityp.embedPos)[i]
@@ -268,7 +267,7 @@ func computeInterfaceTypeSet(check *Checker, pos token.Pos, ityp *Interface) *_T
assert(!isTypeParam(typ))
tset := computeInterfaceTypeSet(check, pos, u)
// If typ is local, an error was already reported where typ is specified/defined.
- if check != nil && check.isImportedConstraint(typ) && !check.verifyVersionf(atPos(pos), go1_18, "embedding constraint interface %s", typ) {
+ if pos.IsValid() && check != nil && check.isImportedConstraint(typ) && !check.verifyVersionf(atPos(pos), go1_18, "embedding constraint interface %s", typ) {
continue
}
comparable = tset.comparable
@@ -277,7 +276,7 @@ func computeInterfaceTypeSet(check *Checker, pos token.Pos, ityp *Interface) *_T
}
terms = tset.terms
case *Union:
- if check != nil && !check.verifyVersionf(atPos(pos), go1_18, "embedding interface element %s", u) {
+ if pos.IsValid() && check != nil && !check.verifyVersionf(atPos(pos), go1_18, "embedding interface element %s", u) {
continue
}
tset := computeUnionTypeSet(check, unionSets, pos, u)
@@ -291,7 +290,7 @@ func computeInterfaceTypeSet(check *Checker, pos token.Pos, ityp *Interface) *_T
if u == Typ[Invalid] {
continue
}
- if check != nil && !check.verifyVersionf(atPos(pos), go1_18, "embedding non-interface type %s", typ) {
+ if pos.IsValid() && check != nil && !check.verifyVersionf(atPos(pos), go1_18, "embedding non-interface type %s", typ) {
continue
}
terms = termlist{{false, typ}}
diff --git a/src/internal/types/testdata/fixedbugs/issue66064.go b/src/internal/types/testdata/fixedbugs/issue66064.go
new file mode 100644
index 0000000..d4a3617
--- /dev/null
+++ b/src/internal/types/testdata/fixedbugs/issue66064.go
@@ -0,0 +1,15 @@
+// -lang=go1.16
+
+// Copyright 2024 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.
+
+//go:build go1.21
+
+package main
+
+import "slices"
+
+func main() {
+ _ = slices.Clone([]string{}) // no error should be reported here
+}
diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go
index dd59e1f..80c0c96 100644
--- a/src/net/http/h2_bundle.go
+++ b/src/net/http/h2_bundle.go
@@ -2966,6 +2966,7 @@ func (fr *http2Framer) readMetaFrame(hf *http2HeadersFrame) (*http2MetaHeadersFr
if size > remainSize {
hdec.SetEmitEnabled(false)
mh.Truncated = true
+ remainSize = 0
return
}
remainSize -= size
@@ -2978,6 +2979,36 @@ func (fr *http2Framer) readMetaFrame(hf *http2HeadersFrame) (*http2MetaHeadersFr
var hc http2headersOrContinuation = hf
for {
frag := hc.HeaderBlockFragment()
+
+ // Avoid parsing large amounts of headers that we will then discard.
+ // If the sender exceeds the max header list size by too much,
+ // skip parsing the fragment and close the connection.
+ //
+ // "Too much" is either any CONTINUATION frame after we've already
+ // exceeded the max header list size (in which case remainSize is 0),
+ // or a frame whose encoded size is more than twice the remaining
+ // header list bytes we're willing to accept.
+ if int64(len(frag)) > int64(2*remainSize) {
+ if http2VerboseLogs {
+ log.Printf("http2: header list too large")
+ }
+ // It would be nice to send a RST_STREAM before sending the GOAWAY,
+ // but the struture of the server's frame writer makes this difficult.
+ return nil, http2ConnectionError(http2ErrCodeProtocol)
+ }
+
+ // Also close the connection after any CONTINUATION frame following an
+ // invalid header, since we stop tracking the size of the headers after
+ // an invalid one.
+ if invalid != nil {
+ if http2VerboseLogs {
+ log.Printf("http2: invalid header: %v", invalid)
+ }
+ // It would be nice to send a RST_STREAM before sending the GOAWAY,
+ // but the struture of the server's frame writer makes this difficult.
+ return nil, http2ConnectionError(http2ErrCodeProtocol)
+ }
+
if _, err := hdec.Write(frag); err != nil {
return nil, http2ConnectionError(http2ErrCodeCompression)
}
@@ -9748,7 +9779,7 @@ func (rl *http2clientConnReadLoop) processData(f *http2DataFrame) error {
})
return nil
}
- if !cs.firstByte {
+ if !cs.pastHeaders {
cc.logf("protocol error: received DATA before a HEADERS frame")
rl.endStreamError(cs, http2StreamError{
StreamID: f.StreamID,
diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt
index 4de656b..bfb8ca2 100644
--- a/src/vendor/modules.txt
+++ b/src/vendor/modules.txt
@@ -7,7 +7,7 @@ golang.org/x/crypto/cryptobyte/asn1
golang.org/x/crypto/hkdf
golang.org/x/crypto/internal/alias
golang.org/x/crypto/internal/poly1305
-# golang.org/x/net v0.12.1-0.20231027154334-5ca955b1789c
+# golang.org/x/net v0.12.1-0.20240327214420-1a2eef3ba536
## explicit; go 1.17
golang.org/x/net/dns/dnsmessage
golang.org/x/net/http/httpguts