]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
16 months ago[release-branch.go1.19] go1.19.5 go1.19.5
Gopher Robot [Tue, 10 Jan 2023 17:57:47 +0000 (17:57 +0000)]
[release-branch.go1.19] go1.19.5

Change-Id: I29de2897f400f576dfde497b4c51f7ee04696b36
Reviewed-on: https://go-review.googlesource.com/c/go/+/461358
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Gopher Robot <gobot@golang.org>

16 months ago[release-branch.go1.19] misc/cgo/testcshared: handle unsuffixed dlltool path
Than McIntosh [Thu, 17 Nov 2022 20:29:27 +0000 (15:29 -0500)]
[release-branch.go1.19] misc/cgo/testcshared: handle unsuffixed dlltool path

Adapt the testcshared tests to handle the case where the path output
by invoking

  gcc -print-prog-name=dlltool

is a path lacking the final ".exe" suffix (this seems to be what clang
is doing); tack it on before using if this is the case.

Updates #57704.
Fixes #57706.

Change-Id: I04fb7b9fc90677880b1ced4a4ad2a8867a3f5f86
Reviewed-on: https://go-review.googlesource.com/c/go/+/451816
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
(cherry picked from commit 771a98d6b19c9ca4bbd3fbeba03d7d512f77c166)
Reviewed-on: https://go-review.googlesource.com/c/go/+/461175
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
16 months ago[release-branch.go1.19] runtime: revert "call __fork instead of fork on darwin"
Russ Cox [Sun, 8 Jan 2023 22:30:01 +0000 (17:30 -0500)]
[release-branch.go1.19] runtime: revert "call __fork instead of fork on darwin"

A recent comment on #57263 reports an unexplained crash in a cgo program
that is fixed by reverting the __fork fix. We don't have any viable fix for the
os/exec bug at this point, so give up on a fix for the January point releases.

This reverts CL 459178 (commit 91bc4cd118dd).

Fixes #57690.

Change-Id: Ieb38d9bc7f967e9a726429eab2ea515d5ca0847f
Reviewed-on: https://go-review.googlesource.com/c/go/+/461115
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
17 months ago[release-branch.go1.19] crypto/x509: return typed verification errors on macOS
Roland Shoemaker [Tue, 22 Nov 2022 00:47:39 +0000 (16:47 -0800)]
[release-branch.go1.19] crypto/x509: return typed verification errors on macOS

On macOS return the error code from SecTrustEvaluateWithError, and use
it to create typed errors that can be returned from Verify.

Updates #56891
Fixes #57427

Change-Id: Ib597ce202abb60702f730e75da583894422e4c14
Reviewed-on: https://go-review.googlesource.com/c/go/+/452620
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
(cherry picked from commit c9a10d48a8f0e8479f5b9d98c5bd81b64a90d23d)
Reviewed-on: https://go-review.googlesource.com/c/go/+/460895
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Heschi Kreinick <heschi@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
17 months ago[release-branch.go1.19] crypto/x509: reallow duplicate attributes in CSRs
Rob Stradling [Tue, 6 Sep 2022 16:30:31 +0000 (17:30 +0100)]
[release-branch.go1.19] crypto/x509: reallow duplicate attributes in CSRs

Fixes #57556
Updates #54936

Change-Id: I3fb4331c2b1b6adafbac3e76eaf66c79cd5ef56f
Reviewed-on: https://go-review.googlesource.com/c/go/+/428636
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
(cherry picked from commit 56d18207823d6e1c18ca46409180c40ae800230c)
Reviewed-on: https://go-review.googlesource.com/c/go/+/460236
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Heschi Kreinick <heschi@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Filippo Valsorda <filippo@golang.org>

17 months ago[release-branch.go1.19] cmd/compile: sign-extend the 2nd argument of the LoweredAtomi...
David Chase [Mon, 19 Dec 2022 16:30:07 +0000 (11:30 -0500)]
[release-branch.go1.19] cmd/compile: sign-extend the 2nd argument of the LoweredAtomicCas32 on loong64,mips64x,riscv64

The function LoweredAtomicCas32 is implemented using the LL-SC instruction pair
on loong64, mips64x, riscv64. However,the LL instruction on loong64, mips64x,
riscv64 is sign-extended, so it is necessary to sign-extend the 2nd parameter
"old" of the LoweredAtomicCas32, so that the instruction BNE after LL can get
the desired result.

The function prototype of LoweredAtomicCas32 in golang:
    func Cas32(ptr *uint32, old, new uint32) bool

When using an intrinsify implementation:
    case 1: (*ptr) <= 0x80000000 && old < 0x80000000
        E.g: (*ptr) = 0x7FFFFFFF, old = Rarg1= 0x7FFFFFFF

        After run the instruction "LL (Rarg0), Rtmp": Rtmp = 0x7FFFFFFF
        Rtmp ! = Rarg1(old) is false, the result we expect

    case 2: (*ptr) >= 0x80000000 && old >= 0x80000000
        E.g: (*ptr) = 0x80000000, old = Rarg1= 0x80000000

        After run the instruction "LL (Rarg0), Rtmp": Rtmp = 0xFFFFFFFF_80000000
        Rtmp ! = Rarg1(old) is true, which we do not expect

When using an non-intrinsify implementation:
    Because Rarg1 is loaded from the stack using sign-extended instructions
    ld.w, the situation described in Case 2 above does not occur

Benchmarks on linux/loong64:
name     old time/op  new time/op  delta
Cas      50.0ns ± 0%  50.1ns ± 0%   ~     (p=1.000 n=1+1)
Cas64    50.0ns ± 0%  50.1ns ± 0%   ~     (p=1.000 n=1+1)
Cas-4    56.0ns ± 0%  56.0ns ± 0%   ~     (p=1.000 n=1+1)
Cas64-4  56.0ns ± 0%  56.0ns ± 0%   ~     (p=1.000 n=1+1)

Benchmarks on Loongson 3A4000 (GOARCH=mips64le, 1.8GHz)
name     old time/op  new time/op  delta
Cas      70.4ns ± 0%  70.3ns ± 0%   ~     (p=1.000 n=1+1)
Cas64    70.7ns ± 0%  70.6ns ± 0%   ~     (p=1.000 n=1+1)
Cas-4    81.1ns ± 0%  80.8ns ± 0%   ~     (p=1.000 n=1+1)
Cas64-4  80.9ns ± 0%  80.9ns ± 0%   ~     (p=1.000 n=1+1)

Fixes #57345

Change-Id: I190a7fc648023b15fa392f7fdda5ac18c1561bac
Reviewed-on: https://go-review.googlesource.com/c/go/+/457135
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/458355
Run-TryBot: David Chase <drchase@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>

17 months ago[release-branch.go1.19] cmd/link: recognize the new R_LARCH_32_PCREL type on loong64
Cherry Mui [Wed, 21 Dec 2022 17:43:54 +0000 (12:43 -0500)]
[release-branch.go1.19] cmd/link: recognize the new R_LARCH_32_PCREL type on loong64

This is a minimum backport of CL 420983 without an API change in
debug/elf.

Original CL description:

Due to the latest binutils change [1], at least for certain 32-bit
relocs in .eh_frame section, this new type of relocation record is
emitted, leading to breakage on systems with bleeding-edge toolchain
when trying to link with object(s) with such new-style relocs.

Simply treating it the same as the existing reloc types seems enough.

Updates #54222.
Fixes #57444.

