Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update go1.22.5 #91

Merged
merged 16 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
b515c52
[release-branch.go1.22] go/internal/gccgoimporter: recognize "any" as…
ianlancetaylor Oct 23, 2023
fe9b3c3
[release-branch.go1.22] net: add GODEBUG=netedns0=0 to disable sendin…
ianlancetaylor Jun 11, 2024
179ccb7
[release-branch.go1.22] cmd/go: fix go list -u -m all with too new re…
samthanawalla May 20, 2024
4c97e88
[release-branch.go1.22] cmd/link: put runtime.end in the last section…
cherrymui Jun 11, 2024
ab60a7b
[release-branch.go1.22] cmd/cgo/internal/testsanitizers: make the lib…
mknyszek May 29, 2024
14f0251
[release-branch.go1.22] cmd/cgo/internal/swig: force use of lld for L…
mknyszek May 30, 2024
81fc616
[release-branch.go1.22] crypto/tls: don't call tlsrsakex.IncNonDefaul…
michaelbeaumont Apr 29, 2024
11b861e
[release-branch.go1.22] go/types, types2: report error for floating-p…
griesemer Apr 22, 2024
5159a71
[release-branch.go1.22] cmd/compile: put constants before variables i…
randall77 Mar 28, 2024
3560cf0
[release-branch.go1.22] runtime: always update stack bounds on cgocal…
prattmic May 9, 2024
dfe4dbf
[release-branch.go1.22] os/exec: on Windows look for extensions in Ru…
qiulaidongfeng Jun 5, 2024
ceaf26e
[release-branch.go1.22] cmd/compile: mark pointer to noalg type as noalg
wdvxdr1123 Feb 27, 2024
3222951
[release-branch.go1.22] net/http: send body or close connection on ex…
neild Jun 6, 2024
c2d4f85
[release-branch.go1.22] cmd/link: handle dynamic import variables on …
cherrymui Jun 17, 2024
8e1fdea
[release-branch.go1.22] go1.22.5
gopherbot Jul 2, 2024
d5cf403
Merge remote-tracking branch 'go/release-branch.go1.22' into update-g…
awly Jul 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
go1.22.4
time 2024-05-30T19:26:07Z
go1.22.5
time 2024-06-27T20:11:12Z
7 changes: 7 additions & 0 deletions doc/godebug.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,13 @@ Go 1.19 made it an error for path lookups to resolve to binaries in the current
controlled by the [`execerrdot` setting](/pkg/os/exec#hdr-Executables_in_the_current_directory).
There is no plan to remove this setting.

Go 1.19 started sending EDNS0 additional headers on DNS requests.
This can reportedly break the DNS server provided on some routers,
such as CenturyLink Zyxel C3000Z.
This can be changed by the [`netedns0` setting](/pkg/net#hdr-Name_Resolution).
This setting is available in Go 1.21.12, Go 1.22.5, Go 1.23, and later.
There is no plan to remove this setting.

### Go 1.18

Go 1.18 removed support for SHA1 in most X.509 certificates,
Expand Down
9 changes: 8 additions & 1 deletion src/cmd/cgo/internal/swig/swig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,18 @@ func run(t *testing.T, dir string, lto bool, args ...string) {
cmd := exec.Command("go", runArgs...)
cmd.Dir = dir
if lto {
// On the builders we're using the default /usr/bin/ld, but
// that has problems when asking for LTO in particular. Force
// use of lld, which ships with our clang installation.
extraLDFlags := ""
if strings.Contains(testenv.Builder(), "clang") {
extraLDFlags += " -fuse-ld=lld"
}
const cflags = "-flto -Wno-lto-type-mismatch -Wno-unknown-warning-option"
cmd.Env = append(cmd.Environ(),
"CGO_CFLAGS="+cflags,
"CGO_CXXFLAGS="+cflags,
"CGO_LDFLAGS="+cflags)
"CGO_LDFLAGS="+cflags+extraLDFlags)
}
out, err := cmd.CombinedOutput()
if string(out) != "OK\n" {
Expand Down
8 changes: 8 additions & 0 deletions src/cmd/cgo/internal/testplugin/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,11 @@ func TestTextSectionSplit(t *testing.T) {
t.Errorf("runtime.text.1 not found, text section not split?")
}
}

func TestIssue67976(t *testing.T) {
// Issue 67976: build failure with loading a dynimport variable (the runtime/pprof
// package does this on darwin) in a plugin on darwin/amd64.
// The test program uses runtime/pprof in a plugin.
globalSkip(t)
goCmd(t, "build", "-buildmode=plugin", "-o", "issue67976.so", "./issue67976/plugin.go")
}
16 changes: 16 additions & 0 deletions src/cmd/cgo/internal/testplugin/testdata/issue67976/plugin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,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.

package main

import (
"io"
"runtime/pprof"
)

func main() {}

func Start() {
pprof.StartCPUProfile(io.Discard)
}
5 changes: 5 additions & 0 deletions src/cmd/cgo/internal/testsanitizers/libfuzzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ import (
)

func TestLibFuzzer(t *testing.T) {
// Skip tests in short mode.
if testing.Short() {
t.Skip("libfuzzer tests can take upwards of minutes to run; skipping in short mode")
}
testenv.MustHaveGoBuild(t)
testenv.MustHaveCGO(t)

goos, err := goEnv("GOOS")
if err != nil {
t.Fatal(err)
Expand Down
3 changes: 3 additions & 0 deletions src/cmd/compile/internal/types/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,9 @@ func NewPtr(elem *Type) *Type {
if elem.HasShape() {
t.SetHasShape(true)
}
if elem.Noalg() {
t.SetNoalg(true)
}
return t
}

Expand Down
8 changes: 8 additions & 0 deletions src/cmd/compile/internal/types2/initorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,14 @@ func (a nodeQueue) Swap(i, j int) {

func (a nodeQueue) Less(i, j int) bool {
x, y := a[i], a[j]

// Prioritize all constants before non-constants. See go.dev/issue/66575/.
_, xConst := x.obj.(*Const)
_, yConst := y.obj.(*Const)
if xConst != yConst {
return xConst
}

// nodes are prioritized by number of incoming dependencies (1st key)
// and source order (2nd key)
return x.ndeps < y.ndeps || x.ndeps == y.ndeps && x.obj.order() < y.obj.order()
Expand Down
59 changes: 41 additions & 18 deletions src/cmd/compile/internal/types2/stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ func (check *Checker) rangeStmt(inner stmtContext, s *syntax.ForStmt, rclause *s
lhs := [2]Expr{sKey, sValue} // sKey, sValue may be nil
rhs := [2]Type{key, val} // key, val may be nil

constIntRange := x.mode == constant_ && isInteger(x.typ)
rangeOverInt := isInteger(x.typ)

if isDef {
// short variable declaration
Expand All @@ -927,19 +927,27 @@ func (check *Checker) rangeStmt(inner stmtContext, s *syntax.ForStmt, rclause *s
check.errorf(lhs, InvalidSyntaxTree, "cannot declare %s", lhs)
obj = NewVar(lhs.Pos(), check.pkg, "_", nil) // dummy variable
}
assert(obj.typ == nil)

// initialize lhs variable
if constIntRange {
check.initVar(obj, &x, "range clause")
} else if typ := rhs[i]; typ != nil {
x.mode = value
x.expr = lhs // we don't have a better rhs expression to use here
x.typ = typ
check.initVar(obj, &x, "assignment") // error is on variable, use "assignment" not "range clause"
} else {
// initialize lhs iteration variable, if any
typ := rhs[i]
if typ == nil {
obj.typ = Typ[Invalid]
obj.used = true // don't complain about unused variable
continue
}

if rangeOverInt {
assert(i == 0) // at most one iteration variable (rhs[1] == nil for rangeOverInt)
check.initVar(obj, &x, "range clause")
} else {
var y operand
y.mode = value
y.expr = lhs // we don't have a better rhs expression to use here
y.typ = typ
check.initVar(obj, &y, "assignment") // error is on variable, use "assignment" not "range clause"
}
assert(obj.typ != nil)
}

// declare variables
Expand All @@ -958,21 +966,36 @@ func (check *Checker) rangeStmt(inner stmtContext, s *syntax.ForStmt, rclause *s
continue
}

if constIntRange {
// assign to lhs iteration variable, if any
typ := rhs[i]
if typ == nil {
continue
}

if rangeOverInt {
assert(i == 0) // at most one iteration variable (rhs[1] == nil for rangeOverInt)
check.assignVar(lhs, nil, &x, "range clause")
} else if typ := rhs[i]; typ != nil {
x.mode = value
x.expr = lhs // we don't have a better rhs expression to use here
x.typ = typ
check.assignVar(lhs, nil, &x, "assignment") // error is on variable, use "assignment" not "range clause"
// If the assignment succeeded, if x was untyped before, it now
// has a type inferred via the assignment. It must be an integer.
// (go.dev/issues/67027)
if x.mode != invalid && !isInteger(x.typ) {
check.softErrorf(lhs, InvalidRangeExpr, "cannot use iteration variable of type %s", x.typ)
}
} else {
var y operand
y.mode = value
y.expr = lhs // we don't have a better rhs expression to use here
y.typ = typ
check.assignVar(lhs, nil, &y, "assignment") // error is on variable, use "assignment" not "range clause"
}
}
} else if constIntRange {
} else if rangeOverInt {
// If we don't have any iteration variables, we still need to
// check that a (possibly untyped) integer range expression x
// is valid.
// We do this by checking the assignment _ = x. This ensures
// that an untyped x can be converted to a value of type int.
// that an untyped x can be converted to a value of its default
// type (rune or int).
check.assignment(&x, nil, "range clause")
}

Expand Down
23 changes: 15 additions & 8 deletions src/cmd/go/internal/modload/modfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func CheckRetractions(ctx context.Context, m module.Version) (err error) {
return err
}
summary, err := rawGoModSummary(rm)
if err != nil {
if err != nil && !errors.Is(err, gover.ErrTooNew) {
return err
}

Expand Down Expand Up @@ -298,7 +298,7 @@ func CheckDeprecation(ctx context.Context, m module.Version) (deprecation string
return "", err
}
summary, err := rawGoModSummary(latest)
if err != nil {
if err != nil && !errors.Is(err, gover.ErrTooNew) {
return "", err
}
return summary.deprecated, nil
Expand Down Expand Up @@ -644,6 +644,8 @@ func goModSummary(m module.Version) (*modFileSummary, error) {
// its dependencies.
//
// rawGoModSummary cannot be used on the main module outside of workspace mode.
// The modFileSummary can still be used for retractions and deprecations
// even if a TooNewError is returned.
func rawGoModSummary(m module.Version) (*modFileSummary, error) {
if gover.IsToolchain(m.Path) {
if m.Path == "go" && gover.Compare(m.Version, gover.GoStrictVersion) >= 0 {
Expand Down Expand Up @@ -698,12 +700,7 @@ func rawGoModSummary(m module.Version) (*modFileSummary, error) {
summary.require = append(summary.require, req.Mod)
}
}
if summary.goVersion != "" && gover.Compare(summary.goVersion, gover.GoStrictVersion) >= 0 {
if gover.Compare(summary.goVersion, gover.Local()) > 0 {
return nil, &gover.TooNewError{What: "module " + m.String(), GoVersion: summary.goVersion}
}
summary.require = append(summary.require, module.Version{Path: "go", Version: summary.goVersion})
}

if len(f.Retract) > 0 {
summary.retract = make([]retraction, 0, len(f.Retract))
for _, ret := range f.Retract {
Expand All @@ -714,6 +711,16 @@ func rawGoModSummary(m module.Version) (*modFileSummary, error) {
}
}

// This block must be kept at the end of the function because the summary may
// be used for reading retractions or deprecations even if a TooNewError is
// returned.
if summary.goVersion != "" && gover.Compare(summary.goVersion, gover.GoStrictVersion) >= 0 {
summary.require = append(summary.require, module.Version{Path: "go", Version: summary.goVersion})
if gover.Compare(summary.goVersion, gover.Local()) > 0 {
return summary, &gover.TooNewError{What: "module " + m.String(), GoVersion: summary.goVersion}
}
}

return summary, nil
})
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- .mod --
module example.com/retract/newergoversion

go 1.21

-- .info --
{"Version":"v1.0.0"}

-- retract.go --
package newergoversion
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- .mod --
module example.com/retract/newergoversion

go 1.23

retract v1.2.0

-- .info --
{"Version":"v1.2.0"}

-- retract.go --
package newergoversion
20 changes: 20 additions & 0 deletions src/cmd/go/testdata/script/list_retractions_issue66403.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# For issue #66403, go list -u -m all should not fail if a module
# with retractions has a newer version.

env TESTGO_VERSION=go1.21
env TESTGO_VERSION_SWITCH=switch
go list -u -m example.com/retract/newergoversion
stdout 'example.com/retract/newergoversion v1.0.0'
! stdout 'v1.2.0'

-- go.mod --
module example.com/m

go 1.22

require example.com/retract/newergoversion v1.0.0

-- main.go --
package main

import _ "example.com/retract/newergoversion"
28 changes: 28 additions & 0 deletions src/cmd/go/testdata/script/test_fuzz_cgo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[!fuzz] skip
[!cgo] skip
[short] skip
env GOCACHE=$WORK/cache

# Test that fuzzing works with cgo (issue 65169)

go test -fuzz=. -fuzztime=1x
stdout ok
! stdout FAIL

-- go.mod --
module example.com/p

go 1.20
-- c.go --
package p

import "C"
-- c_test.go --
package p

import "testing"

func Fuzz(f *testing.F) {
f.Add(0)
f.Fuzz(func(t *testing.T, x int) {})
}
7 changes: 7 additions & 0 deletions src/cmd/link/internal/amd64/asm.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,13 @@ func adddynrel(target *ld.Target, ldr *loader.Loader, syms *ld.ArchSyms, s loade
// (e.g. go version).
return true
}
case objabi.R_GOTPCREL:
if target.IsExternal() {
// External linker will do this relocation.
return true
}
// We only need to handle external linking mode, as R_GOTPCREL can
// only occur in plugin or shared build modes.
}

return false
Expand Down
4 changes: 3 additions & 1 deletion src/cmd/link/internal/ld/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -1915,7 +1915,6 @@ func (state *dodataState) allocateDataSections(ctxt *Link) {
sect = state.allocateNamedSectionAndAssignSyms(&Segdata, ".noptrbss", sym.SNOPTRBSS, sym.Sxxx, 06)
ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.noptrbss", 0), sect)
ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.enoptrbss", 0), sect)
ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.end", 0), sect)

// Code coverage counters are assigned to the .noptrbss section.
// We assign them in a separate pass so that they stay aggregated
Expand All @@ -1935,6 +1934,9 @@ func (state *dodataState) allocateDataSections(ctxt *Link) {
ldr.SetSymSect(ldr.LookupOrCreateSym("internal/fuzz._ecounters", 0), sect)
}

// Assign runtime.end to the last section of data segment.
ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.end", 0), Segdata.Sections[len(Segdata.Sections)-1])

if len(state.data[sym.STLSBSS]) > 0 {
var sect *sym.Section
// FIXME: not clear why it is sometimes necessary to suppress .tbss section creation.
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/tls/handshake_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ func (hs *clientHandshakeState) pickCipherSuite() error {
return errors.New("tls: server chose an unconfigured cipher suite")
}

if hs.c.config.CipherSuites == nil && rsaKexCiphers[hs.suite.id] {
if hs.c.config.CipherSuites == nil && !needFIPS() && rsaKexCiphers[hs.suite.id] {
tlsrsakex.IncNonDefault()
}

Expand Down
2 changes: 1 addition & 1 deletion src/crypto/tls/handshake_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func (hs *serverHandshakeState) pickCipherSuite() error {
}
c.cipherSuite = hs.suite.id

if c.config.CipherSuites == nil && rsaKexCiphers[hs.suite.id] {
if c.config.CipherSuites == nil && !needFIPS() && rsaKexCiphers[hs.suite.id] {
tlsrsakex.IncNonDefault()
}

Expand Down
2 changes: 2 additions & 0 deletions src/go/internal/gccgoimporter/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@ const (
gccgoBuiltinERROR = 19
gccgoBuiltinBYTE = 20
gccgoBuiltinRUNE = 21
gccgoBuiltinANY = 22
)

func lookupBuiltinType(typ int) types.Type {
Expand All @@ -926,6 +927,7 @@ func lookupBuiltinType(typ int) types.Type {
gccgoBuiltinERROR: types.Universe.Lookup("error").Type(),
gccgoBuiltinBYTE: types.Universe.Lookup("byte").Type(),
gccgoBuiltinRUNE: types.Universe.Lookup("rune").Type(),
gccgoBuiltinANY: types.Universe.Lookup("any").Type(),
}[typ]
}

Expand Down
Loading
Loading