Package: release.debian.org Severity: normal User: release.debian....@packages.debian.org Usertags: unblock X-Debbugs-Cc: golang-1...@packages.debian.org, z...@debian.org Control: affects -1 + src:golang-1.19
Please unblock package golang-1.19 This is a point release for golang 1.19 which happens today. [ Reason ] Update the latest release. [ Impact ] If we can be closer to upstream latest release, it will be easier to backport security patch for bookworm. [ Tests ] Upstream does well tests. And I have tried to use the new version to compile some programs. [ Risks ] The history record for golang point release doesn't show regressions. [ Checklist ] [x] all changes are documented in the d/changelog [x] I reviewed all changes and I approve them [x] attach debdiff against the package in testing [ Other info ] + This package doesn't have autopkgtest. + Many Go packages still record Built-Using field, so this upload will block Go packages from migration. Release team need to rebuild outdated Built-Using. The Go point release or security release may happen several times during freeze. What kind of release can be expected to be unblocked during freeze? unblock golang-1.19/1.19.5-1
diff -Nru golang-1.19-1.19.4/debian/changelog golang-1.19-1.19.5/debian/changelog --- golang-1.19-1.19.4/debian/changelog 2022-12-07 06:10:54.000000000 +0800 +++ golang-1.19-1.19.5/debian/changelog 2023-01-11 15:35:00.000000000 +0800 @@ -1,3 +1,13 @@ +golang-1.19 (1.19.5-1) unstable; urgency=medium + + * Team upload + * Add NO_PNG_PKG_MANGLE to prevent mangling testdata. + This is Ubuntu specific behaviour so they can sync the package without + vendor patch. + * New upstream version 1.19.5 + + -- Shengjing Zhu <z...@debian.org> Wed, 11 Jan 2023 15:35:00 +0800 + golang-1.19 (1.19.4-1) unstable; urgency=medium * New upstream version 1.19.4 diff -Nru golang-1.19-1.19.4/debian/rules golang-1.19-1.19.5/debian/rules --- golang-1.19-1.19.4/debian/rules 2022-12-07 06:10:54.000000000 +0800 +++ golang-1.19-1.19.5/debian/rules 2023-01-11 15:35:00.000000000 +0800 @@ -7,6 +7,9 @@ # for DEB_VERSION_UPSTREAM include /usr/share/dpkg/pkg-info.mk +# Ubuntu mangles png files by default, which can break the testdata. +export NO_PNG_PKG_MANGLE := 1 + export GOVER := $(shell echo $(DEB_VERSION_UPSTREAM) | grep -oP '^([0-9]+\.[0-9]+)') export GOROOT := $(CURDIR) diff -Nru golang-1.19-1.19.4/misc/cgo/testcshared/cshared_test.go golang-1.19-1.19.5/misc/cgo/testcshared/cshared_test.go --- golang-1.19-1.19.4/misc/cgo/testcshared/cshared_test.go 2022-12-02 02:12:53.000000000 +0800 +++ golang-1.19-1.19.5/misc/cgo/testcshared/cshared_test.go 2023-01-10 06:38:01.000000000 +0800 @@ -329,30 +329,46 @@ if err != nil { return fmt.Errorf("unable to find dlltool path: %v\n%s\n", err, out) } - args := []string{strings.TrimSpace(string(out)), "-D", args[6], "-l", libgoname, "-d", "libgo.def"} - - // This is an unfortunate workaround for https://github.com/mstorsjo/llvm-mingw/issues/205 in which - // we basically reimplement the contents of the dlltool.sh wrapper: https://git.io/JZFlU - dlltoolContents, err := os.ReadFile(args[0]) - if err != nil { - return fmt.Errorf("unable to read dlltool: %v\n", err) + dlltoolpath := strings.TrimSpace(string(out)) + if filepath.Ext(dlltoolpath) == "" { + // Some compilers report slash-separated paths without extensions + // instead of ordinary Windows paths. + // Try to find the canonical name for the path. + if lp, err := exec.LookPath(dlltoolpath); err == nil { + dlltoolpath = lp + } } - if bytes.HasPrefix(dlltoolContents, []byte("#!/bin/sh")) && bytes.Contains(dlltoolContents, []byte("llvm-dlltool")) { - base, name := filepath.Split(args[0]) - args[0] = filepath.Join(base, "llvm-dlltool") - var machine string - switch prefix, _, _ := strings.Cut(name, "-"); prefix { - case "i686": - machine = "i386" - case "x86_64": - machine = "i386:x86-64" - case "armv7": - machine = "arm" - case "aarch64": - machine = "arm64" + + args := []string{dlltoolpath, "-D", args[6], "-l", libgoname, "-d", "libgo.def"} + + if filepath.Ext(dlltoolpath) == "" { + // This is an unfortunate workaround for + // https://github.com/mstorsjo/llvm-mingw/issues/205 in which + // we basically reimplement the contents of the dlltool.sh + // wrapper: https://git.io/JZFlU. + // TODO(thanm): remove this workaround once we can upgrade + // the compilers on the windows-arm64 builder. + dlltoolContents, err := os.ReadFile(args[0]) + if err != nil { + return fmt.Errorf("unable to read dlltool: %v\n", err) } - if len(machine) > 0 { - args = append(args, "-m", machine) + if bytes.HasPrefix(dlltoolContents, []byte("#!/bin/sh")) && bytes.Contains(dlltoolContents, []byte("llvm-dlltool")) { + base, name := filepath.Split(args[0]) + args[0] = filepath.Join(base, "llvm-dlltool") + var machine string + switch prefix, _, _ := strings.Cut(name, "-"); prefix { + case "i686": + machine = "i386" + case "x86_64": + machine = "i386:x86-64" + case "armv7": + machine = "arm" + case "aarch64": + machine = "arm64" + } + if len(machine) > 0 { + args = append(args, "-m", machine) + } } } diff -Nru golang-1.19-1.19.4/src/cmd/compile/internal/ssa/gen/ARM64.rules golang-1.19-1.19.5/src/cmd/compile/internal/ssa/gen/ARM64.rules --- golang-1.19-1.19.4/src/cmd/compile/internal/ssa/gen/ARM64.rules 2022-12-02 02:12:54.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/compile/internal/ssa/gen/ARM64.rules 2023-01-10 06:38:01.000000000 +0800 @@ -316,9 +316,9 @@ (FCMPD x (FMOVDconst [0])) => (FCMPD0 x) (FCMPD (FMOVDconst [0]) x) => (InvertFlags (FCMPD0 x)) -// CSEL needs a flag-generating argument. Synthesize a CMPW if necessary. +// CSEL needs a flag-generating argument. Synthesize a TSTW if necessary. (CondSelect x y boolval) && flagArg(boolval) != nil => (CSEL [boolval.Op] x y flagArg(boolval)) -(CondSelect x y boolval) && flagArg(boolval) == nil => (CSEL [OpARM64NotEqual] x y (CMPWconst [0] boolval)) +(CondSelect x y boolval) && flagArg(boolval) == nil => (CSEL [OpARM64NotEqual] x y (TSTWconst [1] boolval)) (OffPtr [off] ptr:(SP)) && is32Bit(off) => (MOVDaddr [int32(off)] ptr) (OffPtr [off] ptr) => (ADDconst [off] ptr) diff -Nru golang-1.19-1.19.4/src/cmd/compile/internal/ssa/gen/LOONG64.rules golang-1.19-1.19.5/src/cmd/compile/internal/ssa/gen/LOONG64.rules --- golang-1.19-1.19.4/src/cmd/compile/internal/ssa/gen/LOONG64.rules 2022-12-02 02:12:54.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/compile/internal/ssa/gen/LOONG64.rules 2023-01-10 06:38:01.000000000 +0800 @@ -392,7 +392,8 @@ (AtomicAdd(32|64) ...) => (LoweredAtomicAdd(32|64) ...) -(AtomicCompareAndSwap(32|64) ...) => (LoweredAtomicCas(32|64) ...) +(AtomicCompareAndSwap32 ptr old new mem) => (LoweredAtomicCas32 ptr (SignExt32to64 old) new mem) +(AtomicCompareAndSwap64 ...) => (LoweredAtomicCas64 ...) // checks (NilCheck ...) => (LoweredNilCheck ...) diff -Nru golang-1.19-1.19.4/src/cmd/compile/internal/ssa/gen/MIPS64.rules golang-1.19-1.19.5/src/cmd/compile/internal/ssa/gen/MIPS64.rules --- golang-1.19-1.19.4/src/cmd/compile/internal/ssa/gen/MIPS64.rules 2022-12-02 02:12:54.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/compile/internal/ssa/gen/MIPS64.rules 2023-01-10 06:38:01.000000000 +0800 @@ -392,7 +392,8 @@ (AtomicAdd(32|64) ...) => (LoweredAtomicAdd(32|64) ...) -(AtomicCompareAndSwap(32|64) ...) => (LoweredAtomicCas(32|64) ...) +(AtomicCompareAndSwap32 ptr old new mem) => (LoweredAtomicCas32 ptr (SignExt32to64 old) new mem) +(AtomicCompareAndSwap64 ...) => (LoweredAtomicCas64 ...) // checks (NilCheck ...) => (LoweredNilCheck ...) diff -Nru golang-1.19-1.19.4/src/cmd/compile/internal/ssa/gen/PPC64Ops.go golang-1.19-1.19.5/src/cmd/compile/internal/ssa/gen/PPC64Ops.go --- golang-1.19-1.19.4/src/cmd/compile/internal/ssa/gen/PPC64Ops.go 2022-12-02 02:12:54.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/compile/internal/ssa/gen/PPC64Ops.go 2023-01-10 06:38:01.000000000 +0800 @@ -11,8 +11,8 @@ // Notes: // - Less-than-64-bit integer types live in the low portion of registers. -// For now, the upper portion is junk; sign/zero-extension might be optimized in the future, but not yet. -// - Boolean types are zero or 1; stored in a byte, but loaded with AMOVBZ so the upper bytes of a register are zero. +// The upper portion is junk. +// - Boolean types are zero or 1; stored in a byte, with upper bytes of the register containing junk. // - *const instructions may use a constant larger than the instruction can encode. // In this case the assembler expands to multiple instructions and uses tmp // register (R31). diff -Nru golang-1.19-1.19.4/src/cmd/compile/internal/ssa/gen/PPC64.rules golang-1.19-1.19.5/src/cmd/compile/internal/ssa/gen/PPC64.rules --- golang-1.19-1.19.4/src/cmd/compile/internal/ssa/gen/PPC64.rules 2022-12-02 02:12:54.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/compile/internal/ssa/gen/PPC64.rules 2023-01-10 06:38:01.000000000 +0800 @@ -578,9 +578,9 @@ ((EQ|NE|LT|LE|GT|GE) (CMPconst [0] z:(XOR x y)) yes no) && z.Uses == 1 => ((EQ|NE|LT|LE|GT|GE) (XORCC x y) yes no) // Only lower after bool is lowered. It should always lower. This helps ensure the folding below happens reliably. -(CondSelect x y bool) && flagArg(bool) == nil => (ISEL [6] x y (CMPWconst [0] bool)) +(CondSelect x y bool) && flagArg(bool) == nil => (ISEL [6] x y (Select1 <types.TypeFlags> (ANDCCconst [1] bool))) // Fold any CR -> GPR -> CR transfers when applying the above rule. -(ISEL [6] x y (CMPWconst [0] (ISELB [c] one cmp))) => (ISEL [c] x y cmp) +(ISEL [6] x y (Select1 (ANDCCconst [1] (ISELB [c] one cmp)))) => (ISEL [c] x y cmp) // Lowering loads (Load <t> ptr mem) && (is64BitInt(t) || isPtr(t)) => (MOVDload ptr mem) diff -Nru golang-1.19-1.19.4/src/cmd/compile/internal/ssa/gen/RISCV64.rules golang-1.19-1.19.5/src/cmd/compile/internal/ssa/gen/RISCV64.rules --- golang-1.19-1.19.4/src/cmd/compile/internal/ssa/gen/RISCV64.rules 2022-12-02 02:12:54.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/compile/internal/ssa/gen/RISCV64.rules 2023-01-10 06:38:01.000000000 +0800 @@ -568,7 +568,7 @@ (AtomicAnd32 ...) => (LoweredAtomicAnd32 ...) -(AtomicCompareAndSwap32 ...) => (LoweredAtomicCas32 ...) +(AtomicCompareAndSwap32 ptr old new mem) => (LoweredAtomicCas32 ptr (SignExt32to64 old) new mem) (AtomicCompareAndSwap64 ...) => (LoweredAtomicCas64 ...) (AtomicExchange32 ...) => (LoweredAtomicExchange32 ...) diff -Nru golang-1.19-1.19.4/src/cmd/compile/internal/ssa/rewriteARM64.go golang-1.19-1.19.5/src/cmd/compile/internal/ssa/rewriteARM64.go --- golang-1.19-1.19.4/src/cmd/compile/internal/ssa/rewriteARM64.go 2022-12-02 02:12:54.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/compile/internal/ssa/rewriteARM64.go 2023-01-10 06:38:02.000000000 +0800 @@ -23445,7 +23445,7 @@ } // match: (CondSelect x y boolval) // cond: flagArg(boolval) == nil - // result: (CSEL [OpARM64NotEqual] x y (CMPWconst [0] boolval)) + // result: (CSEL [OpARM64NotEqual] x y (TSTWconst [1] boolval)) for { x := v_0 y := v_1 @@ -23455,8 +23455,8 @@ } v.reset(OpARM64CSEL) v.AuxInt = opToAuxInt(OpARM64NotEqual) - v0 := b.NewValue0(v.Pos, OpARM64CMPWconst, types.TypeFlags) - v0.AuxInt = int32ToAuxInt(0) + v0 := b.NewValue0(v.Pos, OpARM64TSTWconst, types.TypeFlags) + v0.AuxInt = int32ToAuxInt(1) v0.AddArg(boolval) v.AddArg3(x, y, v0) return true diff -Nru golang-1.19-1.19.4/src/cmd/compile/internal/ssa/rewriteLOONG64.go golang-1.19-1.19.5/src/cmd/compile/internal/ssa/rewriteLOONG64.go --- golang-1.19-1.19.4/src/cmd/compile/internal/ssa/rewriteLOONG64.go 2022-12-02 02:12:54.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/compile/internal/ssa/rewriteLOONG64.go 2023-01-10 06:38:02.000000000 +0800 @@ -52,8 +52,7 @@ v.Op = OpLOONG64LoweredAtomicAdd64 return true case OpAtomicCompareAndSwap32: - v.Op = OpLOONG64LoweredAtomicCas32 - return true + return rewriteValueLOONG64_OpAtomicCompareAndSwap32(v) case OpAtomicCompareAndSwap64: v.Op = OpLOONG64LoweredAtomicCas64 return true @@ -695,6 +694,27 @@ return true } } +func rewriteValueLOONG64_OpAtomicCompareAndSwap32(v *Value) bool { + v_3 := v.Args[3] + v_2 := v.Args[2] + v_1 := v.Args[1] + v_0 := v.Args[0] + b := v.Block + typ := &b.Func.Config.Types + // match: (AtomicCompareAndSwap32 ptr old new mem) + // result: (LoweredAtomicCas32 ptr (SignExt32to64 old) new mem) + for { + ptr := v_0 + old := v_1 + new := v_2 + mem := v_3 + v.reset(OpLOONG64LoweredAtomicCas32) + v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) + v0.AddArg(old) + v.AddArg4(ptr, v0, new, mem) + return true + } +} func rewriteValueLOONG64_OpAvg64u(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] diff -Nru golang-1.19-1.19.4/src/cmd/compile/internal/ssa/rewriteMIPS64.go golang-1.19-1.19.5/src/cmd/compile/internal/ssa/rewriteMIPS64.go --- golang-1.19-1.19.4/src/cmd/compile/internal/ssa/rewriteMIPS64.go 2022-12-02 02:12:54.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/compile/internal/ssa/rewriteMIPS64.go 2023-01-10 06:38:02.000000000 +0800 @@ -52,8 +52,7 @@ v.Op = OpMIPS64LoweredAtomicAdd64 return true case OpAtomicCompareAndSwap32: - v.Op = OpMIPS64LoweredAtomicCas32 - return true + return rewriteValueMIPS64_OpAtomicCompareAndSwap32(v) case OpAtomicCompareAndSwap64: v.Op = OpMIPS64LoweredAtomicCas64 return true @@ -697,6 +696,27 @@ return true } } +func rewriteValueMIPS64_OpAtomicCompareAndSwap32(v *Value) bool { + v_3 := v.Args[3] + v_2 := v.Args[2] + v_1 := v.Args[1] + v_0 := v.Args[0] + b := v.Block + typ := &b.Func.Config.Types + // match: (AtomicCompareAndSwap32 ptr old new mem) + // result: (LoweredAtomicCas32 ptr (SignExt32to64 old) new mem) + for { + ptr := v_0 + old := v_1 + new := v_2 + mem := v_3 + v.reset(OpMIPS64LoweredAtomicCas32) + v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) + v0.AddArg(old) + v.AddArg4(ptr, v0, new, mem) + return true + } +} func rewriteValueMIPS64_OpAvg64u(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] diff -Nru golang-1.19-1.19.4/src/cmd/compile/internal/ssa/rewritePPC64.go golang-1.19-1.19.5/src/cmd/compile/internal/ssa/rewritePPC64.go --- golang-1.19-1.19.4/src/cmd/compile/internal/ssa/rewritePPC64.go 2022-12-02 02:12:54.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/compile/internal/ssa/rewritePPC64.go 2023-01-10 06:38:02.000000000 +0800 @@ -1175,9 +1175,10 @@ v_1 := v.Args[1] v_0 := v.Args[0] b := v.Block + typ := &b.Func.Config.Types // match: (CondSelect x y bool) // cond: flagArg(bool) == nil - // result: (ISEL [6] x y (CMPWconst [0] bool)) + // result: (ISEL [6] x y (Select1 <types.TypeFlags> (ANDCCconst [1] bool))) for { x := v_0 y := v_1 @@ -1187,9 +1188,11 @@ } v.reset(OpPPC64ISEL) v.AuxInt = int32ToAuxInt(6) - v0 := b.NewValue0(v.Pos, OpPPC64CMPWconst, types.TypeFlags) - v0.AuxInt = int32ToAuxInt(0) - v0.AddArg(bool) + v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) + v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) + v1.AuxInt = int64ToAuxInt(1) + v1.AddArg(bool) + v0.AddArg(v1) v.AddArg3(x, y, v0) return true } @@ -5931,7 +5934,7 @@ v.AddArg(y) return true } - // match: (ISEL [6] x y (CMPWconst [0] (ISELB [c] one cmp))) + // match: (ISEL [6] x y (Select1 (ANDCCconst [1] (ISELB [c] one cmp)))) // result: (ISEL [c] x y cmp) for { if auxIntToInt32(v.AuxInt) != 6 { @@ -5939,15 +5942,19 @@ } x := v_0 y := v_1 - if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 { + if v_2.Op != OpSelect1 { break } v_2_0 := v_2.Args[0] - if v_2_0.Op != OpPPC64ISELB { + if v_2_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_2_0.AuxInt) != 1 { + break + } + v_2_0_0 := v_2_0.Args[0] + if v_2_0_0.Op != OpPPC64ISELB { break } - c := auxIntToInt32(v_2_0.AuxInt) - cmp := v_2_0.Args[1] + c := auxIntToInt32(v_2_0_0.AuxInt) + cmp := v_2_0_0.Args[1] v.reset(OpPPC64ISEL) v.AuxInt = int32ToAuxInt(c) v.AddArg3(x, y, cmp) diff -Nru golang-1.19-1.19.4/src/cmd/compile/internal/ssa/rewriteRISCV64.go golang-1.19-1.19.5/src/cmd/compile/internal/ssa/rewriteRISCV64.go --- golang-1.19-1.19.4/src/cmd/compile/internal/ssa/rewriteRISCV64.go 2022-12-02 02:12:54.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/compile/internal/ssa/rewriteRISCV64.go 2023-01-10 06:38:02.000000000 +0800 @@ -61,8 +61,7 @@ case OpAtomicAnd8: return rewriteValueRISCV64_OpAtomicAnd8(v) case OpAtomicCompareAndSwap32: - v.Op = OpRISCV64LoweredAtomicCas32 - return true + return rewriteValueRISCV64_OpAtomicCompareAndSwap32(v) case OpAtomicCompareAndSwap64: v.Op = OpRISCV64LoweredAtomicCas64 return true @@ -765,6 +764,27 @@ return true } } +func rewriteValueRISCV64_OpAtomicCompareAndSwap32(v *Value) bool { + v_3 := v.Args[3] + v_2 := v.Args[2] + v_1 := v.Args[1] + v_0 := v.Args[0] + b := v.Block + typ := &b.Func.Config.Types + // match: (AtomicCompareAndSwap32 ptr old new mem) + // result: (LoweredAtomicCas32 ptr (SignExt32to64 old) new mem) + for { + ptr := v_0 + old := v_1 + new := v_2 + mem := v_3 + v.reset(OpRISCV64LoweredAtomicCas32) + v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) + v0.AddArg(old) + v.AddArg4(ptr, v0, new, mem) + return true + } +} func rewriteValueRISCV64_OpAtomicOr8(v *Value) bool { v_2 := v.Args[2] v_1 := v.Args[1] diff -Nru golang-1.19-1.19.4/src/cmd/compile/internal/walk/complit.go golang-1.19-1.19.5/src/cmd/compile/internal/walk/complit.go --- golang-1.19-1.19.4/src/cmd/compile/internal/walk/complit.go 2022-12-02 02:12:55.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/compile/internal/walk/complit.go 2023-01-10 06:38:02.000000000 +0800 @@ -243,6 +243,7 @@ // confuses about variables lifetime. So making sure those expressions // are ordered correctly here. See issue #52673. orderBlock(&sinit, map[string][]*ir.Name{}) + typecheck.Stmts(sinit) walkStmtList(sinit) } init.Append(sinit...) diff -Nru golang-1.19-1.19.4/src/cmd/compile/internal/walk/convert.go golang-1.19-1.19.5/src/cmd/compile/internal/walk/convert.go --- golang-1.19-1.19.4/src/cmd/compile/internal/walk/convert.go 2022-12-02 02:12:55.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/compile/internal/walk/convert.go 2023-01-10 06:38:02.000000000 +0800 @@ -79,13 +79,15 @@ var typeWord ir.Node if toType.IsEmptyInterface() { - // Implement interface to empty interface conversion. - // res = itab + // Implement interface to empty interface conversion: + // + // var res *uint8 + // res = (*uint8)(unsafe.Pointer(itab)) // if res != nil { // res = res.type // } typeWord = typecheck.Temp(types.NewPtr(types.Types[types.TUINT8])) - init.Append(ir.NewAssignStmt(base.Pos, typeWord, itab)) + init.Append(ir.NewAssignStmt(base.Pos, typeWord, typecheck.Conv(typecheck.Conv(itab, types.Types[types.TUNSAFEPTR]), typeWord.Type()))) nif := ir.NewIfStmt(base.Pos, typecheck.Expr(ir.NewBinaryExpr(base.Pos, ir.ONE, typeWord, typecheck.NodNil())), nil, nil) nif.Body = []ir.Node{ir.NewAssignStmt(base.Pos, typeWord, itabType(typeWord))} init.Append(nif) diff -Nru golang-1.19-1.19.4/src/cmd/compile/internal/walk/switch.go golang-1.19-1.19.5/src/cmd/compile/internal/walk/switch.go --- golang-1.19-1.19.4/src/cmd/compile/internal/walk/switch.go 2022-12-02 02:12:55.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/compile/internal/walk/switch.go 2023-01-10 06:38:02.000000000 +0800 @@ -289,7 +289,7 @@ const minCases = 8 // have at least minCases cases in the switch const minDensity = 4 // use at least 1 out of every minDensity entries - if !go119UseJumpTables || base.Flag.N != 0 || !ssagen.Arch.LinkArch.CanJumpTable { + if !go119UseJumpTables || base.Flag.N != 0 || !ssagen.Arch.LinkArch.CanJumpTable || base.Ctxt.Retpoline { return false } if len(cc) < minCases { diff -Nru golang-1.19-1.19.4/src/cmd/go/testdata/script/mod_replace_gopkgin.txt golang-1.19-1.19.5/src/cmd/go/testdata/script/mod_replace_gopkgin.txt --- golang-1.19-1.19.4/src/cmd/go/testdata/script/mod_replace_gopkgin.txt 2022-12-02 02:12:55.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/go/testdata/script/mod_replace_gopkgin.txt 2023-01-10 06:38:05.000000000 +0800 @@ -4,6 +4,9 @@ # even if there is an explicit go.mod file containing the # gopkg.in path. +skip 'skipping test that depends on an unreliable third-party server; see https://go.dev/issue/54503' + # TODO(#54043): Make this test hermetic and re-enable it. + [short] skip [!net] skip [!exec:git] skip diff -Nru golang-1.19-1.19.4/src/cmd/go/testdata/script/trampoline_reuse_test.txt golang-1.19-1.19.5/src/cmd/go/testdata/script/trampoline_reuse_test.txt --- golang-1.19-1.19.4/src/cmd/go/testdata/script/trampoline_reuse_test.txt 1970-01-01 08:00:00.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/go/testdata/script/trampoline_reuse_test.txt 2023-01-10 06:38:05.000000000 +0800 @@ -0,0 +1,100 @@ +# Verify PPC64 does not reuse a trampoline which is too far away. +# This tests an edge case where the direct call relocation addend should +# be ignored when computing the distance from the direct call to the +# already placed trampoline +[short] skip +[!ppc64] [!ppc64le] skip +[aix] skip + +# Note, this program does not run. Presumably, 'DWORD $0' is simpler to +# assembly 2^26 or so times. +# +# We build something which should be laid out as such: +# +# bar.Bar +# main.Func1 +# bar.Bar+400-tramp0 +# main.BigAsm +# main.Func2 +# bar.Bar+400-tramp1 +# +# bar.Bar needs to be placed far enough away to generate relocations +# from main package calls. and main.Func1 and main.Func2 are placed +# a bit more than the direct call limit apart, but not more than 0x400 +# bytes beyond it (to verify the reloc calc). + +go build + +-- go.mod -- + +module foo + +go 1.19 + +-- main.go -- + +package main + +import "foo/bar" + +func Func1() + +func main() { + Func1() + bar.Bar2() +} + +-- foo.s -- + +TEXT main·Func1(SB),0,$0-0 + CALL bar·Bar+0x400(SB) + CALL main·BigAsm(SB) +// A trampoline will be placed here to bar.Bar + +// This creates a gap sufficiently large to prevent trampoline reuse +#define NOP64 DWORD $0; DWORD $0; DWORD $0; DWORD $0; DWORD $0; DWORD $0; DWORD $0; DWORD $0; +#define NOP256 NOP64 NOP64 NOP64 NOP64 +#define NOP2S10 NOP256 NOP256 NOP256 NOP256 +#define NOP2S12 NOP2S10 NOP2S10 NOP2S10 NOP2S10 +#define NOP2S14 NOP2S12 NOP2S12 NOP2S12 NOP2S12 +#define NOP2S16 NOP2S14 NOP2S14 NOP2S14 NOP2S14 +#define NOP2S18 NOP2S16 NOP2S16 NOP2S16 NOP2S16 +#define NOP2S20 NOP2S18 NOP2S18 NOP2S18 NOP2S18 +#define NOP2S22 NOP2S20 NOP2S20 NOP2S20 NOP2S20 +#define NOP2S24 NOP2S22 NOP2S22 NOP2S22 NOP2S22 +#define BIGNOP NOP2S24 NOP2S24 +TEXT main·BigAsm(SB),0,$0-0 + // Fill to the direct call limit so Func2 must generate a new trampoline. + // As the implicit trampoline above is just barely unreachable. + BIGNOP + MOVD $main·Func2(SB), R3 + +TEXT main·Func2(SB),0,$0-0 + CALL bar·Bar+0x400(SB) +// Another trampoline should be placed here. + +-- bar/bar.s -- + +#define NOP64 DWORD $0; DWORD $0; DWORD $0; DWORD $0; DWORD $0; DWORD $0; DWORD $0; DWORD $0; +#define NOP256 NOP64 NOP64 NOP64 NOP64 +#define NOP2S10 NOP256 NOP256 NOP256 NOP256 +#define NOP2S12 NOP2S10 NOP2S10 NOP2S10 NOP2S10 +#define NOP2S14 NOP2S12 NOP2S12 NOP2S12 NOP2S12 +#define NOP2S16 NOP2S14 NOP2S14 NOP2S14 NOP2S14 +#define NOP2S18 NOP2S16 NOP2S16 NOP2S16 NOP2S16 +#define NOP2S20 NOP2S18 NOP2S18 NOP2S18 NOP2S18 +#define NOP2S22 NOP2S20 NOP2S20 NOP2S20 NOP2S20 +#define NOP2S24 NOP2S22 NOP2S22 NOP2S22 NOP2S22 +#define BIGNOP NOP2S24 NOP2S24 NOP2S10 +// A very big not very interesting function. +TEXT bar·Bar(SB),0,$0-0 + BIGNOP + +-- bar/bar.go -- + +package bar + +func Bar() + +func Bar2() { +} diff -Nru golang-1.19-1.19.4/src/cmd/go/testdata/script/version_buildvcs_git_gpg.txt golang-1.19-1.19.5/src/cmd/go/testdata/script/version_buildvcs_git_gpg.txt --- golang-1.19-1.19.4/src/cmd/go/testdata/script/version_buildvcs_git_gpg.txt 2022-12-02 02:12:55.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/go/testdata/script/version_buildvcs_git_gpg.txt 1970-01-01 08:00:00.000000000 +0800 @@ -1,105 +0,0 @@ -# This test checks that VCS information is stamped into Go binaries even when -# the current commit is signed and the use has configured git to display commit -# signatures. - -[!exec:git] skip -[!exec:gpg] skip -[short] skip -env GOBIN=$GOPATH/bin -env GNUPGHOME=$WORK/.gpupg -mkdir $GNUPGHOME -chmod 0700 $GNUPGHOME - -# Create GPG key -exec gpg --batch --passphrase '' --quick-generate-key gop...@golang.org -exec gpg --list-secret-keys --with-colons gop...@golang.org -cp stdout keyinfo.txt -go run extract_key_id.go keyinfo.txt -cp stdout keyid.txt - -# Initialize repo -cd repo/ -exec git init -exec git config user.email gop...@golang.org -exec git config user.name 'J.R. Gopher' -exec git config --add log.showSignature true -go run ../configure_signing_key.go ../keyid.txt - -# Create signed commit -cd a -exec git add -A -exec git commit -m 'initial commit' --gpg-sign -exec git log - -# Verify commit signature does not interfere with versioning -go install -go version -m $GOBIN/a -stdout '^\tbuild\tvcs\.revision=' -stdout '^\tbuild\tvcs\.time=' -stdout '^\tbuild\tvcs\.modified=false$' - --- repo/README -- -Far out in the uncharted backwaters of the unfashionable end of the western -spiral arm of the Galaxy lies a small, unregarded yellow sun. --- repo/a/go.mod -- -module example.com/a - -go 1.18 --- repo/a/a.go -- -package main - -func main() {} - --- extract_key_id.go -- -package main - -import "fmt" -import "io/ioutil" -import "os" -import "strings" - -func main() { - err := run(os.Args[1]) - if err != nil { - panic(err) - } -} - -func run(keyInfoFilePath string) error { - contents, err := ioutil.ReadFile(keyInfoFilePath) - if err != nil { - return err - } - lines := strings.Split(string(contents), "\n") - for _, line := range lines { - fields := strings.Split(line, ":") - if fields[0] == "sec" { - fmt.Print(fields[4]) - return nil - } - } - return fmt.Errorf("key ID not found in: %s", keyInfoFilePath) -} - --- configure_signing_key.go -- -package main - -import "io/ioutil" -import "os" -import "os/exec" - -func main() { - err := run(os.Args[1]) - if err != nil { - panic(err) - } -} - -func run(keyIdFilePath string) error { - keyId, err := ioutil.ReadFile(keyIdFilePath) - if err != nil { - return err - } - gitCmd := exec.Command("git", "config", "user.signingKey", string(keyId)) - return gitCmd.Run() -} diff -Nru golang-1.19-1.19.4/src/cmd/link/internal/loadelf/ldelf.go golang-1.19-1.19.5/src/cmd/link/internal/loadelf/ldelf.go --- golang-1.19-1.19.4/src/cmd/link/internal/loadelf/ldelf.go 2022-12-02 02:12:55.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/link/internal/loadelf/ldelf.go 2023-01-10 06:38:05.000000000 +0800 @@ -1002,7 +1002,8 @@ LOONG64 | uint32(elf.R_LARCH_MARK_LA)<<16, LOONG64 | uint32(elf.R_LARCH_SOP_POP_32_S_0_10_10_16_S2)<<16, LOONG64 | uint32(elf.R_LARCH_64)<<16, - LOONG64 | uint32(elf.R_LARCH_MARK_PCREL)<<16: + LOONG64 | uint32(elf.R_LARCH_MARK_PCREL)<<16, + LOONG64 | 99<<16: // R_LARCH_32_PCREL return 4, 4, nil case S390X | uint32(elf.R_390_8)<<16: diff -Nru golang-1.19-1.19.4/src/cmd/link/internal/ppc64/asm.go golang-1.19-1.19.5/src/cmd/link/internal/ppc64/asm.go --- golang-1.19-1.19.4/src/cmd/link/internal/ppc64/asm.go 2022-12-02 02:12:55.000000000 +0800 +++ golang-1.19-1.19.5/src/cmd/link/internal/ppc64/asm.go 2023-01-10 06:38:05.000000000 +0800 @@ -900,8 +900,9 @@ if ldr.SymValue(tramp) == 0 { break } - - t = ldr.SymValue(tramp) + r.Add() - (ldr.SymValue(s) + int64(r.Off())) + // Note, the trampoline is always called directly. The addend of the original relocation is accounted for in the + // trampoline itself. + t = ldr.SymValue(tramp) - (ldr.SymValue(s) + int64(r.Off())) // With internal linking, the trampoline can be used if it is not too far. // With external linking, the trampoline must be in this section for it to be reused. diff -Nru golang-1.19-1.19.4/src/crypto/x509/internal/macos/corefoundation.go golang-1.19-1.19.5/src/crypto/x509/internal/macos/corefoundation.go --- golang-1.19-1.19.4/src/crypto/x509/internal/macos/corefoundation.go 2022-12-02 02:12:58.000000000 +0800 +++ golang-1.19-1.19.5/src/crypto/x509/internal/macos/corefoundation.go 2023-01-10 06:38:14.000000000 +0800 @@ -188,6 +188,13 @@ } func x509_CFErrorCopyDescription_trampoline() +//go:cgo_import_dynamic x509_CFErrorGetCode CFErrorGetCode "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" + +func CFErrorGetCode(errRef CFRef) int { + return int(syscall(abi.FuncPCABI0(x509_CFErrorGetCode_trampoline), uintptr(errRef), 0, 0, 0, 0, 0)) +} +func x509_CFErrorGetCode_trampoline() + //go:cgo_import_dynamic x509_CFStringCreateExternalRepresentation CFStringCreateExternalRepresentation "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation" func CFStringCreateExternalRepresentation(strRef CFRef) (CFRef, error) { diff -Nru golang-1.19-1.19.4/src/crypto/x509/internal/macos/corefoundation.s golang-1.19-1.19.5/src/crypto/x509/internal/macos/corefoundation.s --- golang-1.19-1.19.4/src/crypto/x509/internal/macos/corefoundation.s 2022-12-02 02:12:58.000000000 +0800 +++ golang-1.19-1.19.5/src/crypto/x509/internal/macos/corefoundation.s 2023-01-10 06:38:14.000000000 +0800 @@ -37,5 +37,7 @@ JMP x509_CFDataCreate(SB) TEXT ·x509_CFErrorCopyDescription_trampoline(SB),NOSPLIT,$0-0 JMP x509_CFErrorCopyDescription(SB) +TEXT ·x509_CFErrorGetCode_trampoline(SB),NOSPLIT,$0-0 + JMP x509_CFErrorGetCode(SB) TEXT ·x509_CFStringCreateExternalRepresentation_trampoline(SB),NOSPLIT,$0-0 JMP x509_CFStringCreateExternalRepresentation(SB) diff -Nru golang-1.19-1.19.4/src/crypto/x509/internal/macos/security.go golang-1.19-1.19.5/src/crypto/x509/internal/macos/security.go --- golang-1.19-1.19.4/src/crypto/x509/internal/macos/security.go 2022-12-02 02:12:58.000000000 +0800 +++ golang-1.19-1.19.5/src/crypto/x509/internal/macos/security.go 2023-01-10 06:38:14.000000000 +0800 @@ -8,7 +8,6 @@ import ( "errors" - "fmt" "internal/abi" "strconv" "unsafe" @@ -52,6 +51,15 @@ SecTrustSettingsDomainSystem ) +const ( + // various macOS error codes that can be returned from + // SecTrustEvaluateWithError that we can map to Go cert + // verification error types. + ErrSecCertificateExpired = -67818 + ErrSecHostNameMismatch = -67602 + ErrSecNotTrusted = -67843 +) + type OSStatus struct { call string status int32 @@ -196,17 +204,18 @@ //go:cgo_import_dynamic x509_SecTrustEvaluateWithError SecTrustEvaluateWithError "/System/Library/Frameworks/Security.framework/Versions/A/Security" -func SecTrustEvaluateWithError(trustObj CFRef) error { +func SecTrustEvaluateWithError(trustObj CFRef) (int, error) { var errRef CFRef ret := syscall(abi.FuncPCABI0(x509_SecTrustEvaluateWithError_trampoline), uintptr(trustObj), uintptr(unsafe.Pointer(&errRef)), 0, 0, 0, 0) if int32(ret) != 1 { errStr := CFErrorCopyDescription(errRef) - err := fmt.Errorf("x509: %s", CFStringToString(errStr)) + err := errors.New(CFStringToString(errStr)) + errCode := CFErrorGetCode(errRef) CFRelease(errRef) CFRelease(errStr) - return err + return errCode, err } - return nil + return 0, nil } func x509_SecTrustEvaluateWithError_trampoline() diff -Nru golang-1.19-1.19.4/src/crypto/x509/root_darwin.go golang-1.19-1.19.5/src/crypto/x509/root_darwin.go --- golang-1.19-1.19.4/src/crypto/x509/root_darwin.go 2022-12-02 02:12:58.000000000 +0800 +++ golang-1.19-1.19.5/src/crypto/x509/root_darwin.go 2023-01-10 06:38:14.000000000 +0800 @@ -7,6 +7,7 @@ import ( macOS "crypto/x509/internal/macos" "errors" + "fmt" ) func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) { @@ -54,8 +55,17 @@ // always enforce its SCT requirements, and there are still _some_ people // using TLS or OCSP for that. - if err := macOS.SecTrustEvaluateWithError(trustObj); err != nil { - return nil, err + if ret, err := macOS.SecTrustEvaluateWithError(trustObj); err != nil { + switch ret { + case macOS.ErrSecCertificateExpired: + return nil, CertificateInvalidError{c, Expired, err.Error()} + case macOS.ErrSecHostNameMismatch: + return nil, HostnameError{c, opts.DNSName} + case macOS.ErrSecNotTrusted: + return nil, UnknownAuthorityError{Cert: c} + default: + return nil, fmt.Errorf("x509: %s", err) + } } chain := [][]*Certificate{{}} diff -Nru golang-1.19-1.19.4/src/crypto/x509/root_darwin_test.go golang-1.19-1.19.5/src/crypto/x509/root_darwin_test.go --- golang-1.19-1.19.4/src/crypto/x509/root_darwin_test.go 2022-12-02 02:12:58.000000000 +0800 +++ golang-1.19-1.19.5/src/crypto/x509/root_darwin_test.go 2023-01-10 06:38:14.000000000 +0800 @@ -42,23 +42,23 @@ { name: "expired leaf", host: "expired.badssl.com", - expectedErr: "x509: “*.badssl.com” certificate is expired", + expectedErr: "x509: certificate has expired or is not yet valid: “*.badssl.com” certificate is expired", }, { name: "wrong host for leaf", host: "wrong.host.badssl.com", verifyName: "wrong.host.badssl.com", - expectedErr: "x509: “*.badssl.com” certificate name does not match input", + expectedErr: "x509: certificate is valid for *.badssl.com, badssl.com, not wrong.host.badssl.com", }, { name: "self-signed leaf", host: "self-signed.badssl.com", - expectedErr: "x509: “*.badssl.com” certificate is not trusted", + expectedErr: "x509: certificate signed by unknown authority", }, { name: "untrusted root", host: "untrusted-root.badssl.com", - expectedErr: "x509: “BadSSL Untrusted Root Certificate Authority” certificate is not trusted", + expectedErr: "x509: certificate signed by unknown authority", }, { name: "revoked leaf", @@ -74,7 +74,7 @@ name: "expired leaf (custom time)", host: "google.com", verifyTime: time.Time{}.Add(time.Hour), - expectedErr: "x509: “*.google.com” certificate is expired", + expectedErr: "x509: certificate has expired or is not yet valid: “*.google.com” certificate is expired", }, { name: "valid chain (custom time)", diff -Nru golang-1.19-1.19.4/src/crypto/x509/x509.go golang-1.19-1.19.5/src/crypto/x509/x509.go --- golang-1.19-1.19.4/src/crypto/x509/x509.go 2022-12-02 02:12:58.000000000 +0800 +++ golang-1.19-1.19.5/src/crypto/x509/x509.go 2023-01-10 06:38:14.000000000 +0800 @@ -1816,18 +1816,13 @@ } var ret []pkix.Extension - seenExts := make(map[string]bool) + requestedExts := make(map[string]bool) for _, rawAttr := range rawAttributes { var attr pkcs10Attribute if rest, err := asn1.Unmarshal(rawAttr.FullBytes, &attr); err != nil || len(rest) != 0 || len(attr.Values) == 0 { // Ignore attributes that don't parse. continue } - oidStr := attr.Id.String() - if seenExts[oidStr] { - return nil, errors.New("x509: certificate request contains duplicate extensions") - } - seenExts[oidStr] = true if !attr.Id.Equal(oidExtensionRequest) { continue @@ -1837,7 +1832,6 @@ if _, err := asn1.Unmarshal(attr.Values[0].FullBytes, &extensions); err != nil { return nil, err } - requestedExts := make(map[string]bool) for _, ext := range extensions { oidStr := ext.Id.String() if requestedExts[oidStr] { diff -Nru golang-1.19-1.19.4/src/crypto/x509/x509_test.go golang-1.19-1.19.5/src/crypto/x509/x509_test.go --- golang-1.19-1.19.4/src/crypto/x509/x509_test.go 2022-12-02 02:12:58.000000000 +0800 +++ golang-1.19-1.19.5/src/crypto/x509/x509_test.go 2023-01-10 06:38:14.000000000 +0800 @@ -3750,10 +3750,32 @@ func TestDuplicateExtensionsCSR(t *testing.T) { b, _ := pem.Decode([]byte(dupExtCSR)) if b == nil { - t.Fatalf("couldn't decode test certificate") + t.Fatalf("couldn't decode test CSR") } _, err := ParseCertificateRequest(b.Bytes) if err == nil { - t.Fatal("ParseCertificate should fail when parsing certificate with duplicate extensions") + t.Fatal("ParseCertificateRequest should fail when parsing CSR with duplicate extensions") + } +} + +const dupAttCSR = `-----BEGIN CERTIFICATE REQUEST----- +MIIBbDCB1gIBADAPMQ0wCwYDVQQDEwR0ZXN0MIGfMA0GCSqGSIb3DQEBAQUAA4GN +ADCBiQKBgQCj5Po3PKO/JNuxr+B+WNfMIzqqYztdlv+mTQhT0jOR5rTkUvxeeHH8 +YclryES2dOISjaUOTmOAr5GQIIdQl4Ql33Cp7ZR/VWcRn+qvTak0Yow+xVsDo0n4 +7IcvvP6CJ7FRoYBUakVczeXLxCjLwdyK16VGJM06eRzDLykPxpPwLQIDAQABoB4w +DQYCKgMxBwwFdGVzdDEwDQYCKgMxBwwFdGVzdDIwDQYJKoZIhvcNAQELBQADgYEA +UJ8hsHxtnIeqb2ufHnQFJO+wEJhx2Uxm/BTuzHOeffuQkwATez4skZ7SlX9exgb7 +6jRMRilqb4F7f8w+uDoqxRrA9zc8mwY16zPsyBhRet+ZGbj/ilgvGmtZ21qZZ/FU +0pJFJIVLM3l49Onr5uIt5+hCWKwHlgE0nGpjKLR3cMg= +-----END CERTIFICATE REQUEST-----` + +func TestDuplicateAttributesCSR(t *testing.T) { + b, _ := pem.Decode([]byte(dupAttCSR)) + if b == nil { + t.Fatalf("couldn't decode test CSR") + } + _, err := ParseCertificateRequest(b.Bytes) + if err != nil { + t.Fatal("ParseCertificateRequest should succeed when parsing CSR with duplicate attributes") } } diff -Nru golang-1.19-1.19.4/src/go.mod golang-1.19-1.19.5/src/go.mod --- golang-1.19-1.19.4/src/go.mod 2022-12-02 02:12:58.000000000 +0800 +++ golang-1.19-1.19.5/src/go.mod 2023-01-10 06:38:15.000000000 +0800 @@ -4,7 +4,7 @@ require ( golang.org/x/crypto v0.0.0-20220516162934-403b01795ae8 - golang.org/x/net v0.0.0-20220907013720-d52c520e3766 + golang.org/x/net v0.0.0-20221214163817-183621ab9c4e ) require ( diff -Nru golang-1.19-1.19.4/src/go.sum golang-1.19-1.19.5/src/go.sum --- golang-1.19-1.19.4/src/go.sum 2022-12-02 02:12:58.000000000 +0800 +++ golang-1.19-1.19.5/src/go.sum 2023-01-10 06:38:15.000000000 +0800 @@ -1,7 +1,7 @@ golang.org/x/crypto v0.0.0-20220516162934-403b01795ae8 h1:y+mHpWoQJNAHt26Nhh6JP7hvM71IRZureyvZhoVALIs= golang.org/x/crypto v0.0.0-20220516162934-403b01795ae8/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20220907013720-d52c520e3766 h1:D02YdIT3M6OQkZXTQiO761u/SmR3DDDiDXLN2oZIUac= -golang.org/x/net v0.0.0-20220907013720-d52c520e3766/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20221214163817-183621ab9c4e h1:ny/17Y8U4fgn9XOKSWpD8Fgz3CD+msKsE74LF845pIg= +golang.org/x/net v0.0.0-20221214163817-183621ab9c4e/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/sys v0.0.0-20220614162138-6c1b26c55098 h1:PgOr27OhUx2IRqGJ2RxAWI4dJQ7bi9cSrB82uzFzfUA= golang.org/x/sys v0.0.0-20220614162138-6c1b26c55098/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.8-0.20220509174342-b4bca84b0361 h1:h+pU/hCb7sEApigI6eII3/Emx5ZHaFWS+nulUp0Az/k= diff -Nru golang-1.19-1.19.4/src/internal/poll/sock_cloexec_accept.go golang-1.19-1.19.5/src/internal/poll/sock_cloexec_accept.go --- golang-1.19-1.19.4/src/internal/poll/sock_cloexec_accept.go 1970-01-01 08:00:00.000000000 +0800 +++ golang-1.19-1.19.5/src/internal/poll/sock_cloexec_accept.go 2023-01-10 06:38:16.000000000 +0800 @@ -0,0 +1,51 @@ +// Copyright 2013 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. + +// This file implements accept for platforms that provide a fast path for +// setting SetNonblock and CloseOnExec, but don't necessarily have accept4. +// This is the code we used for accept in Go 1.17 and earlier. +// On Linux the accept4 system call was introduced in 2.6.28 kernel, +// and our minimum requirement is 2.6.32, so we simplified the function. +// Unfortunately, on ARM accept4 wasn't added until 2.6.36, so for ARM +// only we continue using the older code. + +//go:build linux && arm + +package poll + +import "syscall" + +// Wrapper around the accept system call that marks the returned file +// descriptor as nonblocking and close-on-exec. +func accept(s int) (int, syscall.Sockaddr, string, error) { + ns, sa, err := Accept4Func(s, syscall.SOCK_NONBLOCK|syscall.SOCK_CLOEXEC) + switch err { + case nil: + return ns, sa, "", nil + default: // errors other than the ones listed + return -1, sa, "accept4", err + case syscall.ENOSYS: // syscall missing + case syscall.EINVAL: // some Linux use this instead of ENOSYS + case syscall.EACCES: // some Linux use this instead of ENOSYS + case syscall.EFAULT: // some Linux use this instead of ENOSYS + } + + // See ../syscall/exec_unix.go for description of ForkLock. + // It is probably okay to hold the lock across syscall.Accept + // because we have put fd.sysfd into non-blocking mode. + // However, a call to the File method will put it back into + // blocking mode. We can't take that risk, so no use of ForkLock here. + ns, sa, err = AcceptFunc(s) + if err == nil { + syscall.CloseOnExec(ns) + } + if err != nil { + return -1, nil, "accept", err + } + if err = syscall.SetNonblock(ns, true); err != nil { + CloseFunc(ns) + return -1, nil, "setnonblock", err + } + return ns, sa, "", nil +} diff -Nru golang-1.19-1.19.4/src/internal/poll/sock_cloexec.go golang-1.19-1.19.5/src/internal/poll/sock_cloexec.go --- golang-1.19-1.19.4/src/internal/poll/sock_cloexec.go 2022-12-02 02:12:58.000000000 +0800 +++ golang-1.19-1.19.5/src/internal/poll/sock_cloexec.go 2023-01-10 06:38:16.000000000 +0800 @@ -5,7 +5,7 @@ // This file implements accept for platforms that provide a fast path for // setting SetNonblock and CloseOnExec. -//go:build dragonfly || freebsd || linux || netbsd || openbsd || solaris +//go:build dragonfly || freebsd || (linux && !arm) || netbsd || openbsd || solaris package poll diff -Nru golang-1.19-1.19.4/src/net/http/h2_bundle.go golang-1.19-1.19.5/src/net/http/h2_bundle.go --- golang-1.19-1.19.4/src/net/http/h2_bundle.go 2022-12-02 02:12:59.000000000 +0800 +++ golang-1.19-1.19.5/src/net/http/h2_bundle.go 2023-01-10 06:38:18.000000000 +0800 @@ -5764,12 +5764,6 @@ return nil, nil, sc.countError("bad_path_method", http2streamError(f.StreamID, http2ErrCodeProtocol)) } - bodyOpen := !f.StreamEnded() - if rp.method == "HEAD" && bodyOpen { - // HEAD requests can't have bodies - return nil, nil, sc.countError("head_body", http2streamError(f.StreamID, http2ErrCodeProtocol)) - } - rp.header = make(Header) for _, hf := range f.RegularFields() { rp.header.Add(sc.canonicalHeader(hf.Name), hf.Value) @@ -5782,6 +5776,7 @@ if err != nil { return nil, nil, err } + bodyOpen := !f.StreamEnded() if bodyOpen { if vv, ok := rp.header["Content-Length"]; ok { if cl, err := strconv.ParseUint(vv[0], 10, 63); err == nil { diff -Nru golang-1.19-1.19.4/src/net/lookup_test.go golang-1.19-1.19.5/src/net/lookup_test.go --- golang-1.19-1.19.4/src/net/lookup_test.go 2022-12-02 02:12:59.000000000 +0800 +++ golang-1.19-1.19.5/src/net/lookup_test.go 2023-01-10 06:38:19.000000000 +0800 @@ -49,21 +49,21 @@ cname, target string }{ { - "xmpp-server", "tcp", "google.com", + "ldap", "tcp", "google.com", "google.com.", "google.com.", }, { - "xmpp-server", "tcp", "google.com.", + "ldap", "tcp", "google.com.", "google.com.", "google.com.", }, // non-standard back door { - "", "", "_xmpp-server._tcp.google.com", + "", "", "_ldap._tcp.google.com", "google.com.", "google.com.", }, { - "", "", "_xmpp-server._tcp.google.com.", + "", "", "_ldap._tcp.google.com.", "google.com.", "google.com.", }, } @@ -71,10 +71,6 @@ var backoffDuration = [...]time.Duration{time.Second, 5 * time.Second, 30 * time.Second} func TestLookupGoogleSRV(t *testing.T) { - // TODO(mknyszek): Figure out next steps for this test. This is just - // a quick fix. - t.Skip("fails consistently due to an upstream DNS change; see #56707.") - t.Parallel() mustHaveExternalNetwork(t) @@ -635,10 +631,6 @@ } func TestLookupDotsWithRemoteSource(t *testing.T) { - // TODO(mknyszek): Figure out next steps for this test. This is just - // a quick fix. - t.Skip("fails consistently due to an upstream DNS change; see #56707.") - if runtime.GOOS == "darwin" || runtime.GOOS == "ios" { testenv.SkipFlaky(t, 27992) } @@ -709,16 +701,16 @@ } } - cname, srvs, err := LookupSRV("xmpp-server", "tcp", "google.com") + cname, srvs, err := LookupSRV("ldap", "tcp", "google.com") if err != nil { - t.Errorf("LookupSRV(xmpp-server, tcp, google.com): %v (mode=%v)", err, mode) + t.Errorf("LookupSRV(ldap, tcp, google.com): %v (mode=%v)", err, mode) } else { if !hasSuffixFold(cname, ".google.com.") { - t.Errorf("LookupSRV(xmpp-server, tcp, google.com) returned cname=%v, want name ending in .google.com. with trailing dot (mode=%v)", cname, mode) + t.Errorf("LookupSRV(ldap, tcp, google.com) returned cname=%v, want name ending in .google.com. with trailing dot (mode=%v)", cname, mode) } for _, srv := range srvs { if !hasSuffixFold(srv.Target, ".google.com.") { - t.Errorf("LookupSRV(xmpp-server, tcp, google.com) returned addrs=%v, want names ending in .google.com. with trailing dot (mode=%v)", srvString(srvs), mode) + t.Errorf("LookupSRV(ldap, tcp, google.com) returned addrs=%v, want names ending in .google.com. with trailing dot (mode=%v)", srvString(srvs), mode) break } } diff -Nru golang-1.19-1.19.4/src/os/os_test.go golang-1.19-1.19.5/src/os/os_test.go --- golang-1.19-1.19.4/src/os/os_test.go 2022-12-02 02:12:59.000000000 +0800 +++ golang-1.19-1.19.5/src/os/os_test.go 2023-01-10 06:38:19.000000000 +0800 @@ -275,9 +275,11 @@ if !equal(sfname, dir.Name()) { t.Error("name should be ", sfname, "; is", dir.Name()) } - filesize := size(path, t) - if dir.Size() != filesize { - t.Error("size should be", filesize, "; is", dir.Size()) + if dir.Mode()&ModeSymlink == 0 { + filesize := size(path, t) + if dir.Size() != filesize { + t.Error("size should be", filesize, "; is", dir.Size()) + } } } diff -Nru golang-1.19-1.19.4/src/runtime/internal/atomic/atomic_test.go golang-1.19-1.19.5/src/runtime/internal/atomic/atomic_test.go --- golang-1.19-1.19.4/src/runtime/internal/atomic/atomic_test.go 2022-12-02 02:12:59.000000000 +0800 +++ golang-1.19-1.19.5/src/runtime/internal/atomic/atomic_test.go 2023-01-10 06:38:19.000000000 +0800 @@ -345,6 +345,36 @@ } } +func TestCasRel(t *testing.T) { + const _magic = 0x5a5aa5a5 + var x struct { + before uint32 + i uint32 + after uint32 + o uint32 + n uint32 + } + + x.before = _magic + x.after = _magic + for j := 0; j < 32; j += 1 { + x.i = (1 << j) + 0 + x.o = (1 << j) + 0 + x.n = (1 << j) + 1 + if !atomic.CasRel(&x.i, x.o, x.n) { + t.Fatalf("should have swapped %#x %#x", x.o, x.n) + } + + if x.i != x.n { + t.Fatalf("wrong x.i after swap: x.i=%#x x.n=%#x", x.i, x.n) + } + + if x.before != _magic || x.after != _magic { + t.Fatalf("wrong magic: %#x _ %#x != %#x _ %#x", x.before, x.after, _magic, _magic) + } + } +} + func TestStorepNoWB(t *testing.T) { var p [2]*int for i := range p { diff -Nru golang-1.19-1.19.4/src/sync/atomic/atomic_test.go golang-1.19-1.19.5/src/sync/atomic/atomic_test.go --- golang-1.19-1.19.4/src/sync/atomic/atomic_test.go 2022-12-02 02:13:00.000000000 +0800 +++ golang-1.19-1.19.5/src/sync/atomic/atomic_test.go 2023-01-10 06:38:22.000000000 +0800 @@ -2605,3 +2605,9 @@ }() } } + +// Test that this compiles. +// When atomic.Pointer used _ [0]T, it did not. +type List struct { + Next Pointer[List] +} diff -Nru golang-1.19-1.19.4/src/sync/atomic/type.go golang-1.19-1.19.5/src/sync/atomic/type.go --- golang-1.19-1.19.4/src/sync/atomic/type.go 2022-12-02 02:13:00.000000000 +0800 +++ golang-1.19-1.19.5/src/sync/atomic/type.go 2023-01-10 06:38:22.000000000 +0800 @@ -37,9 +37,10 @@ // A Pointer is an atomic pointer of type *T. The zero value is a nil *T. type Pointer[T any] struct { - // Mention T in a field to disallow conversion between Pointer types. + // Mention *T in a field to disallow conversion between Pointer types. // See go.dev/issue/56603 for more details. - _ [0]T + // Use *T, not T, to avoid spurious recursive type definition errors. + _ [0]*T _ noCopy v unsafe.Pointer diff -Nru golang-1.19-1.19.4/src/syscall/syscall_linux_accept4.go golang-1.19-1.19.5/src/syscall/syscall_linux_accept4.go --- golang-1.19-1.19.4/src/syscall/syscall_linux_accept4.go 1970-01-01 08:00:00.000000000 +0800 +++ golang-1.19-1.19.5/src/syscall/syscall_linux_accept4.go 2023-01-10 06:38:22.000000000 +0800 @@ -0,0 +1,25 @@ +// Copyright 2009 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. + +// This file provides the Accept function used on all systems +// other than arm. See syscall_linux_accept.go for why. + +//go:build linux && !arm + +package syscall + +func Accept(fd int) (nfd int, sa Sockaddr, err error) { + var rsa RawSockaddrAny + var len _Socklen = SizeofSockaddrAny + nfd, err = accept4(fd, &rsa, &len, 0) + if err != nil { + return + } + sa, err = anyToSockaddr(&rsa) + if err != nil { + Close(nfd) + nfd = 0 + } + return +} diff -Nru golang-1.19-1.19.4/src/syscall/syscall_linux_accept.go golang-1.19-1.19.5/src/syscall/syscall_linux_accept.go --- golang-1.19-1.19.4/src/syscall/syscall_linux_accept.go 1970-01-01 08:00:00.000000000 +0800 +++ golang-1.19-1.19.5/src/syscall/syscall_linux_accept.go 2023-01-10 06:38:22.000000000 +0800 @@ -0,0 +1,34 @@ +// Copyright 2009 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. + +// We require Linux kernel version 2.6.32. The accept4 system call was +// added in version 2.6.28, so in general we can use accept4. +// Unfortunately, for ARM only, accept4 was added in version 2.6.36. +// Handle that case here, by using a copy of the Accept function that +// we used in Go 1.17. + +//go:build linux && arm + +package syscall + +//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) + +func Accept(fd int) (nfd int, sa Sockaddr, err error) { + var rsa RawSockaddrAny + var len _Socklen = SizeofSockaddrAny + // Try accept4 first for Android and newer kernels. + nfd, err = accept4(fd, &rsa, &len, 0) + if err == ENOSYS { + nfd, err = accept(fd, &rsa, &len) + } + if err != nil { + return + } + sa, err = anyToSockaddr(&rsa) + if err != nil { + Close(nfd) + nfd = 0 + } + return +} diff -Nru golang-1.19-1.19.4/src/syscall/syscall_linux.go golang-1.19-1.19.5/src/syscall/syscall_linux.go --- golang-1.19-1.19.4/src/syscall/syscall_linux.go 2022-12-02 02:13:00.000000000 +0800 +++ golang-1.19-1.19.5/src/syscall/syscall_linux.go 2023-01-10 06:38:22.000000000 +0800 @@ -630,21 +630,6 @@ return nil, EAFNOSUPPORT } -func Accept(fd int) (nfd int, sa Sockaddr, err error) { - var rsa RawSockaddrAny - var len _Socklen = SizeofSockaddrAny - nfd, err = accept4(fd, &rsa, &len, 0) - if err != nil { - return - } - sa, err = anyToSockaddr(&rsa) - if err != nil { - Close(nfd) - nfd = 0 - } - return -} - func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) { var rsa RawSockaddrAny var len _Socklen = SizeofSockaddrAny diff -Nru golang-1.19-1.19.4/src/syscall/zsyscall_linux_arm.go golang-1.19-1.19.5/src/syscall/zsyscall_linux_arm.go --- golang-1.19-1.19.4/src/syscall/zsyscall_linux_arm.go 2022-12-02 02:13:00.000000000 +0800 +++ golang-1.19-1.19.5/src/syscall/zsyscall_linux_arm.go 2023-01-10 06:38:23.000000000 +0800 @@ -1,4 +1,4 @@ -// mksyscall.pl -l32 -arm -tags linux,arm syscall_linux.go syscall_linux_arm.go +// mksyscall.pl -l32 -arm -tags linux,arm syscall_linux.go syscall_linux_arm.go syscall_linux_accept.go // Code generated by the command above; DO NOT EDIT. //go:build linux && arm @@ -1595,5 +1595,16 @@ if e1 != 0 { err = errnoErr(e1) } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { + r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } return } diff -Nru golang-1.19-1.19.4/src/vendor/modules.txt golang-1.19-1.19.5/src/vendor/modules.txt --- golang-1.19-1.19.4/src/vendor/modules.txt 2022-12-02 02:13:01.000000000 +0800 +++ golang-1.19-1.19.5/src/vendor/modules.txt 2023-01-10 06:38:24.000000000 +0800 @@ -9,7 +9,7 @@ golang.org/x/crypto/hkdf golang.org/x/crypto/internal/poly1305 golang.org/x/crypto/internal/subtle -# golang.org/x/net v0.0.0-20220907013720-d52c520e3766 +# golang.org/x/net v0.0.0-20221214163817-183621ab9c4e ## explicit; go 1.17 golang.org/x/net/dns/dnsmessage golang.org/x/net/http/httpguts diff -Nru golang-1.19-1.19.4/test/codegen/retpoline.go golang-1.19-1.19.5/test/codegen/retpoline.go --- golang-1.19-1.19.4/test/codegen/retpoline.go 2022-12-02 02:13:01.000000000 +0800 +++ golang-1.19-1.19.5/test/codegen/retpoline.go 2023-01-10 06:38:24.000000000 +0800 @@ -12,3 +12,31 @@ // amd64:`CALL\truntime.retpoline` x.M() } + +// Check to make sure that jump tables are disabled +// when retpoline is on. See issue 57097. +func noJumpTables(x int) int { + switch x { + case 0: + return 0 + case 1: + return 1 + case 2: + return 2 + case 3: + return 3 + case 4: + return 4 + case 5: + return 5 + case 6: + return 6 + case 7: + return 7 + case 8: + return 8 + case 9: + return 9 + } + return 10 +} diff -Nru golang-1.19-1.19.4/test/fixedbugs/issue56727.go golang-1.19-1.19.5/test/fixedbugs/issue56727.go --- golang-1.19-1.19.4/test/fixedbugs/issue56727.go 1970-01-01 08:00:00.000000000 +0800 +++ golang-1.19-1.19.5/test/fixedbugs/issue56727.go 2023-01-10 06:38:26.000000000 +0800 @@ -0,0 +1,45 @@ +// compile + +// Copyright 2022 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 + +type I interface { + M() +} + +type S struct{} + +func (*S) M() {} + +type slice []I + +func f() { + ss := struct { + i I + }{ + i: &S{}, + } + + _ = [...]struct { + s slice + }{ + { + s: slice{ss.i}, + }, + { + s: slice{ss.i}, + }, + { + s: slice{ss.i}, + }, + { + s: slice{ss.i}, + }, + { + s: slice{ss.i}, + }, + } +} diff -Nru golang-1.19-1.19.4/test/fixedbugs/issue56768.go golang-1.19-1.19.5/test/fixedbugs/issue56768.go --- golang-1.19-1.19.4/test/fixedbugs/issue56768.go 1970-01-01 08:00:00.000000000 +0800 +++ golang-1.19-1.19.5/test/fixedbugs/issue56768.go 2023-01-10 06:38:26.000000000 +0800 @@ -0,0 +1,37 @@ +// compile + +// Copyright 2022 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 + +type I interface { + M() +} + +type slice []any + +func f() { + ss := struct{ i I }{} + + _ = [...]struct { + s slice + }{ + { + s: slice{ss.i}, + }, + { + s: slice{ss.i}, + }, + { + s: slice{ss.i}, + }, + { + s: slice{ss.i}, + }, + { + s: slice{ss.i}, + }, + } +} diff -Nru golang-1.19-1.19.4/test/fixedbugs/issue57184.go golang-1.19-1.19.5/test/fixedbugs/issue57184.go --- golang-1.19-1.19.4/test/fixedbugs/issue57184.go 1970-01-01 08:00:00.000000000 +0800 +++ golang-1.19-1.19.5/test/fixedbugs/issue57184.go 2023-01-10 06:38:26.000000000 +0800 @@ -0,0 +1,40 @@ +// run + +// Copyright 2022 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 ( + "log" + "reflect" + "sort" +) + +func main() { + const length = 257 + x := make([]int64, length) + for i := 0; i < length; i++ { + x[i] = int64(i) * 27644437 % int64(length) + } + + isLessStatic := func(i, j int) bool { + return x[i] < x[j] + } + + isLessReflect := reflect.MakeFunc(reflect.TypeOf(isLessStatic), func(args []reflect.Value) []reflect.Value { + i := args[0].Int() + j := args[1].Int() + b := x[i] < x[j] + return []reflect.Value{reflect.ValueOf(b)} + }).Interface().(func(i, j int) bool) + + sort.SliceStable(x, isLessReflect) + + for i := 0; i < length-1; i++ { + if x[i] >= x[i+1] { + log.Fatalf("not sorted! (length=%v, idx=%v)\n%v\n", length, i, x) + } + } +} diff -Nru golang-1.19-1.19.4/VERSION golang-1.19-1.19.5/VERSION --- golang-1.19-1.19.4/VERSION 2022-12-02 02:12:53.000000000 +0800 +++ golang-1.19-1.19.5/VERSION 2023-01-10 06:38:00.000000000 +0800 @@ -1 +1 @@ -go1.19.4 \ No newline at end of file +go1.19.5 \ No newline at end of file