[1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=f09482a8747b6fd4c2d59a6a64677d3a3fe1e092

Change-Id: Idd86294a11c1d13b88acbca59e537656a57d8109
Reviewed-on: https://go-review.googlesource.com/c/go/+/458836
Reviewed-by: WANG Xuerui <git@xen0n.name>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>

17 months ago[release-branch.go1.19] cmd/compile: fix broken IR for iface -> eface
Cuong Manh Le [Wed, 16 Nov 2022 18:02:26 +0000 (01:02 +0700)]
[release-branch.go1.19] cmd/compile: fix broken IR for iface -> eface

For implementing interface to empty interface conversion, the compiler
generate code like:

var res *uint8
res = itab
if res != nil {
res = res.type
}

However, itab has type *uintptr, so the assignment is broken. The
problem is not shown up, until CL 450215, which call typecheck on this
broken assignment.

To fix this, just cast itab to *uint8 when doing the conversion.

Fixes #56770

Change-Id: Id42792d18e7f382578b40854d46eecd49673792c
Reviewed-on: https://go-review.googlesource.com/c/go/+/451256
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/451875
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
17 months ago[release-branch.go1.19] runtime: call __fork instead of fork on darwin
Russ Cox [Thu, 22 Dec 2022 14:44:56 +0000 (09:44 -0500)]
[release-branch.go1.19] runtime: call __fork instead of fork on darwin

Issues #33565 and #56784 were caused by hangs in the child process
after fork, while it ran atfork handlers that ran into slow paths that
didn't work in the child.

CL 451735 worked around those two issues by calling a couple functions
at startup to try to warm up those child paths. That mostly worked,
but it broke programs using cgo with certain macOS frameworks (#57263).

CL 459175 reverted CL 451735.

This CL introduces a different fix: bypass the atfork child handlers
entirely. For a general fork call where the child and parent are both
meant to keep executing the original program, atfork handlers can be
necessary to fix any state that would otherwise be tied to the parent
process. But Go only uses fork as preparation for exec, and it takes
care to limit what it attempts to do in the child between the fork and
exec. In particular it doesn't use any of the things that the macOS
atfork handlers are trying to fix up (malloc, xpc, others). So we can
use the low-level fork system call (__fork) instead of the
atfork-wrapped one.

The full list of functions that can be called in a child after fork in
exec_libc2.go is:

 - ptrace
 - setsid
 - setpgid
 - getpid
 - ioctl
 - chroot
 - setgroups
 - setgid
 - setuid
 - chdir
 - dup2
 - fcntl
 - close
 - execve
 - write
 - exit

I disassembled all of these while attached to a hung exec.test binary
and confirmed that nearly all of them are making direct kernel calls,
not using anything that the atfork handler needs to fix up.
The exceptions are ioctl, fcntl, and exit.

The ioctl and fcntl implementations do some extra work around the
kernel call but don't call any other functions, so they should still
be OK. (If not, we could use __ioctl and __fcntl instead, but without
a good reason, we should keep using the standard entry points.)

The exit implementation calls atexit handlers. That is almost
certainly inappropriate in a failed fork child, so this CL changes
that call to __exit on darwin. To avoid making unnecessary changes at
this point in the release cycle, this CL leaves OpenBSD calling plain
exit, even though that is probably a bug in the OpenBSD port
(filed #57446).

Fixes #33565.
Fixes #56784.
Fixes #57263.

Fixes #56837.

Change-Id: I26812c26a72bdd7fcf72ec41899ba11cf6b9c4ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/459176
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/459178

17 months ago[release-branch.go1.19] syscall, internal/poll: fall back to accept on linux-arm
Ian Lance Taylor [Thu, 15 Dec 2022 21:54:33 +0000 (13:54 -0800)]
[release-branch.go1.19] syscall, internal/poll: fall back to accept on linux-arm

Our minimum Linux version is 2.6.32, and the accept4 system call was
introduced in 2.6.28, so we use accept4 everywhere. Unfortunately,
it turns out that the accept4 system call was only added to
linux-arm in 2.6.36, so for linux-arm only we need to try the accept4
system call and then fall back to accept if it doesn't work.

The code we use on linux-arm is the code we used in Go 1.17.
On non-arm platforms we continue using the simpler code introduced
in Go 1.18.

Adding accept4 to the ARM Linux kernel was:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=21d93e2e29722d7832f61cc56d73fb953ee6578e

For #57333
Fixes #57339

Change-Id: I6680cb54dd4d3514a6887dda8906e6708c64459d
Reviewed-on: https://go-review.googlesource.com/c/go/+/457996
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

17 months ago[release-branch.go1.19] cmd/compile: fix conditional move rule on PPC64
Keith Randall [Sat, 10 Dec 2022 03:49:53 +0000 (19:49 -0800)]
[release-branch.go1.19] cmd/compile: fix conditional move rule on PPC64

Similar to CL 456556 but for ppc64 instead of arm64.

Change docs about how booleans are stored in registers for ppc64.
We now don't promise to keep the upper bits zeroed; they might be junk.

To test, I changed the boolean generation instructions (MOVBZload* and ISEL*
with boolean type) to OR in 0x100 to the result. all.bash still passed,
so I think nothing else is depending on the upper bits of booleans.

Update #57212

Change-Id: Ie66f8934a0dafa34d0a8c2a37324868d959a852c
Reviewed-on: https://go-review.googlesource.com/c/go/+/456437
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: KAMPANAT THUMWONG (KONG PC) <1992kongpc.kth@gmail.com>
Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/456736
Reviewed-by: Than McIntosh <thanm@google.com>
17 months ago[release-branch.go1.19] cmd/compile: fix conditional select rule
Keith Randall [Fri, 9 Dec 2022 18:55:28 +0000 (10:55 -0800)]
[release-branch.go1.19] cmd/compile: fix conditional select rule

ARM64 maintains booleans in the low byte of registers. Upper parts
of that register are junk.
This rule is using all 32 bits of a boolean-containing register, which
is wrong. Change the rule to only look at the low bit.

Fixes #57212

Change-Id: Ibbef86b2be859df3d06d993db00e1231c481c428
Reviewed-on: https://go-review.googlesource.com/c/go/+/456556
Auto-Submit: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/456559
Reviewed-by: Than McIntosh <thanm@google.com>
17 months ago[release-branch.go1.19] all: upgrade golang.org/x/net to v0.0.0-20221214163817-183621...
Damien Neil [Wed, 14 Dec 2022 18:49:29 +0000 (10:49 -0800)]
[release-branch.go1.19] all: upgrade golang.org/x/net to v0.0.0-20221214163817-183621ab9c4e

Update x/net to include the fix for #53960.

For #53960
For #56154

Change-Id: Ib3e0d66e4125601e20f1b2e3040f29e7ebd4b080
Reviewed-on: https://go-review.googlesource.com/c/go/+/457556
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
17 months ago[release-branch.go1.19] os: skip size test in TestLstat if the file is a symlink
Ian Lance Taylor [Fri, 9 Dec 2022 19:22:32 +0000 (11:22 -0800)]
[release-branch.go1.19] os: skip size test in TestLstat if the file is a symlink

Tested by temporarily changing sysdir to use a directory where
the expected files were all symlinks. We should consider using
a different approach that doesn't rely on sysdir, but for now
do a minimal fix.

For #57210
Fixes #57214

Change-Id: Ifb1becef03e014ceb48290ce13527b3e103c0e07
Reviewed-on: https://go-review.googlesource.com/c/go/+/456557
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 9b8750f53ed89fb326e4d811524e647683136bac)
Reviewed-on: https://go-review.googlesource.com/c/go/+/456560
Reviewed-by: Austin Clements <austin@google.com>
17 months ago[release-branch.go1.19] cmd/compile: fix missing typecheck for static initialization...
Cuong Manh Le [Mon, 14 Nov 2022 16:11:30 +0000 (23:11 +0700)]
[release-branch.go1.19] cmd/compile: fix missing typecheck for static initialization slice

CL 440455 fixed missing walk pass for static initialization slice.
However, slicelit may produce un-typechecked node, thus we need to do
typecheck for sinit before calling walkStmtList.

Fixes #56744

Change-Id: I40730cebcd09f2be4389d71c5a90eb9a060e4ab7
Reviewed-on: https://go-review.googlesource.com/c/go/+/450215
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/451155
Reviewed-by: Joedian Reid <joedian@golang.org>
17 months ago[release-branch.go1.19] cmd/link/internal/ppc64: fix trampoline reuse distance calcul...
Paul E. Murphy [Wed, 16 Nov 2022 20:53:39 +0000 (14:53 -0600)]
[release-branch.go1.19] cmd/link/internal/ppc64: fix trampoline reuse distance calculation

If a compatible trampoline has been inserted by a previously laid
function in the same section, and is known to be sufficiently close,
it can be reused.

When testing if the trampoline can be reused, the addend of the direct
call should be ignored. It is already encoded in the trampoline. If the
addend is non-zero, and the target sufficiently far away, and just
beyond direct call reach, this may cause the trampoline to be
incorrectly reused.

This was observed on go1.17.13 and openshift-installer commit f3c53b382
building in release mode with the following error:

github.com/aliyun/alibaba-cloud-sdk-go/services/cms.(*Client).DescribeMonitoringAgentAccessKeyWithChan.func1: direct call too far: runtime.duffzero+1f0-tramp0-1 -2000078

Fixes #56834

Change-Id: I54af957302506d4e3cd5d3121542c83fe980e912
Reviewed-on: https://go-review.googlesource.com/c/go/+/451415
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/451417
Reviewed-by: Joedian Reid <joedian@golang.org>
17 months ago[release-branch.go1.19] cmd/go: remove TestScript/version_buildvcs_git_gpg
Bryan C. Mills [Fri, 2 Dec 2022 19:11:00 +0000 (14:11 -0500)]
[release-branch.go1.19] cmd/go: remove TestScript/version_buildvcs_git_gpg

This was a regression test added for a 'git' command line
used for build stamping. Unfortunately, 'gpg' has proved to
be extremely fragile:

* In recent versions, it appears to always require 'gpg-agent' to be
  installed for anything involving secret keys, but for some reason is
  not normally marked as requiring gpg-agent in Debian's package
  manager.

* It tries to create a Unix domain socket in a subdirectory of $TMPDIR
  without checking the path length, which fails when $TMPDIR is too
  long to fit in the 'sun_path' field of a sockaddr_un struct (which
  typically tops out somewhere between 92 and 108 bytes).

We could theoretically address those by artificially reducing the
script's TMPDIR length and checking for gpg-agent in addition to gpg,
but arguably those should both be fixed upstream instead. On balance,
the incremental value that this test provides does not seem worth the
complexity of dealing with such a fragile third-party tool.

Updates #50675.
Updates #48802.
Updates #57034.
Fixes #57055.

Change-Id: Ia3288c2f84f8db86ddfa139b4d1c0112d67079ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/454502
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
(cherry picked from commit 45f5ef4ed7a774b6911650319a265e17ee9e6e0e)
Reviewed-on: https://go-review.googlesource.com/c/go/+/454955

17 months ago[release-branch.go1.19] sync/atomic: allow linked list of atomic pointers again
Russ Cox [Tue, 15 Nov 2022 14:54:39 +0000 (09:54 -0500)]
[release-branch.go1.19] sync/atomic: allow linked list of atomic pointers again

For #56603, CL 448275 added a _ [0]T field to atomic.Pointer,
so that different kinds of atomic.Pointer are not convertible.

Unfortunately, that breaks code like:

type List struct {
Next atomic.Pointer[List]
}

which should be valid, just as using Next *List is valid.
Instead, we get:

./atomic_test.go:2533:6: invalid recursive type List
./atomic_test.go:2533:6: List refers to
./atomic_test.go:2534:13: "sync/atomic".Pointer refers to
./atomic_test.go:2533:6: List

Fix by using _[0]*T instead.

For #56638.
Fixes #57124.

Change-Id: Icc4c83c691d35961d20cb14b824223d6c779ac5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/450655
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
(cherry picked from commit b14cf3d93ae5c477dd35f13f6ba41044f01a7f7d)
Reviewed-on: https://go-review.googlesource.com/c/go/+/452438
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
17 months ago[release-branch.go1.19] net: reenable SRV tests with _ldap._tcp.google.com
Damien Neil [Wed, 30 Nov 2022 18:57:33 +0000 (13:57 -0500)]
[release-branch.go1.19] net: reenable SRV tests with _ldap._tcp.google.com

TestLookupDotsWithRemoteSource and TestLookupGoogleSRV
were disabled because they look up the no-longer-present
SRV record for _xmpp-server._tcp.google.com.

Change the tests to look for _ldap._tcp.google.com and
reenable them.

For #56708.
Fixes #56712.

Change-Id: I26475fa3ff6fc008048a4e5f24f0e96ee12f655c
Reviewed-on: https://go-review.googlesource.com/c/go/+/453861
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 3b3ab616925fb820d5168727d92f1745020f9f9d)
Reviewed-on: https://go-review.googlesource.com/c/go/+/454296
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
17 months ago[release-branch.go1.19] cmd/go: skip TestScript/mod_replace_gopkgin
Bryan C. Mills [Fri, 2 Dec 2022 19:52:34 +0000 (14:52 -0500)]
[release-branch.go1.19] cmd/go: skip TestScript/mod_replace_gopkgin

(Until it can be made hermetic.)

The gopkg.in service has had a lot of flakiness lately. Go users in
general are isolated from that flakiness by the Go module mirror
(proxy.golang.org), but this test intentionally bypasses the module
mirror because the mirror itself uses cmd/go to download the module.

In the long term, we can redirect the gopkg.in URL to the local
(in-process) vcweb server added for #27494.

In the meantime, let's skip the test to reduce the impact of upstream
outages.

Fixes #57058.
Updates #54503.

Change-Id: Icf3de7ca416db548e53864a71776fe22b444fcea
Reviewed-on: https://go-review.googlesource.com/c/go/+/454503
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
(cherry picked from commit c5f5cb659adda026d01b7fa9bd39b2ad3b58c5bf)
Reviewed-on: https://go-review.googlesource.com/c/go/+/454839
Reviewed-by: Michael Pratt <mpratt@google.com>
17 months ago[release-branch.go1.19] cmd/compile: turn off jump tables when spectre retpolines...
Keith Randall [Tue, 6 Dec 2022 00:26:26 +0000 (16:26 -0800)]
[release-branch.go1.19] cmd/compile: turn off jump tables when spectre retpolines are on

Fixes #57100

Change-Id: I6ab659abbca1ae0ac8710674d39aec116fab0baa
Reviewed-on: https://go-review.googlesource.com/c/go/+/455336
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
(cherry picked from commit 1eb0465fa596a2d6e9c1a632499989544f0d7e68)
Reviewed-on: https://go-review.googlesource.com/c/go/+/455416
Reviewed-by: Michael Pratt <mpratt@google.com>
18 months ago[release-branch.go1.19] go1.19.4 go1.19.4
Gopher Robot [Tue, 6 Dec 2022 19:01:35 +0000 (19:01 +0000)]
[release-branch.go1.19] go1.19.4

Change-Id: I5aced88de64f51c6f20ddf11dc8301bdf779a5e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/455598
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Gopher Robot <gobot@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Auto-Submit: Gopher Robot <gobot@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

18 months ago[release-branch.go1.19] net/http: update bundled golang.org/x/net/http2
Damien Neil [Wed, 30 Nov 2022 21:46:33 +0000 (16:46 -0500)]
[release-branch.go1.19] net/http: update bundled golang.org/x/net/http2

Disable cmd/internal/moddeps test, since this update includes PRIVATE
track fixes.

For #56350.
For #57009.
Fixes CVE-2022-41717.

Change-Id: I5c6ce546add81f361dcf0d5123fa4eaaf8f0a03b
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1663835
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/455363
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
18 months ago[release-branch.go1.19] os, net/http: avoid escapes from os.DirFS and http.Dir on...
Damien Neil [Thu, 10 Nov 2022 20:16:27 +0000 (12:16 -0800)]
[release-branch.go1.19] os, net/http: avoid escapes from os.DirFS and http.Dir on Windows

Do not permit access to Windows reserved device names (NUL, COM1, etc.)
via os.DirFS and http.Dir filesystems.

Avoid escapes from os.DirFS(`\`) on Windows. DirFS would join the
the root to the relative path with a path separator, making
os.DirFS(`\`).Open(`/foo/bar`) open the path `\\foo\bar`, which is
a UNC name. Not only does this not open the intended file, but permits
reference to any file on the system rather than only files on the
current drive.

Make os.DirFS("") invalid, with all file access failing. Previously,
a root of "" was interpreted as "/", which is surprising and probably
unintentional.

Fixes CVE-2022-41720
Fixes #56694

Change-Id: I275b5fa391e6ad7404309ea98ccc97405942e0f0
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1663834
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/455362
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>

18 months ago[release-branch.go1.19] testing: skip flaky TestRaiseException on windows-amd64-2012-*
Than McIntosh [Mon, 21 Nov 2022 16:01:53 +0000 (11:01 -0500)]
[release-branch.go1.19] testing: skip flaky TestRaiseException on windows-amd64-2012-*

Modify skip rule for TestRaiseException to trigger on both the base
builder (windows-amd64-2012) and the oldcc legacy builder
(windows-amd64-2012-oldcc) used for 1.18/1.19 testing.

Updates #56983.

Change-Id: I132f9ddd102666b68ad04cc661fdcc2cd841051a
Reviewed-on: https://go-review.googlesource.com/c/go/+/451294
Auto-Submit: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
(cherry picked from commit f0331c524e0d8d32c3918d3515ab8413f38dbd56)
Reviewed-on: https://go-review.googlesource.com/c/go/+/454035
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: Than McIntosh <thanm@google.com>

18 months ago[release-branch.go1.19] runtime: make GC see object as allocated after it is initialized
Cherry Mui [Wed, 9 Nov 2022 15:55:54 +0000 (10:55 -0500)]
[release-branch.go1.19] runtime: make GC see object as allocated after it is initialized

When the GC is scanning some memory (possibly conservatively),
finding a pointer, while concurrently another goroutine is
allocating an object at the same address as the found pointer, the
GC may see the pointer before the object and/or the heap bits are
initialized. This may cause the GC to see bad pointers and
possibly crash.

To prevent this, we make it that the scanner can only see the
object as allocated after the object and the heap bits are
initialized. Currently the allocator uses freeindex to find the
next available slot, and that code is coupled with updating the
free index to a new slot past it. The scanner also uses the
freeindex to determine if an object is allocated. This is somewhat
racy. This CL makes the scanner use a different field, which is
only updated after the object initialization (and a memory
barrier).

Updates #54596.
Fixes #56752.

Change-Id: I2a57a226369926e7192c253dd0d21d3faf22297c
Reviewed-on: https://go-review.googlesource.com/c/go/+/449017
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit febe7b8e2a4dd7cce6ab8d02cf79a5430819cbe5)
Reviewed-on: https://go-review.googlesource.com/c/go/+/453235

18 months ago[release-branch.go1.19] crypto/x509: allow BoringCrypto to use 4096-bit keys
Russ Cox [Thu, 3 Nov 2022 17:08:52 +0000 (13:08 -0400)]
[release-branch.go1.19] crypto/x509: allow BoringCrypto to use 4096-bit keys

FIPS-140 has been updated to allow 4096-bit RSA keys.
Allow them in certificate processing.

For #41147.
Fixes #56672.

Change-Id: I4c6bcb1b137a200dfe70cebc605ae57f49871184
Reviewed-on: https://go-review.googlesource.com/c/go/+/447655
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/449016

18 months ago[release-branch.go1.19] net: disable TestLookupDotsWithRemoteSource and TestLookupGoo...
Michael Anthony Knyszek [Fri, 11 Nov 2022 17:26:45 +0000 (17:26 +0000)]
[release-branch.go1.19] net: disable TestLookupDotsWithRemoteSource and TestLookupGoogleSRV

These tests fail consistently due to a DNS change causing widespread
trybot outages.

For #56707.
Fixes #56710.

Change-Id: Iebdf91254a922a48880021198f0f12f6bc16b6e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/449640
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
(cherry picked from commit 97765249082b6835c77517a4e63bb38cfd6db97b)
Reviewed-on: https://go-review.googlesource.com/c/go/+/449506
Reviewed-by: Ian Lance Taylor <iant@google.com>
18 months ago[release-branch.go1.19] sync/atomic: disallow type conversions of atomic.Pointer[T]
Mateusz Poliwczak [Mon, 7 Nov 2022 14:54:52 +0000 (14:54 +0000)]
[release-branch.go1.19] sync/atomic: disallow type conversions of atomic.Pointer[T]

For #56603.
Fixes #56638.

Change-Id: I6af9d80201025ae4028bfaa4a62e5de9ac0c501d
GitHub-Last-Rev: e6ed5e14512e1221a3c6cb181406cf00eec07e99
GitHub-Pull-Request: golang/go#56604
Reviewed-on: https://go-review.googlesource.com/c/go/+/448275
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
(cherry picked from commit 6bead8f77afd2f7317eb011ca019b61ac3d90c17)
Reviewed-on: https://go-review.googlesource.com/c/go/+/448518
Run-TryBot: Michael Knyszek <mknyszek@google.com>

18 months ago[release-branch.go1.19] runtime: don't jump stack if at entry of systemstack
Cherry Mui [Fri, 30 Sep 2022 23:01:09 +0000 (19:01 -0400)]
[release-branch.go1.19] runtime: don't jump stack if at entry of systemstack

The traceback code has special "jump stack" logic, to trace back
stack switches through systemstack. If we're at the entry of
systemstack, the stack switch hasn't happened, so don't jump to
user stack.

The jump stack logic is only used if we're on the g0 stack. It can
happen that we're at the entry of a recursive systemstack call on
the g0 stack. In we jump stack here, there will be two problems:
1. There are frames between entering the g0 stack and this
   recursive systemstack call. Those frames will be lost.
2. Worse, we switched frame.sp but frame.fp calculation will use
   the entry SP delta (0), which will be wrong, which in turn
   leads wrong frame.lr and things will go off.

For now, don't jump stack if we're at entry of systemstack (SP
delta is 0).

Using a per-PC SPWRITE marker may be a better fix. If we haven't
written the SP, we haven't switched the stack so we can just
unwind like a normal function.

Updates #55851.
Fixes #56636.

Change-Id: I2b624c8c086b235b34d9c7d3cebd4a37264f00f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/437299
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
(cherry picked from commit 500bc6b8056ee2eaf7640610a48ffa00bdd896a5)
Reviewed-on: https://go-review.googlesource.com/c/go/+/448516

18 months ago[release-branch.go1.19] cmd/compile: allow ineffectual //go:linkname in -lang=go1...
Matthew Dempsky [Thu, 3 Nov 2022 18:56:43 +0000 (11:56 -0700)]
[release-branch.go1.19] cmd/compile: allow ineffectual //go:linkname in -lang=go1.17 and older

Prior to Go 1.18, ineffectual //go:linkname directives (i.e.,
directives referring to an undeclared name, or to a declared type or
constant) were treated as noops. In Go 1.18, we changed this into a
compiler error to mitigate accidental misuse.

However, the x/sys repo contained ineffectual //go:linkname directives
up until go.dev/cl/274573, which has caused a lot of user confusion.

It seems a bit late to worry about now, but to at least prevent
further user pain, this CL changes the error message to only apply to
modules using "go 1.18" or newer. (The x/sys repo declared "go 1.12"
at the time go.dev/cl/274573 was submitted.)

For #55889.
Fixes #56557.

Change-Id: Id762fff96fd13ba0f1e696929a9e276dfcba2620
Reviewed-on: https://go-review.googlesource.com/c/go/+/447755
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/447816

18 months ago[release-branch.go1.19] os/exec: allow NUL in environment variables on Plan 9
Matthew Dempsky [Thu, 3 Nov 2022 18:02:51 +0000 (11:02 -0700)]
[release-branch.go1.19] os/exec: allow NUL in environment variables on Plan 9

Plan 9 uses NUL as os.PathListSeparator, so it's almost always going
to appear in the environment variable list. Exempt GOOS=plan9 from the
check for NUL in environment variables.

For #56284.
For #56544.
Fixes #56551.

Change-Id: I23df233cdf20c0a9a606fd9253e15a9b5482575a
Reviewed-on: https://go-review.googlesource.com/c/go/+/447715
Reviewed-by: David du Colombier <0intro@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/447799
Run-TryBot: David du Colombier <0intro@gmail.com>

18 months ago[release-branch.go1.19] cmd/compile: copy blank parameter node when substituting...
Cherry Mui [Fri, 14 Oct 2022 23:52:00 +0000 (19:52 -0400)]
[release-branch.go1.19] cmd/compile: copy blank parameter node when substituting function type

When a function type is copied (e.g. for substituting type
parameters), we make copies of its parameter ir.Name nodes, so
they are not shared with the old function type. But currently a
blank (_) identifier is not copied but shared. The parameter
node's frame offset is assigned (in ABI analysis) and then used in
the concurrent backend. Shared node can cause a data race. Make a
new blank parameter node to avoid sharing. (Unified IR does already
not have this problem. This fixes non-unified-IR mode.)

Updates #55357.
Fixes #56360.

Change-Id: Ie27f08e5589ac7d5d3f0d0d5de1a21e4fd2765c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/443158
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
(cherry picked from commit 4725c71b735143a138b24f2b0e055c717d8d69ca)
Reviewed-on: https://go-review.googlesource.com/c/go/+/445176

18 months ago[release-branch.go1.19] runtime: fix usleep on linux/PPC64
Paul E. Murphy [Thu, 20 Oct 2022 22:01:01 +0000 (17:01 -0500)]
[release-branch.go1.19] runtime: fix usleep on linux/PPC64

The existing implementation fails to convert the remainder
microseconds to nanoseconds. This causes sysmon to consume
much more cpu, and generate lots of context switches.

We can also do a little better here to avoid division by a
constant. I used go to determine the magic numbers.

Fixes #56397

Change-Id: I2e37ec218b9027efab6db4634eed1504c0c1b3c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/444735
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/445157

18 months ago[release-branch.go1.19] crypto/x509: respect GODEBUG changes for allowing SHA1 certif...
Russ Cox [Wed, 26 Oct 2022 03:10:13 +0000 (23:10 -0400)]
[release-branch.go1.19] crypto/x509: respect GODEBUG changes for allowing SHA1 certificates

This allows programs that want SHA1 support to call os.Setenv at startup
instead of insisting that users set the environment variable themselves.

For #41682.
Fixes #56436.
Fixes #56438.

Change-Id: Idcb96212a1d8c560e1dd8eaf7c80b6266f16431e
Reviewed-on: https://go-review.googlesource.com/c/go/+/445496
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/445655

19 months ago[release-branch.go1.19] go1.19.3 go1.19.3
Gopher Robot [Tue, 1 Nov 2022 16:16:44 +0000 (16:16 +0000)]
[release-branch.go1.19] go1.19.3

Change-Id: I167308920eeb7480efb626ce75f777a335e870b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/446958
Run-TryBot: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

19 months ago[release-branch.go1.19] syscall, os/exec: reject environment variables containing...
Damien Neil [Tue, 18 Oct 2022 00:38:29 +0000 (17:38 -0700)]
[release-branch.go1.19] syscall, os/exec: reject environment variables containing NULs

Check for and reject environment variables containing NULs.

The conventions for passing environment variables to subprocesses
cause most or all systems to interpret a NUL as a separator. The
syscall package rejects environment variables containing a NUL
on most systems, but erroneously did not do so on Windows. This
causes an environment variable such as "FOO=a\x00BAR=b" to be
interpreted as "FOO=a", "BAR=b".

Check for and reject NULs in environment variables passed to
syscall.StartProcess on Windows.

Add a redundant check to os/exec as extra insurance.

Updates #56284
Fixes #56328
Fixes CVE-2022-41716

Change-Id: I2950e2b0cb14ebd26e5629be1521858f66a7d4ae
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1609434
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Roland Shoemaker <bracewell@google.com>
TryBot-Result: Security TryBots <security-trybots@go-security-trybots.iam.gserviceaccount.com>
(cherry picked from commit 845accdebb2772c5344ed0c96df9910f3b02d741)
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1617553
Run-TryBot: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/446879
Reviewed-by: Tatiana Bradley <tatiana@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

19 months ago[release-branch.go1.19] cmd/compile: fix missing walk pass for static initialization...
Cuong Manh Le [Sat, 8 Oct 2022 05:32:06 +0000 (12:32 +0700)]
[release-branch.go1.19] cmd/compile: fix missing walk pass for static initialization slice

CL 403995 fixed static init of literal contains dynamic exprs, by
ensuring their init are ordered properly. However, we still need to walk
the generated init codes before appending to parent init. Otherwise,
codes that requires desugaring will be unhandled, causing the compiler
backend crashing.

Fixes #56106

Change-Id: Ic25fd4017473f5412c8e960a91467797a234edfd
Reviewed-on: https://go-review.googlesource.com/c/go/+/440455
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/441995
Reviewed-by: Joedian Reid <joedian@golang.org>
Reviewed-by: David Chase <drchase@google.com>
19 months ago[release-branch.go1.19] all: prevent fakePC overflow on 386 in libfuzzer mode
Cuong Manh Le [Tue, 11 Oct 2022 04:56:51 +0000 (11:56 +0700)]
[release-branch.go1.19] all: prevent fakePC overflow on 386 in libfuzzer mode

fakePC uses hash.Sum32, which returns an uint32. However, libfuzzer
trace/hook functions declare fakePC argument as int, causing overflow on
386 archs.

Fixing this by changing fakePC argument to uint to prevent the overflow.

Fixes #56168

Change-Id: I3994c461319983ab70065f90bf61539a363e0a2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/441996
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/442435
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
19 months ago[release-branch.go1.19] runtime: always keep global reference to mp until mexit completes
Michael Pratt [Tue, 18 Oct 2022 16:01:18 +0000 (12:01 -0400)]
[release-branch.go1.19] runtime: always keep global reference to mp until mexit completes

Ms are allocated via standard heap allocation (`new(m)`), which means we
must keep them alive (i.e., reachable by the GC) until we are completely
done using them.

Ms are primarily reachable through runtime.allm. However, runtime.mexit
drops the M from allm fairly early, long before it is done using the M
structure. If that was the last reference to the M, it is now at risk of
being freed by the GC and used for some other allocation, leading to
memory corruption.

Ms with a Go-allocated stack coincidentally already keep a reference to
the M in sched.freem, so that the stack can be freed lazily. This
reference has the side effect of keeping this Ms reachable. However, Ms
with an OS stack skip this and are at risk of corruption.

Fix this lifetime by extending sched.freem use to all Ms, with the value
of mp.freeWait determining whether the stack needs to be freed or not.

For #56243.
Fixes #56309.

Change-Id: Ic0c01684775f5646970df507111c9abaac0ba52e
Reviewed-on: https://go-review.googlesource.com/c/go/+/443716
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
(cherry picked from commit e252dcf9d38ce9192bccacb7e33867cbfbd22b6c)
Reviewed-on: https://go-review.googlesource.com/c/go/+/443815
Reviewed-by: Austin Clements <austin@google.com>
19 months ago[release-branch.go1.19] cmd/go/internal/modload: update TestQueryImport to pass with...
Bryan C. Mills [Thu, 20 Oct 2022 14:22:10 +0000 (10:22 -0400)]
[release-branch.go1.19] cmd/go/internal/modload: update TestQueryImport to pass with tagged versions of x/net

For #48523.

Change-Id: Ied35d15462cbae1002e1db1e6e119a6c9f8323da
Reviewed-on: https://go-review.googlesource.com/c/go/+/444156
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
(cherry picked from commit 3e6ca3a506fc89f19277b3c19b751847b3864185)
Reviewed-on: https://go-review.googlesource.com/c/go/+/444435
Reviewed-by: Heschi Kreinick <heschi@google.com>
20 months ago[release-branch.go1.19] go1.19.2 go1.19.2
Gopher Robot [Tue, 4 Oct 2022 17:10:28 +0000 (17:10 +0000)]
[release-branch.go1.19] go1.19.2

Change-Id: Ia5de3a0fa07f212c5c19f9e01b0ed2cfab739e95
Reviewed-on: https://go-review.googlesource.com/c/go/+/438598
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Gopher Robot <gobot@golang.org>
Run-TryBot: Gopher Robot <gobot@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

20 months ago[release-branch.go1.19] regexp: limit size of parsed regexps
Russ Cox [Wed, 28 Sep 2022 15:18:51 +0000 (11:18 -0400)]
[release-branch.go1.19] regexp: limit size of parsed regexps

Set a 128 MB limit on the amount of space used by []syntax.Inst
in the compiled form corresponding to a given regexp.

Also set a 128 MB limit on the rune storage in the *syntax.Regexp
tree itself.

Thanks to Adam Korczynski (ADA Logics) and OSS-Fuzz for reporting this issue.

Fixes CVE-2022-41715.
Updates #55949.
Fixes #55951.

Change-Id: Ia656baed81564436368cf950e1c5409752f28e1b
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1592047
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Roland Shoemaker <bracewell@google.com>
TryBot-Result: Security TryBots <security-trybots@go-security-trybots.iam.gserviceaccount.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/438499
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
20 months ago[release-branch.go1.19] archive/tar: limit size of headers
Damien Neil [Sat, 3 Sep 2022 03:45:18 +0000 (20:45 -0700)]
[release-branch.go1.19] archive/tar: limit size of headers

Set a 1MiB limit on special file blocks (PAX headers, GNU long names,
GNU link names), to avoid reading arbitrarily large amounts of data
into memory.

Thanks to Adam Korczynski (ADA Logics) and OSS-Fuzz for reporting
this issue.

Fixes CVE-2022-2879
Updates #54853
Fixes #55926

Change-Id: I85136d6ff1e0af101a112190e027987ab4335680
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1565555
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Run-TryBot: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Roland Shoemaker <bracewell@google.com>
(cherry picked from commit 6ee768cef6b82adf7a90dcf367a1699ef694f3b2)
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1591053
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/438498
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Carlos Amedee <carlos@golang.org>

20 months ago[release-branch.go1.19] net/http/httputil: avoid query parameter smuggling
Damien Neil [Thu, 22 Sep 2022 20:32:00 +0000 (13:32 -0700)]
[release-branch.go1.19] net/http/httputil: avoid query parameter smuggling

Query parameter smuggling occurs when a proxy's interpretation
of query parameters differs from that of a downstream server.
Change ReverseProxy to avoid forwarding ignored query parameters.

Remove unparsable query parameters from the outbound request

   * if req.Form != nil after calling ReverseProxy.Director; and
   * before calling ReverseProxy.Rewrite.

This change preserves the existing behavior of forwarding the
raw query untouched if a Director hook does not parse the query
by calling Request.ParseForm (possibly indirectly).

Fixes #55843
For #54663
For CVE-2022-2880

Change-Id: If1621f6b0e73a49d79059dae9e6b256e0ff18ca9
Reviewed-on: https://go-review.googlesource.com/c/go/+/432976
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/433735
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
20 months ago[release-branch.go1.19] cmd/compile/internal/typebits: relax alignment check
Cuong Manh Le [Fri, 16 Sep 2022 03:41:15 +0000 (10:41 +0700)]
[release-branch.go1.19] cmd/compile/internal/typebits: relax alignment check

Now we have 8-byte alignment types on 32-bit system, so in some rare
case, e.g, generated wrapper for embedded interface, the function
argument may need more than 4 byte alignment. We could pad somehow, but
this is a rare case which makes it hard to ensure that we've got it right.

So relaxing the check for argument and return value region of the stack.

Fixes #55152

Change-Id: I34986e17a920254392a39439ad3dcb323da2ea8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/431098
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/431895

20 months ago[release-branch.go1.19] cmd/compile: skip emitting dictionaries with missing method...
Matthew Dempsky [Thu, 8 Sep 2022 21:31:42 +0000 (14:31 -0700)]
[release-branch.go1.19] cmd/compile: skip emitting dictionaries with missing method expressions

The nounified frontend currently tries to construct dictionaries that
correspond to invalid instantiations (i.e., instantiations T[X] where
X does not satisfy the constraints specified on T's type parameter).
As a consequence, we may fail to find method expressions needed by the
dictionary.

The real fix for this is to avoid creating those dictionaries in the
first place, because they should never actually be needed at runtime.
But that seems scary for a backport: we've repeatedly attempted to
backport generics fixes, which have fixed one issue but introduced
another.

This CL is a minimally invasive solution to #54225, which avoids the
ICE by instead skipping emitting the invalid dictionary. If the
dictionary ends up not being needed (which I believe will always be
the case), then the linker's reachability analysis will simply ignore
its absence.

Or worst case, if the dictionary *is* reachable somehow, we've simply
turned an ICE into a link-time missing symbol failure. That's not
great for user experience, but it seems like a small trade off to
avoid risking breaking any other currently working code.

Fixes #55270.

Change-Id: Ic379696079f4729b1dd6a66994a58cca50281a84
Reviewed-on: https://go-review.googlesource.com/c/go/+/429655
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/429895
Reviewed-by: Keith Randall <khr@google.com>
20 months ago[release-branch.go1.19] cmd/link: suppress -no_pie deprecation warning on darwin
Cherry Mui [Thu, 15 Sep 2022 01:01:04 +0000 (21:01 -0400)]
[release-branch.go1.19] cmd/link: suppress -no_pie deprecation warning on darwin

Apparently the new darwin linker starts to emit a warning about
-no_pie deprecation. Maybe we want to switch to PIE by default.
For now, suppress the warning. This also makes it easier for
backporting to previous releases.

Fixes #55114.
Updates #55112, #54482.

Change-Id: I1a3b74c237a9d00ec3b030fc3a9940a31e5cd37e
Reviewed-on: https://go-review.googlesource.com/c/go/+/430937
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 706d84fca2b36fdf670a0d921e6a8a3b481eaa05)
Reviewed-on: https://go-review.googlesource.com/c/go/+/431517

20 months ago[release-branch.go1.19] cmd/link: stop passing -pagezero_size to darwin linker
Cherry Mui [Wed, 14 Sep 2022 23:50:00 +0000 (19:50 -0400)]
[release-branch.go1.19] cmd/link: stop passing -pagezero_size to darwin linker

We added -pagezero_size in CL 72730, where it was intented for iOS.
The current code passes it only on macOS/AMD64 instead. It is not
really necessary there. Also, the new darwin linker starts to emit
a warning about deprecation of the flag. Stop passing it.

For #55114.
Updates #55112, #54482.

Change-Id: If9db7a1645c37d4284e48f075856912df8d8c1a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/430936
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
(cherry picked from commit 5231ba2f054f2ecb1387bad00b8745d6fe532ea4)
Reviewed-on: https://go-review.googlesource.com/c/go/+/431515
Reviewed-by: Austin Clements <austin@google.com>
20 months ago[release-branch.go1.19] go/types, types2: allow (string...) signature with NewSignatu...
Robert Griesemer [Mon, 12 Sep 2022 22:51:32 +0000 (15:51 -0700)]
[release-branch.go1.19] go/types, types2: allow (string...) signature with NewSignatureType

Includes cases where the core type of the variadic parameter is
a slice or bytestring. Permits a client to create the signature
for various instantiations of append.

Fixes #55149.

Change-Id: I0f4983eb00c088cbe1d87954ee0b2df0ccc3bc49
Reviewed-on: https://go-review.googlesource.com/c/go/+/430455
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/431935

20 months ago[release-branch.go1.19] cmd/compile: avoid using destination pointer base type in...
Keith Randall [Sat, 17 Sep 2022 22:52:35 +0000 (18:52 -0400)]
[release-branch.go1.19] cmd/compile: avoid using destination pointer base type in memmove optimization

The type of the source and destination of a memmove call isn't
always accurate. It will always be a pointer (or an unsafe.Pointer), but
the base type might not be accurate. This comes about because multiple
copies of a pointer with different base types are coalesced into a single value.

In the failing example, the IData selector of the input argument is a
*[32]byte in one branch of the type switch, and a *[]byte in the other branch.
During the expand_calls pass both IDatas become just copies of the input
register. Those copies are deduped and an arbitrary one wins (in this case,
*[]byte is the unfortunate winner).

Generally an op v can rely on v.Type during rewrite rules. But relying
on v.Args[i].Type is discouraged.

Fixes #55124

Change-Id: I348fd9accf2058a87cd191eec01d39cda612f120
Reviewed-on: https://go-review.googlesource.com/c/go/+/431496
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
(cherry picked from commit e283473ebbebf4a80db166e7e852d03c5cff1a61)
Reviewed-on: https://go-review.googlesource.com/c/go/+/431917

20 months ago[release-branch.go1.19] cmd/compile/internal/inline: fix latent CalleeEffects issue
Matthew Dempsky [Mon, 8 Aug 2022 19:31:33 +0000 (12:31 -0700)]
[release-branch.go1.19] cmd/compile/internal/inline: fix latent CalleeEffects issue

ir.ClosureExpr implements ir.InitNode, so ir.InitExpr can prepend init
statements to it. However, CalleeEffects wasn't aware of this and
could cause the init statements to get dropped when inlining a call to
a closure.

This isn't an issue today, because we don't create closures with init
statements. But I ran into this within unified IR.

Easy and robust solution: just take advantage that ir.TakeInit can
handle any node.

Fixes #54917.

Change-Id: Ica05fbf6a8c5be4b11927daf84491a1140da5431
Reviewed-on: https://go-review.googlesource.com/c/go/+/422196
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/429896
Reviewed-by: Michael Knyszek <mknyszek@google.com>
20 months ago[release-branch.go1.19] runtime/cgo: add -fno-stack-protector to CFLAGS
Austin Clements [Wed, 7 Sep 2022 16:19:53 +0000 (12:19 -0400)]
[release-branch.go1.19] runtime/cgo: add -fno-stack-protector to CFLAGS

Some compilers default to having -fstack-protector on, which breaks
when using internal linking because the linker doesn't know how to
find the support functions.

Fixes #54764

(Original fix by Ian Lance Taylor <iant@golang.org>)

Change-Id: I2d8cb7fb780de4cd37314af3957b8f429b1e4b70
Reviewed-on: https://go-review.googlesource.com/c/go/+/429138
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
20 months ago[release-branch.go1.19] all: upgrade golang.org/x/net to v0.0.0-20220907013720-d52c52...
Damien Neil [Wed, 7 Sep 2022 23:44:29 +0000 (16:44 -0700)]
[release-branch.go1.19] all: upgrade golang.org/x/net to v0.0.0-20220907013720-d52c520e3766

Restore vendoring after go1.19.1 security release.

For #54376

Change-Id: Ie1512aa2bf77e5f448893c89e4841cb14896da9b
Reviewed-on: https://go-review.googlesource.com/c/go/+/429317
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

21 months ago[release-branch.go1.19] go1.19.1 go1.19.1
Gopher Robot [Tue, 6 Sep 2022 15:53:07 +0000 (15:53 +0000)]
[release-branch.go1.19] go1.19.1

Change-Id: Iada84ba9c8e727e89cfb4ac21a27e085fa7f60e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/428697
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Gopher Robot <gobot@golang.org>
Auto-Submit: Gopher Robot <gobot@golang.org>

21 months ago[release-branch.go1.19] net/http: update bundled golang.org/x/net/http2
Damien Neil [Mon, 22 Aug 2022 23:28:21 +0000 (16:28 -0700)]
[release-branch.go1.19] net/http: update bundled golang.org/x/net/http2

Disable cmd/internal/moddeps test, since this update includes PRIVATE
track fixes.

Fixes CVE-2022-27664
Fixes #54376
For #54658

Change-Id: I747900a66d7276e7d0bd246cd8cd0da95305c3ca
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1554417
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/428655
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Tatiana Bradley <tatiana@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

21 months ago[release-branch.go1.19 cmd/compile: align stack offset to alignment larger than PtrSize
Cherry Mui [Tue, 23 Aug 2022 22:19:06 +0000 (18:19 -0400)]
[release-branch.go1.19 cmd/compile: align stack offset to alignment larger than PtrSize

In typebits.Set we check that the offset is a multiple of the
alignment, which makes perfect sense. But for values like
atomic.Int64, which has 8-byte alignment even on 32-bit platforms
(i.e. the alignment is larger than PtrSize), if it is on stack it
may be under-aligned, as the stack frame is only PtrSize aligned.

Normally we would prevent such values on stack, as the escape
analysis force values with higher alignment to heap. But for a
composite literal assignment like x = AlignedType{...}, the
compiler creates an autotmp for the RHS then copies it to the LHS.
The autotmp is on stack and may be under-aligned. Currently this
may cause an ICE in the typebits.Set check.

This CL makes it align the _offset_ of the autotmp to 8 bytes,
which satisfies the check. Note that this is actually lying: the
actual address at run time may not necessarily be 8-byte
aligned as we only align SP to 4 bytes.

The under-alignment is probably okay. The only purpose for the
autotmp is to copy the value to the LHS, and the copying code we
generate (at least currently) doesn't care the alignment beyond
stack alignment.

Updates #54638.
Fixes #54697.

Change-Id: I13c16afde2eea017479ff11dfc24092bcb8aba6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/425256
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 1211a62bdcb0f070c5082255bcc90e1a14c16bb2)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425935

21 months ago[release-branch.go1.19] runtime: mark morestack_noctxt SPWRITE on LR architectures
Cherry Mui [Wed, 24 Aug 2022 22:33:21 +0000 (18:33 -0400)]
[release-branch.go1.19] runtime: mark morestack_noctxt SPWRITE on LR architectures

On LR architectures, morestack (and morestack_noctxt) are called
with a special calling convention, where the caller doesn't save
LR on stack but passes it as a register, which morestack will save
to g.sched.lr. The stack unwinder currently doesn't understand it,
and would fail to unwind from it. morestack already writes SP (as
it switches stack), but morestack_noctxt (which tailcalls
morestack) doesn't. If a profiling signal lands right in
morestack_noctxt, the unwinder will try to unwind the stack and
go off, and possibly crash.

Marking morestack_noctxt SPWRITE stops the unwinding.

Ideally we could teach the unwinder about the special calling
convention, or change the calling convention to be less special
(so the unwinder doesn't need to fetch a register from the signal
context). This is a stop-gap solution, to stop the unwinder from
crashing.

Updates #54332.
Fixes #54675.

Change-Id: I75295f2e27ddcf05f1ea0b541aedcb9000ae7576
Reviewed-on: https://go-review.googlesource.com/c/go/+/425396
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
(cherry picked from commit e4be2ac79f3cc7219ae1cf8334463d11cae24e01)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425615

21 months ago[release-branch.go1.19] runtime: fix ppc64 startup on newer linux kernels
Paul E. Murphy [Fri, 19 Aug 2022 14:20:02 +0000 (09:20 -0500)]
[release-branch.go1.19] runtime: fix ppc64 startup on newer linux kernels

R0 needs to be cleared at startup as it may not always be cleared
by the kernel on newer kernels.

Fixes #54665

Change-Id: Id7055699aaa8d8b193b7e3e784f075ce29ac3f1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/424927
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/425394
Reviewed-by: Ian Lance Taylor <iant@google.com>
21 months ago[release-branch.go1.19] cmd/compile: only inline method wrapper if method don't conta...
Cuong Manh Le [Mon, 29 Aug 2022 03:48:28 +0000 (10:48 +0700)]
[release-branch.go1.19] cmd/compile: only inline method wrapper if method don't contain closures

CL 327871 changes methodWrapper to always perform inlining after global
escape analysis. However, inlining the method may reveal closures, which
require walking all function bodies to decide whether to capture free
variables by value or by ref.

To fix it, just not doing inline if the method contains any closures.

Fixes #54726

Change-Id: I4b0255b86257cc6fe7e5fafbc545cc5cff9113e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/426334
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/426160

21 months ago[release-branch.go1.19] cmd/go/internal/imports: recognize "unix" build tag
Zeke Lu [Mon, 29 Aug 2022 23:29:48 +0000 (23:29 +0000)]
[release-branch.go1.19] cmd/go/internal/imports: recognize "unix" build tag

For #20322
For #51572
Updates #54712
Fixes #54736

Change-Id: I22fcfa820e83323bfdf1a40deee7286240f02b3e
GitHub-Last-Rev: cd2c6536b0298baf3c54e5bdbc456a814545cff4
GitHub-Pull-Request: golang/go#54716
Reviewed-on: https://go-review.googlesource.com/c/go/+/426296
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
(cherry picked from commit 3c6a5cdb9a29c0e3b12cdaa8ab81ba22d989e3b0)
Reviewed-on: https://go-review.googlesource.com/c/go/+/426814
Run-TryBot: Bryan Mills <bcmills@google.com>

21 months ago[release-branch.go1.19] cmd/link: fix trampolines breaking DWARF line info
Jeremy Quirke [Tue, 9 Aug 2022 17:20:33 +0000 (17:20 +0000)]
[release-branch.go1.19] cmd/link: fix trampolines breaking DWARF line info

When trampolines are needed (e.g. Darwin ARM64), the DWARF LPT (Line
Program Table - see DWARF section 6.1) generation fails because the
replacement symbols are marked as external symbols and skipped during
the DWARF LPT generation phase.

Fixes #54406

Change-Id: I6c93f5378f50e5edf30d5121402a48214abb1ce2
GitHub-Last-Rev: 085bbc55dbc95d55456cc2acc46a0d02416c2848
GitHub-Pull-Request: golang/go#54321
Reviewed-on: https://go-review.googlesource.com/c/go/+/422154
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 2340d371796f95acdcc399e60f9ecefec2add8df)
Reviewed-on: https://go-review.googlesource.com/c/go/+/423214
Run-TryBot: Cherry Mui <cherryyz@google.com>

21 months ago[release-branch.go1.19] crypto/tls: support ECDHE when ec_point_formats is missing
Filippo Valsorda [Wed, 24 Aug 2022 10:39:20 +0000 (12:39 +0200)]
[release-branch.go1.19] crypto/tls: support ECDHE when ec_point_formats is missing

Updates #49126
Fixes #54643

Change-Id: I9d6f6392b1a6748bdac1d2c6371b22d75829a2b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/425295
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Alex Scheel <alex.scheel@hashicorp.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: David Chase <drchase@google.com>
(cherry picked from commit 1df2a03b17b4496bddfb482ec45b2a29c20e5249)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425635

21 months ago[release-branch.go1.19] cmd/go/internal/imports: include ToolTags in the Tags map
Zeke Lu [Thu, 25 Aug 2022 04:17:00 +0000 (04:17 +0000)]
[release-branch.go1.19] cmd/go/internal/imports: include ToolTags in the Tags map

This fixes a regression introduced when the "race" mode tag was moved to
the ToolTags field in CL 358539.

Fixes #54660
Updates #54468

Change-Id: I107771948a4fe9d743cc13d1c15f324212b08e03
GitHub-Last-Rev: d211e351ef3331f2c38b16d327d992a32ebbfe30
GitHub-Pull-Request: golang/go#54618
Reviewed-on: https://go-review.googlesource.com/c/go/+/425154
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 6ba2674ddc5373f261211ba5ebc38496dc660604)
Reviewed-on: https://go-review.googlesource.com/c/go/+/426434
Reviewed-by: Heschi Kreinick <heschi@google.com>
21 months ago[release-branch.go1.19] cmd/go: avoid registering AtExit handlers in tests
Bryan C. Mills [Wed, 24 Aug 2022 13:45:18 +0000 (09:45 -0400)]
[release-branch.go1.19] cmd/go: avoid registering AtExit handlers in tests

Ever since 'go build' was added (in CL 5483069), it has used an atexit
handler to clean up working directories.

CL 154109 introduced 'cc' command to the script test framework that
called Init on a builder once per invocation. Unfortunately, since
base.AtExit is unsynchronized, the Init added there caused any script
that invokes that command to be unsafe for concurrent use.

This change fixes the race by having the 'cc' command pass in its
working directory instead of allowing the Builder to allocate one.
Following modern Go best practices, it also replaces the in-place Init
method (which is prone to typestate and aliasing bugs) with a
NewBuilder constructor function.

Updates #54423.
Fixes #54637.

Change-Id: I8fc2127a7d877bb39a1174e398736bb51d03d4d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/425205
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
(cherry picked from commit d5aa088d822bc8ef3ceb80c20184f40fcb9b8d2e)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425207

21 months ago[release-branch.go1.19] crypto/x509: don't panic marshaling invalid ECDSA keys
Filippo Valsorda [Tue, 9 Aug 2022 20:02:57 +0000 (13:02 -0700)]
[release-branch.go1.19] crypto/x509: don't panic marshaling invalid ECDSA keys

MarshalPKIXPublicKey, CreateCertificate, CreateCertificateRequest,
MarshalECPrivateKey, and MarshalPKCS8PrivateKey started raising a panic
when encoding an invalid ECDSA key in Go 1.19. Since they have an error
return value, they should return an error instead.

Updates #54288
Fixes #54295

Change-Id: Iba132cd2f890ece36bb7d0396eb9a9a77bdb81df
Reviewed-on: https://go-review.googlesource.com/c/go/+/422298
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
(cherry picked from commit f64f12f0b32eba7d49c259480e0fa0c79eb47600)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425634

21 months ago[release-branch.go1.19] net/url: consistently remove ../ elements in JoinPath
Damien Neil [Fri, 12 Aug 2022 23:21:09 +0000 (16:21 -0700)]
[release-branch.go1.19] net/url: consistently remove ../ elements in JoinPath

JoinPath would fail to remove relative elements from the start of
the path when the first path element is "".

In addition, JoinPath would return the original path unmodified
when provided with no elements to join, violating the documented
behavior of always cleaning the resulting path.

Correct both these cases.

    JoinPath("http://go.dev", "../go")
    // before: http://go.dev/../go
    // after:  http://go.dev/go

    JoinPath("http://go.dev/../go")
    // before: http://go.dev/../go
    // after:  http://go.dev/go

For #54385.
Fixes #54635.
Fixes CVE-2022-32190.

Change-Id: I6d22cd160d097c50703dd96e4f453c6c118fd5d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/423514
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
(cherry picked from commit 0765da5884adcc8b744979303a36a27092d8fc51)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425357
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

21 months ago[release-branch.go1.19] cmd/go: avoid overwriting cached Origin metadata
Bryan C. Mills [Tue, 23 Aug 2022 22:00:34 +0000 (18:00 -0400)]
[release-branch.go1.19] cmd/go: avoid overwriting cached Origin metadata

Fixes #54633.
Updates #54631.

Change-Id: I17d2fa282642aeb1ae2a6e29a0756b8960bea34b
Reviewed-on: https://go-review.googlesource.com/c/go/+/425255
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
(cherry picked from commit e3004d96b6899945d76e5dd373756324c8ff98fb)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425211

21 months ago[release-branch.go1.19] cmd/compile: handle partially overlapping assignments
Keith Randall [Mon, 22 Aug 2022 17:26:50 +0000 (10:26 -0700)]
[release-branch.go1.19] cmd/compile: handle partially overlapping assignments

Normally, when moving Go values of type T from one location to another,
we don't need to worry about partial overlaps. The two Ts must either be
in disjoint (nonoverlapping) memory or in exactly the same location.
There are 2 cases where this isn't true:
 1) Using unsafe you can arrange partial overlaps.
 2) Since Go 1.17, you can use a cast from a slice to a ptr-to-array.
    https://go.dev/ref/spec#Conversions_from_slice_to_array_pointer
    This feature can be used to construct partial overlaps of array types.
      var a [3]int
      p := (*[2]int)(a[:])
      q := (*[2]int)(a[1:])
      *p = *q
We don't care about solving 1. Or at least, we haven't historically
and no one has complained.
For 2, we need to ensure that if there might be partial overlap,
then we can't use OpMove; we must use memmove instead.
(memmove handles partial overlap by copying in the correct
direction. OpMove does not.)

Note that we have to be careful here not to introduce a call when
we're marshaling arguments to a call or unmarshaling results from a call.

Fixes #54629

Change-Id: I1ca6aba8041576849c1d85f1fa33ae61b80a373d
Reviewed-on: https://go-review.googlesource.com/c/go/+/425076
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
(cherry picked from commit 332a5981d0ae3f21f668f94755f43ecd8ee9a9eb)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425234

21 months ago[release-branch.go1.19] misc/cgo/testcarchive: permit SIGQUIT for TestSignalForwardin...
Ian Lance Taylor [Fri, 19 Aug 2022 21:43:47 +0000 (14:43 -0700)]
[release-branch.go1.19] misc/cgo/testcarchive: permit SIGQUIT for TestSignalForwardingExternal

Occasionally the signal will be sent to a Go thread, which will cause
the program to exit with SIGQUIT rather than SIGSEGV.

Add TestSignalForwardingGo to test the case where the signal is
expected to be delivered to a Go thread.

This is a roll forward of CL 419014 which was rolled back in CL 424954.
This CL differs from 419014 in that it skips TestSignalForwardingGo
on darwin-amd64.

For #53907
Fixes #54239

Change-Id: I5df3fd610c068df3bd48d9b3d7a9379248b97999
Reviewed-on: https://go-review.googlesource.com/c/go/+/425002
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
(cherry picked from commit d05ce23756573c6dc2c5026d936f2ef6ac140ee2)
Reviewed-on: https://go-review.googlesource.com/c/go/+/425487
Reviewed-by: David Chase <drchase@google.com>
21 months ago[release-branch.go1.19] cmd/compile: correct alignment of atomic.Int64
Cuong Manh Le [Wed, 3 Aug 2022 08:14:25 +0000 (15:14 +0700)]
[release-branch.go1.19] cmd/compile: correct alignment of atomic.Int64

Same as CL 417555, but for cmd/compile.

Fixes #54235

Change-Id: I4cc6deaf0a87c952f636888b4ab73f81a44bfebd
Reviewed-on: https://go-review.googlesource.com/c/go/+/420975
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/422034
Reviewed-by: Than McIntosh <thanm@google.com>
21 months ago[release-branch.go1.19] cmd: vendor github.com/google/pprof to fix mangled type param...
Michael Pratt [Fri, 12 Aug 2022 18:29:56 +0000 (14:29 -0400)]
[release-branch.go1.19] cmd: vendor github.com/google/pprof to fix mangled type parameter symbol names

Updates github.com/google/pprof to bring in the commit from
https://github.com/google/pprof/pull/717 which fixes mangled
symbol names for type parameters.

For #54105
Fixes #54420

Change-Id: I01af9f780aba3338b960a03b30906a23642e4448
Reviewed-on: https://go-review.googlesource.com/c/go/+/420234
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Than McIntosh <thanm@google.com>
(cherry picked from commit cd9cd925bb9ed79975f2531a6b84f69905e4fc31)
Reviewed-on: https://go-review.googlesource.com/c/go/+/423356
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
21 months ago[release-branch.go1.19] cmd/compile: fix wrong typeparams for selector expr with...
Cuong Manh Le [Sat, 23 Jul 2022 15:31:35 +0000 (22:31 +0700)]
[release-branch.go1.19] cmd/compile: fix wrong typeparams for selector expr with embedded generic type

For selector expression "x.M" where "M" is a promoted method, irgen is using
the type of receiver "x" for determining the typeparams for instantiation.
However, because M is a promoted method, so its associated receiver is
not "x", but "x.T" where "T" is the embedded field of "x". That casues a
mismatch when converting non-shape types arguments.

Fixing it by using the actual receiver which has the method, instead of
using the base receiver.

Fixes #54243

Change-Id: I1836fc422d734df14e9e6664d4bd014503960bfc
Reviewed-on: https://go-review.googlesource.com/c/go/+/419294
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/423114
Reviewed-by: Carlos Amedee <carlos@golang.org>
21 months ago[release-branch.go1.19] cmd/compile: fix import/export of ODYNAMICDOTTYPE
Matthew Dempsky [Fri, 5 Aug 2022 23:09:22 +0000 (16:09 -0700)]
[release-branch.go1.19] cmd/compile: fix import/export of ODYNAMICDOTTYPE

The RType field isn't needed when performing type assertions from
non-empty interface types, because we use the ITab field instead. But
the inline body exporter didn't know to expect this.

It's possible we could use a single bool to distinguish whether
we're serializing the RType or ITab field, but using two is simpler
and seems safer.

Fixes #54309.

Change-Id: I9ddac72784fb2241fee0a0dee30493d868a2c259
Reviewed-on: https://go-review.googlesource.com/c/go/+/421755
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
(cherry picked from commit 0c4db1e347dc51589e5289388305b02108ca0aa1)
Reviewed-on: https://go-review.googlesource.com/c/go/+/421715
Reviewed-by: Than McIntosh <thanm@google.com>
22 months ago[release-branch.go1.19] go1.19 go1.19
Gopher Robot [Tue, 2 Aug 2022 16:39:14 +0000 (16:39 +0000)]
[release-branch.go1.19] go1.19

Change-Id: Iea643b04a7eea7c882d7eec481b67e4ecc08a559
Reviewed-on: https://go-review.googlesource.com/c/go/+/420834
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
22 months ago[release-branch.go1.19] test: improve generic type assertion test
Matthew Dempsky [Mon, 1 Aug 2022 20:23:36 +0000 (13:23 -0700)]
[release-branch.go1.19] test: improve generic type assertion test

The test added in CL 420674 only tested that the type assertions
compiled at all. This CL changes it into a run test to make sure the
type assertions compile and also run correctly.

Updates #54135.

Change-Id: Id17469faad1bb55ff79b0bb4163ef50179330033
Reviewed-on: https://go-review.googlesource.com/c/go/+/420421
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
(cherry picked from commit f2a9f3e2e0ce7e582d226ad9a41d3c36b146fc25)
Reviewed-on: https://go-review.googlesource.com/c/go/+/420675
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
22 months ago[release-branch.go1.19] cmd/compile: fix wrong dict pass condition for type assertions
Wayne Zuo [Sun, 31 Jul 2022 09:20:26 +0000 (17:20 +0800)]
[release-branch.go1.19] cmd/compile: fix wrong dict pass condition for type assertions

Updates #54135.

Change-Id: I2b27af8124014b2699ea44bdc765e1fb8f6c8028
Reviewed-on: https://go-review.googlesource.com/c/go/+/420394
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
(cherry picked from commit 27038b70f860e29fdf472ac5fb208b6ad9598c10)
Reviewed-on: https://go-review.googlesource.com/c/go/+/420674
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
22 months ago[release-branch.go1.19] all: merge master (e99f53f) into release-branch.go1.19
Dmitri Shuralyov [Mon, 1 Aug 2022 18:19:15 +0000 (14:19 -0400)]
[release-branch.go1.19] all: merge master (e99f53f) into release-branch.go1.19

Merge List:

+ 2022-08-01 e99f53fed9 doc: move Go 1.19 release notes to x/website
+ 2022-08-01 8b13a073a1 doc: mention removal of cmd/compile's -importmap and -installsuffix flags
+ 2022-08-01 e95fd4c238 doc/go1.19: fix typo: EM_LONGARCH -> EM_LOONGARCH
+ 2022-08-01 dee3efd9f8 doc/go1.19: fix a few links that were missing trailing slashes
+ 2022-07-30 f32519e5fb runtime: fix typos
+ 2022-07-29 9a2001a8cc cmd/dist: always pass -short=true with -quick
+ 2022-07-28 5c8ec89cb5 doc/go1.19: minor adjustments and links
+ 2022-07-28 417be37048 doc/go1.19: improve the loong64 release notes
+ 2022-07-28 027855e8d8 os/exec: add GODEBUG setting to opt out of ErrDot changes
+ 2022-07-27 462b78fe70 misc/cgo/test: use fewer threads in TestSetgidStress in long mode
+ 2022-07-27 055113ef36 math/big: check buffer lengths in GobDecode
+ 2022-07-27 4248146154 net: document UDPConn.ReadFromUDPAddrPort's AddrPort result more
+ 2022-07-26 faf4e97200 net: fix WriteMsgUDPAddrPort addr handling
+ 2022-07-26 caa225dd29 doc/go1.19: note that updated race syso files require GNU ld 2.26
+ 2022-07-26 ceefd3a37b bytes: document that Reader.Reset affects the result of Size
+ 2022-07-26 3e97294663 runtime/cgo: use frame address to set g0 stack bound
+ 2022-07-25 24dc27a3c0 cmd/compile: fix blank label code
+ 2022-07-25 9fcc8b2c1e runtime: fix runtime.Breakpoint() on windows/arm64
+ 2022-07-25 795a88d0c3 cmd/go: add space after comma in 'go help test'
+ 2022-07-25 9eb3992ddd doc/go1.19: minor fixes
+ 2022-07-25 dcea1ee6e3 time: clarify documentation for allowed formats and add tests to prove them
+ 2022-07-25 37c8112b82 internal/fuzz: fix typo in function comments
+ 2022-07-25 850d547d2d doc/go1.19: expand crypto release notes
+ 2022-07-24 64f2829c9c runtime: fix typo in function comments
+ 2022-07-24 2ff563a00e cmd/compile/internal/noder: correct spelling errors for instantiation
+ 2022-07-22 c5da4fb7ac cmd/compile: make jump table symbol local
+ 2022-07-22 774fa58d1d A+C: delete AUTHORS and CONTRIBUTORS
+ 2022-07-21 2d655fb15a unsafe: document when Sizeof/Offsetof/Alignof are not constant
+ 2022-07-21 076c3d7f07 net/http: remove accidental heading in Head documentation
+ 2022-07-21 c4a6d3048b cmd/dist: enable race detector test on S390X
+ 2022-07-20 244c8b0500 cmd/cgo: allow cgo to pass strings or []bytes bigger than 1<<30
+ 2022-07-20 df38614bd7 test: use go tool from tree, not path
+ 2022-07-20 bb1749ba3b cmd/compile: improve GOAMD64=v1 violation test
+ 2022-07-19 176b63e711 crypto/internal/nistec,debug/gosym: fix typos
+ 2022-07-19 8e1e64c16a cmd/compile: fix mknode script
+ 2022-07-19 28be440d34 A+C: add Weizhi Yan
+ 2022-07-19 85a482fc24 runtime: revert to using the precomputed trigger for pacer calculations
+ 2022-07-19 ae7340ab68 CONTRIBUTORS: update for the Go 1.19 release
+ 2022-07-18 de8101d21b runtime: fix typos
+ 2022-07-18 967a3d985d cmd/compile: revert "remove -installsuffix flag"
+ 2022-07-18 c0c1bbde17 http: improve Get documentation
+ 2022-07-15 2aa473cc54 go/types, types2: correct alignment of atomic.Int64
+ 2022-07-15 4651ebf961 encoding/gob: s/TestIngoreDepthLimit/TestIgnoreDepthLimit/
+ 2022-07-14 dc00aed6de go/parser: skip TestParseDepthLimit for short tests
+ 2022-07-14 783ff7dfc4 encoding/xml: skip TestCVE202230633 for short tests
+ 2022-07-14 aa80228526 cmd/go/internal/modfetch: avoid duplicating path components in Git fetch errors
+ 2022-07-14 b9d5a25442 cmd/go: save zip sums for downloaded modules in 'go mod download' in a workspace
+ 2022-07-14 a906d3dd09 cmd/go: avoid re-enqueuing workspace dependencies with errors
+ 2022-07-14 266c70c263 doc/go1.19: add a release note for 'go list -json=SomeField'
+ 2022-07-13 558785a0a9 cmd/compile: remove -installsuffix flag
+ 2022-07-13 1355ea3045 cmd/compile: remove -importmap flag
+ 2022-07-13 f71f3d1b86 misc/cgo/testshared: run tests only in GOPATH mode
+ 2022-07-13 feada53661 misc/cgo/testcshared: don't rely on an erroneous install target in tests
+ 2022-07-13 c006b7ac27 runtime: clear timerModifiedEarliest when last timer is deleted
+ 2022-07-13 923740a8cc cmd/compile: fix type assert in dict pass
+ 2022-07-12 bf2ef26be3 cmd/go: in script tests, avoid checking non-main packages for staleness
+ 2022-07-12 5f5cae7200 cmd/go: avoid indexing GOROOT packages when the compiler is 'gccgo'
+ 2022-07-12 c2edb2c841 cmd/go: port TestIssue16471 to a script test and add verbose logging
+ 2022-07-12 9c2526e637 cmd/go/internal/modfetch/codehost: add missing newline in '# lock' log message
+ 2022-07-12 85486bcccb image/jpeg: increase TestLargeImageWithShortData timeout by an order of magnitude
+ 2022-07-12 27794c4d4a cmd/go/internal/modload: ignore disallowed errors when checking for updates

Change-Id: Ic05832c8c7c33ab016386bf7e85d6bad62a8fb98

22 months agodoc: move Go 1.19 release notes to x/website
Dmitri Shuralyov [Mon, 1 Aug 2022 17:38:27 +0000 (13:38 -0400)]
doc: move Go 1.19 release notes to x/website

Now that the development of the Go 1.19 release is almost done, its
release notes are moved to their eventual long-term home in x/website
in CL 420417. Delete the initial development copy here.

For golang/go#51400.

Change-Id: I741285555af28ce9a64e7f8d2b9fe2a0f3e13c26
Reviewed-on: https://go-review.googlesource.com/c/go/+/420418
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
22 months agodoc: mention removal of cmd/compile's -importmap and -installsuffix flags
Matthew Dempsky [Wed, 13 Jul 2022 22:00:53 +0000 (15:00 -0700)]
doc: mention removal of cmd/compile's -importmap and -installsuffix flags

Updates #51225.

Change-Id: I820f3f5ba169635fee37c30e41b370c9399a436d
Reviewed-on: https://go-review.googlesource.com/c/go/+/417534
Reviewed-by: Russ Cox <rsc@golang.org>
22 months agodoc/go1.19: fix typo: EM_LONGARCH -> EM_LOONGARCH
WANG Xuerui [Mon, 1 Aug 2022 13:19:29 +0000 (21:19 +0800)]
doc/go1.19: fix typo: EM_LONGARCH -> EM_LOONGARCH

Another last-minute fix. The whole repo is checked case-insensitively
against "longarch" and this is the only occurrence.

Change-Id: If13c123c1e44001a346f1df1df9d839c699703b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/420494
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
22 months agodoc/go1.19: fix a few links that were missing trailing slashes
Brad Fitzpatrick [Wed, 27 Jul 2022 02:28:00 +0000 (19:28 -0700)]
doc/go1.19: fix a few links that were missing trailing slashes

They were part of a chain of three redirects. Now it's only two,
but that's #54081.

Change-Id: Ibfe6a17a372df61df40124892951b48577e4ced9
Reviewed-on: https://go-review.googlesource.com/c/go/+/419634
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agoruntime: fix typos
hopehook [Sat, 30 Jul 2022 14:11:32 +0000 (22:11 +0800)]
runtime: fix typos

Change-Id: I30c125be6cb321aa03ea827bd11c3169087e3d4c
Reviewed-on: https://go-review.googlesource.com/c/go/+/420314
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

22 months agocmd/dist: always pass -short=true with -quick
Ian Lance Taylor [Sat, 16 Jul 2022 23:08:35 +0000 (16:08 -0700)]
cmd/dist: always pass -short=true with -quick

Fixes #53818

Change-Id: I190a8bcf50d92b9c10e9980e630ebb362d8b19ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/417918
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
22 months agodoc/go1.19: minor adjustments and links
Russ Cox [Thu, 28 Jul 2022 17:06:28 +0000 (13:06 -0400)]
doc/go1.19: minor adjustments and links

A few last-minute clarifications before the release.

Change-Id: Ia0123441633c147aa3f76ea29ed26c7722e2416c
Reviewed-on: https://go-review.googlesource.com/c/go/+/419994
Reviewed-by: Ian Lance Taylor <iant@google.com>
22 months agodoc/go1.19: improve the loong64 release notes
WANG Xuerui [Sat, 16 Jul 2022 12:15:49 +0000 (20:15 +0800)]
doc/go1.19: improve the loong64 release notes

Link to the LoongArch documentations site, mention the ABI variant
supported, and add a note about the unfortunate old-world/new-world split
situation that users must be aware of.

Updates #46229
For #51400

Change-Id: I6789f509263a0dbf113481148665e7951aa6a989
Reviewed-on: https://go-review.googlesource.com/c/go/+/417715
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
22 months agoos/exec: add GODEBUG setting to opt out of ErrDot changes
Russ Cox [Wed, 27 Jul 2022 18:36:05 +0000 (14:36 -0400)]
os/exec: add GODEBUG setting to opt out of ErrDot changes

The changes are likely to break users, and we need
to make it easy to unbreak without code changes.

For #43724.
Fixes #53962.

Change-Id: I105c5d6c801d354467e0cefd268189c18846858e
Reviewed-on: https://go-review.googlesource.com/c/go/+/419794
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

22 months agomisc/cgo/test: use fewer threads in TestSetgidStress in long mode
Cherry Mui [Wed, 27 Jul 2022 16:59:16 +0000 (12:59 -0400)]
misc/cgo/test: use fewer threads in TestSetgidStress in long mode

TestSetgidStress originally spawns 1000 threads for stress testing.
It caused timeout on some builders so CL 415677 reduced to 50 in
short mode. But it still causes flaky timeouts in longtest
builders, so reduce the number of threads in long mode as well.

Should fix #53641.

Change-Id: I02f4ef8a143bb1faafe3d11ad223f36f5cc245c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/419453
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agomath/big: check buffer lengths in GobDecode
Roland Shoemaker [Fri, 15 Jul 2022 17:43:44 +0000 (10:43 -0700)]
math/big: check buffer lengths in GobDecode

In Float.GobDecode and Rat.GobDecode, check buffer sizes before
indexing slices.

Fixes #53871

Change-Id: I1b652c32c2bc7a0e8aa7620f7be9b2740c568b0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/417774
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tatiana Bradley <tatiana@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>

22 months agonet: document UDPConn.ReadFromUDPAddrPort's AddrPort result more
Brad Fitzpatrick [Tue, 26 Jul 2022 20:29:16 +0000 (13:29 -0700)]
net: document UDPConn.ReadFromUDPAddrPort's AddrPort result more

Clarify the form of its IPv4 addresses when listening on an
unspecified address.

(found while testing/reviewing CL 399454)

Change-Id: I62b367f5a4e6d340eb72dd7ec342080f1821e63e
Reviewed-on: https://go-review.googlesource.com/c/go/+/419614
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

22 months agonet: fix WriteMsgUDPAddrPort addr handling
database64128 [Fri, 29 Apr 2022 17:29:58 +0000 (17:29 +0000)]
net: fix WriteMsgUDPAddrPort addr handling

WriteMsgUDPAddrPort should accept IPv4 target addresses on IPv6 UDP sockets.
An IPv4 target address will be converted to an IPv4-mapped IPv6 address.

Fixes #52264.

Change-Id: Ib9ed4c61fa1289ae7bbc8c4c9de1a9951b647ec0
GitHub-Last-Rev: 6776fdb0a76faa71ebde58f5143fb1ffb3112adf
GitHub-Pull-Request: golang/go#52265
Reviewed-on: https://go-review.googlesource.com/c/go/+/399454
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
22 months agodoc/go1.19: note that updated race syso files require GNU ld 2.26
Ian Lance Taylor [Tue, 26 Jul 2022 19:50:02 +0000 (12:50 -0700)]
doc/go1.19: note that updated race syso files require GNU ld 2.26

For #54060

Change-Id: I6360565056d7fb7110ff00b0f3f9a3fc02ba7f2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/419595
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

22 months agobytes: document that Reader.Reset affects the result of Size
Muhammed Can Küçükaslan [Sun, 24 Jul 2022 21:44:11 +0000 (21:44 +0000)]
bytes: document that Reader.Reset affects the result of Size

The Reader.Reset changes the underlying byte slice, so it actually
changes the return value of the Size method.

Fixes #54018

Change-Id: I160deaa2244e95cb93303cb5dfb67a8d90a375ef
GitHub-Last-Rev: b04724a072d956db1f84a8f5db0afa0dbb158e96
GitHub-Pull-Request: golang/go#54020
Reviewed-on: https://go-review.googlesource.com/c/go/+/419237
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

22 months agoruntime/cgo: use frame address to set g0 stack bound
Cherry Mui [Mon, 25 Jul 2022 15:02:56 +0000 (11:02 -0400)]
runtime/cgo: use frame address to set g0 stack bound

For a cgo binary, at startup we set g0's stack bounds using the
address of a local variable (&size) in a C function x_cgo_init and
the stack size from pthread_attr_getstacksize. Normally, &size is
an address within the current stack frame. However, when  it is
compiled with ASAN, it may be instrumented to __asan_stack_malloc_0
and the address may not live in the current stack frame, causing
the stack bound to be set incorrectly, e.g. lo > hi.

Using __builtin_frame_address(0) to get the stack address instead.

Change-Id: I41df929e5ed24d8bbf3e15027af6dcdfc3736e37
Reviewed-on: https://go-review.googlesource.com/c/go/+/419434
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
22 months agocmd/compile: fix blank label code
Keith Randall [Sun, 24 Jul 2022 16:48:56 +0000 (09:48 -0700)]
cmd/compile: fix blank label code

When checkEnabled is forced true, the 52278 test fails. Be a bit
more careful about processing blank labels.

Update #52278

Change-Id: I48aa89e2c9e3715d8efe599bc4363b5b5879d8a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/419318
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
22 months agoruntime: fix runtime.Breakpoint() on windows/arm64
qmuntal [Thu, 21 Jul 2022 10:18:51 +0000 (12:18 +0200)]
runtime: fix runtime.Breakpoint() on windows/arm64

Fixes #53837

Change-Id: I4219fe35aac1a88aae2905998fbb1d7db87bbfb2
Reviewed-on: https://go-review.googlesource.com/c/go/+/418734
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Alessandro Arzilli <alessandro.arzilli@gmail.com>

22 months agocmd/go: add space after comma in 'go help test'
Justin Traglia [Wed, 20 Jul 2022 14:20:41 +0000 (14:20 +0000)]
cmd/go: add space after comma in 'go help test'

This PR fixes a simple typo. It adds a space after a comma. Noticed while looking at `go help test` output.

Change-Id: I5b54f4da0d08a056bffc04899983d858dfa91043
GitHub-Last-Rev: da9cab5eb946523b8783aafe4f05f516e4a77437
GitHub-Pull-Request: golang/go#53931
Reviewed-on: https://go-review.googlesource.com/c/go/+/418034
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
22 months agodoc/go1.19: minor fixes
Tobias Klauser [Fri, 22 Jul 2022 21:35:41 +0000 (23:35 +0200)]
doc/go1.19: minor fixes

EM_LONGARCH and R_LARCH_* are defined in package debug/elf. Change the
definition list title accordingly.

Format links sort.Find and sort.Search as code.

Add a link to syscall.Getrusage.

Change-Id: I30602baedda8ccac028101858a608f1d8ffb633b
Reviewed-on: https://go-review.googlesource.com/c/go/+/419214
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
22 months agotime: clarify documentation for allowed formats and add tests to prove them
Marcus Watkins [Thu, 21 Jul 2022 18:38:51 +0000 (12:38 -0600)]
time: clarify documentation for allowed formats and add tests to prove them

The existing documentation for the time.Layout const states "Only these values
are recognized", but then doesn't include the numeric forms for month leading to
ambiguity and assumptions that may not be true. It's unclear, for example,
that space padding is only available for day of the month.

Finally I add tests to show the behaviors in specific scenarios.

Change-Id: I4e08a14834c17b6bdf3b6b47d39dafa8c1a138fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/418875
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>

22 months agointernal/fuzz: fix typo in function comments
Abirdcfly [Sun, 24 Jul 2022 15:05:37 +0000 (15:05 +0000)]
internal/fuzz: fix typo in function comments

The correct word to use here is 'retrieve' not 'retrive'

Change-Id: I8de0961a254cf429ddbaf599fe996155e24c7af2
GitHub-Last-Rev: 65aaeec8db14c23e7bc8a62ce9ecfde98a263a49
GitHub-Pull-Request: golang/go#54026
Reviewed-on: https://go-review.googlesource.com/c/go/+/419317
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>