aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-03-10[release-branch.go1.15-security] go1.15.9go1.15.9Alexander Rakoczy
Change-Id: I99864b29d3bcbd07f3d8116d5997407152f1d462 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1014540 Reviewed-by: Katie Hockman <katiehockman@google.com>
2021-03-09[release-branch.go1.15-security] encoding/xml: prevent infinite loop while ↵Katie Hockman
decoding This change properly handles a TokenReader which returns an EOF in the middle of an open XML element. Thanks to Sam Whited for reporting this. Fixes CVE-2021-27918 Change-Id: Id02a3f3def4a1b415fa2d9a8e3b373eb6cb0f433 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1004594 Reviewed-by: Russ Cox <rsc@google.com> Reviewed-by: Roland Shoemaker <bracewell@google.com> Reviewed-by: Filippo Valsorda <valsorda@google.com> (cherry picked from commit e7ce1f6746223ec7b4caa3b1ece25d9be3864710) Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1014236
2021-02-04[release-branch.go1.15] go1.15.8go1.15.8Carlos Amedee
Change-Id: Ic8824cabbc8ae62360e0cda4b7c5604db7d405f3 Reviewed-on: https://go-review.googlesource.com/c/go/+/289694 Run-TryBot: Carlos Amedee <carlos@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Alexander Rakoczy <alex@golang.org> Trust: Alexander Rakoczy <alex@golang.org> Trust: Carlos Amedee <carlos@golang.org>
2021-02-04[release-branch.go1.15] runtime/cgo: fix Android build with NDK 22Elias Naur
Fixes #43406 Change-Id: I7d2b70098a4ba4dcb325fb0be076043789b86135 Reviewed-on: https://go-review.googlesource.com/c/go/+/280312 Run-TryBot: Elias Naur <mail@eliasnaur.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Elias Naur <mail@eliasnaur.com> (cherry picked from commit 1d78139128d6d839d7da0aeb10b3e51b6c7c0749) Reviewed-on: https://go-review.googlesource.com/c/go/+/289149
2021-02-03[release-branch.go1.15] runtime: don't adjust timer pp field in timerWaiting ↵Ian Lance Taylor
status Before this CL, the following sequence was possible: * GC scavenger starts and sets up scavenge.timer * GC calls readyForScavenger, but sysmon is sleeping * program calls runtime.GOMAXPROCS to shrink number of processors * procresize destroys a P, the one that scavenge.timer is on * (*pp).destroy calls moveTimers, which gets to the scavenger timer * scavenger timer is timerWaiting, and moveTimers clears t.pp * sysmon wakes up and calls wakeScavenger * wakeScavengers calls stopTimer on scavenger.timer, still timerWaiting * stopTimer calls deltimer which loads t.pp, which is still nil * stopTimer tries to increment deletedTimers on nil t.pp, and crashes The point of vulnerability is the time that t.pp is set to nil by moveTimers and the time that t.pp is set to non-nil by moveTimers, which is a few instructions at most. So it's not likely and in particular is quite unlikely on x86. But with a more relaxed memory model the area of vulnerability can be somewhat larger. This appears to tbe the cause of two builder failures in a few months on linux-mips. This CL fixes the problem by making moveTimers change the status from timerWaiting to timerMoving while t.pp is clear. That will cause deltimer to wait until the status is back to timerWaiting, at which point t.pp has been set again. For #43712 Fixes #43833 Change-Id: I66838319ecfbf15be66c1fac88d9bd40e2295852 Reviewed-on: https://go-review.googlesource.com/c/go/+/284775 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> (cherry picked from commit d2d155d1ae8c704a37f42fd3ebb1f3846f78e4d4) Reviewed-on: https://go-review.googlesource.com/c/go/+/287092 Run-TryBot: Carlos Amedee <carlos@golang.org>
2021-02-02[release-branch.go1.15] cmd/internal/goobj2: fix buglet in object file readerThan McIntosh
The code in the Go object file reader was casting a pointer to mmaped memory into a large array prior to performing a read of the relocations section: return (*[1<<20]Reloc)(unsafe.Pointer(&r.b[off]))[:n:n] For very large object files, this artificial array isn't large enough (that is, there are more than 1048576 relocs to read), so update the code to use a larger artifical array size. Fixes #43214. Updates #41621. Change-Id: Ic047c8aef4f8a3839f2e7e3594bce652ebd6bd5b Reviewed-on: https://go-review.googlesource.com/c/go/+/278492 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org> Trust: Than McIntosh <thanm@google.com> (cherry picked from commit f4e7a6b905ce60448e506a3f6578d01b60602cdd) Reviewed-on: https://go-review.googlesource.com/c/go/+/278673
2021-02-02[release-branch.go1.15] cmd/link/internal/ld/pe: fix segfault adding ↵Derek Parker
resource section The resource symbol may have been copied to the mmap'd output buffer. If so, certain conditions can cause that mmap'd output buffer to be munmap'd before we get a chance to use it. To avoid any issues we copy the data to the heap when the resource symbol exists. Fixes #42384 Change-Id: I32ef5420802d7313a3d965b8badfbcfb9f0fba4a GitHub-Last-Rev: 7b0f43011d06083ee3e871e48a87847636f738f9 GitHub-Pull-Request: golang/go#42427 Reviewed-on: https://go-review.googlesource.com/c/go/+/268018 Run-TryBot: Carlos Amedee <carlos@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com> Trust: Carlos Amedee <carlos@golang.org>
2021-02-02[release-branch.go1.15] cmd/go: don't lookup the path for CC when invoking cgoJay Conrod
Previously, if CC was a path without separators (like gcc or clang), we'd look it up in PATH in cmd/go using internal/execabs.LookPath, then pass the resolved path to cgo in CC. This caused a regression: if the directory in PATH containing CC has a space, cgo splits it and interprets it as multiple arguments. With this change, cmd/go no longer resolves CC before invoking cgo. cgo does the path lookup on each invocation. This reverts the security fix CL 284780, but that was redundant with the addition of internal/execabs (CL 955304), which still protects us. NOTE: This CL includes a related test fix from CL 286292. Fixes #43860 Change-Id: I65d91a1e303856df8653881eb6e2e75a3bf95c49 Reviewed-on: https://go-review.googlesource.com/c/go/+/285873 Trust: Jay Conrod <jayconrod@google.com> Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> (cherry picked from commit a2cef9b544708ecae983ed8836ee2425a28aab68) Reviewed-on: https://go-review.googlesource.com/c/go/+/285954 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2021-02-01[release-branch.go1.15] net/http: update bundled x/net/http2Damien Neil
Updates bundled http2 to x/net git rev 16c2bbf55 for: http2: send a nil error if we cancel a delayed body write https://golang.org/cl/288013 http2: wait until the request body has been written https://golang.org/cl/288012 Created by: go mod edit -replace=golang.org/x/net=golang.org/x/net@release-branch.go1.15-bundle GOFLAGS='-mod=mod' go generate -run=bundle std go mod edit -dropreplace=golang.org/x/net go get -d golang.org/x/net@release-branch.go1.15 go mod tidy go mod vendor Fixes golang/go#42539 Change-Id: I299c6d4a67ebc036e45c978e4d03cba73717b363 Reviewed-on: https://go-review.googlesource.com/c/go/+/288112 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-01-22[release-branch.go1.15] cmd/go: fix get_update_unknown_protocol testJay Conrod
This test needs to run in GOPATH mode. It broke when a go.mod file was added to github.com/golang/example. This change sets GO111MODULE=off, which matches master since CL 255051. Fixes #43861 Change-Id: I9ea109a99509fac3185756a0f0d852a84c677bf5 Reviewed-on: https://go-review.googlesource.com/c/go/+/285956 Trust: Jay Conrod <jayconrod@google.com> Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-01-21[release-branch.go1.15] cmd/compile: don't short-circuit copies whose source ↵Keith Randall
is volatile Current optimization: When we copy a->b and then b->c, we might as well copy a->c instead of b->c (then b might be dead and go away). *Except* if a is a volatile location (might be clobbered by a call). In that case, we really do want to copy a immediately, because there might be a call before we can do the a->c copy. User calls can't happen in between, because the rule matches up the memory states. But calls inserted for memory barriers, particularly runtime.typedmemmove, can. (I guess we could introduce a register-calling-convention version of runtime.typedmemmove, but that seems a bigger change than this one.) Fixes #43575 Change-Id: Ifa518bb1a6f3a8dd46c352d4fd54ea9713b3eb1a Reviewed-on: https://go-review.googlesource.com/c/go/+/282492 Trust: Keith Randall <khr@golang.org> Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> (cherry picked from commit 304f769ffc68e64244266b3aadbf91e6738c0064) Reviewed-on: https://go-review.googlesource.com/c/go/+/282558 Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-01-21[release-branch.go1.15] internal/execabs: only run tests on platforms that ↵Roland Shoemaker
support them Fixes #43793 Change-Id: I3bf022a28b194f0089ea96d93e56bbd9fb7e0aa8 Reviewed-on: https://go-review.googlesource.com/c/go/+/285056 Trust: Roland Shoemaker <roland@golang.org> Run-TryBot: Roland Shoemaker <roland@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-01-20[release-branch.go1.15] cmd/go: fix mod_get_fallback testJay Conrod
Fixes #43797 Change-Id: I3d791d0ac9ce0b523c78c649aaf5e339a7f63b76 Reviewed-on: https://go-review.googlesource.com/c/go/+/284797 Trust: Jay Conrod <jayconrod@google.com> Run-TryBot: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> (cherry picked from commit be28e5abc5ddca0d6b2d8c91b7bb9c05717154e7) Reviewed-on: https://go-review.googlesource.com/c/go/+/284799
2021-01-19[release-branch.go1.15] all: merge release-branch.go1.15-security into ↵Roland Shoemaker
release-branch.go1.15 Change-Id: I0b607475b3d767b712bfb3c9a350b32f3491517c
2021-01-19[release-branch.go1.15-security] go1.15.7go1.15.7Dmitri Shuralyov
Change-Id: Ieec3576afa00cadf91166bf4df39037702635b86 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/957920 Reviewed-by: Roland Shoemaker <bracewell@google.com>
2021-01-19[release-branch.go1.15-security] cmd/go: overwrite program name with full pathRoland Shoemaker
If the program path is resolved, replace the first argument of the exec.Cmd, which is the bare program name with the resolved path. Change-Id: I92cf5e6f4bb7c8fef9b59f5eab963f4e75b90d07 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/957908 Reviewed-by: Katie Hockman <katiehockman@google.com> Reviewed-by: Russ Cox <rsc@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> (cherry picked from commit a863cb56b33a24aad88f23f1d48629dc4b4b9539) Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/958254 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2021-01-16[release-branch.go1.15-security] all: introduce and use internal/execabsRoland Shoemaker
Introduces a wrapper around os/exec, internal/execabs, for use in all commands. This wrapper prevents exec.LookPath and exec.Command from running executables in the current directory. All imports of os/exec in non-test files in cmd/ are replaced with imports of internal/execabs. This issue was reported by RyotaK. Fixes CVE-2021-3115 Change-Id: I0423451a6e27ec1e1d6f3fe929ab1ef69145c08f Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/955304 Reviewed-by: Russ Cox <rsc@google.com> Reviewed-by: Katie Hockman <katiehockman@google.com> (cherry picked from commit 44f09a6990ccf4db601cbf8208c89ac4e888f884) Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/955308
2021-01-16[release-branch.go1.15-security] cmd/go: add test case for cgo CC settingRuss Cox
Change-Id: Ied986053a64447c5eac6369f6c9b69ed3d3f94d9 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/949415 Reviewed-by: Ian Lance Taylor <iant@google.com> (cherry picked from commit e97d4ed8dcc1fed64fe44b56dfdfb0f929aabb65) Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/955297 Reviewed-by: Katie Hockman <katiehockman@google.com>
2021-01-16[release-branch.go1.15-security] cmd/cgo: report exec errors a bit more clearlyRuss Cox
Change-Id: I0e6bebf0e2e6efdef4be880e0c6c7451b938924b Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/949417 Reviewed-by: Katie Hockman <katiehockman@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> (cherry picked from commit 4c2e5f85dda6ad5cc1d5be863ae62f2050f12be9) Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/955295
2021-01-16[release-branch.go1.15-security] cmd/go: pass resolved CC, GCCGO to cgoRuss Cox
This makes sure the go command and cgo agree about exactly which compiler is being used. This issue was reported by RyotaK. Fixes CVE-2021-3115. Change-Id: If171c5c8b2523efb5ea2d957e5ad1380a038149c Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/949416 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> (cherry picked from commit 4cf399ca38587a6e4a3e85b494cd9a9b4cc53378) Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/955293 Reviewed-by: Katie Hockman <katiehockman@google.com>
2021-01-16[release-branch.go1.15-security] crypto/elliptic: fix P-224 field reductionFilippo Valsorda
This patch fixes two independent bugs in p224Contract, the function that performs the final complete reduction in the P-224 field. Incorrect outputs due to these bugs were observable from a high-level P224().ScalarMult() call. The first bug was in the calculation of out3GT. That mask was supposed to be all ones if the third limb of the value is greater than the third limb of P (out[3] > 0xffff000). Instead, it was also set if they are equal. That meant that if the third limb was equal, the value was always considered greater than or equal to P, even when the three bottom limbs were all zero. There is exactly one affected value, P - 1, which would trigger the subtraction by P even if it's lower than P already. The second bug was more easily hit, and is the one that caused the known high-level incorrect output: after the conditional subtraction by P, a potential underflow of the lowest limb was not handled. Any values that trigger the subtraction by P (values between P and 2^224-1, and P - 1 due to the bug above) but have a zero lowest limb would produce invalid outputs. Those conditions apply to the intermediate representation before the subtraction, so they are hard to trace to precise inputs. This patch also adds a test suite for the P-224 field arithmetic, including a custom fuzzer that automatically explores potential edge cases by combining limb values that have various meanings in the code. contractMatchesBigInt in TestP224Contract finds the second bug in less than a second without being tailored to it, and could eventually find the first one too by combining 0, (1 << 28) - 1, and the difference of (1 << 28) and (1 << 12). The incorrect P224().ScalarMult() output was found by the elliptic-curve-differential-fuzzer project running on OSS-Fuzz and reported by Philippe Antoine (Catena cyber). Fixes CVE-2021-3114 Change-Id: I50176602d544de3da854270d66a293bcaca57ad7 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/947792 Reviewed-by: Katie Hockman <katiehockman@google.com> (cherry picked from commit 5fa534e9c7eaeaf875e53b98eac9342b0855b283) Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/955175
2020-12-16[release-branch.go1.15] doc/go1.15: mention 1.15.3 cgo restriction on empty ↵Ian Lance Taylor
structs For #40954 Change-Id: I6a30aed31a16e820817f4ca5c7f591222e922946 Reviewed-on: https://go-review.googlesource.com/c/go/+/277432 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Keith Randall <khr@golang.org> (cherry picked from commit 129bb1917b4914f0743ec9b4ef0dfb74df39c07d) Reviewed-on: https://go-review.googlesource.com/c/go/+/278573 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-12-03[release-branch.go1.15] go1.15.6go1.15.6Carlos Amedee
Change-Id: I9e050e1463f1bc01c04d1817aef2f81a5aac4d42 Reviewed-on: https://go-review.googlesource.com/c/go/+/275132 Run-TryBot: Carlos Amedee <carlos@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Trust: Carlos Amedee <carlos@golang.org>
2020-12-03[release-branch.go1.15] cmd/link: recompute heapPos after copyHeapCherry Zhang
Immediately after a forward Seek, the offset we're writing to is beyond len(buf)+len(heap): |<--- buf --->|<--- heap --->| ^ off If we do a copyHeap at this point, the new heapPos should not be 0: |<---------- buf ----------->|<-heap->| ^ off Recompute it. Updates #42082 Fixes #42948 Change-Id: Icb3e4e1c7bf7d1fd3d76a2e0d7dfcb319c661534 Reviewed-on: https://go-review.googlesource.com/c/go/+/270942 Run-TryBot: Carlos Amedee <carlos@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org> Trust: Cherry Zhang <cherryyz@google.com>
2020-12-03[release-branch.go1.15] cmd/compile: sign extend consant folding properlyKeith Randall
MOVLconst must have a properly sign-extended auxint constant. The bit operations in these rules don't enforce that invariant. The easiest fix is just to turn on properly typed auxint fields (which is what fixed this issue at tip). Fixes #42753 Change-Id: I264245fad45067a6ade65326f7fe681feb5f3739 Reviewed-on: https://go-review.googlesource.com/c/go/+/272028 Trust: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
2020-11-23[release-branch.go1.15] cmd/compile: do not emit an extra debug_line entry ↵Alessandro Arzilli
for the end of seq addr Uses DW_LNS_advance_pc directly, instead of calling putpclcdelta because the latter will create a new debug_line entry for the end of sequence address. Updates #42484. Fixes #42521. Change-Id: Ib6355605cac101b9bf37a3b4961ab0cee678a839 Reviewed-on: https://go-review.googlesource.com/c/go/+/268937 Trust: Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/269517
2020-11-20[release-branch.go1.15] internal/poll: use copy_file_range only on Linux ↵Tobias Klauser
kernel >= 5.3 https://man7.org/linux/man-pages/man2/copy_file_range.2.html#VERSIONS states: A major rework of the kernel implementation occurred in 5.3. Areas of the API that weren't clearly defined were clarified and the API bounds are much more strictly checked than on earlier kernels. Applications should target the behaviour and requirements of 5.3 kernels. Rather than attempting to detect the file system for source and destination files (which means two additional statfs syscalls) and skip copy_file_range in case of known defects (e.g. CIFS -> CIFS), just assume copy_file_range to be broken on kernels < 5.3. Fixes #42550 Change-Id: I3a531296182c1d6e341772cc9d2be5bf83e52575 Reviewed-on: https://go-review.googlesource.com/c/go/+/268338 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> (cherry picked from commit 1c7650aa93bd53b7df0bbb34693fc5a16d9f67af) Reviewed-on: https://go-review.googlesource.com/c/go/+/269759 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-11-20[release-branch.go1.15] runtime: block signals in needm before allocating MIan Lance Taylor
Otherwise, if a signal occurs just after we allocated the M, we can deadlock if the signal handler needs to allocate an M itself. For #42207 Fixes #42636 Change-Id: I76f44547f419e8b1c14cbf49bf602c6e645d8c14 Reviewed-on: https://go-review.googlesource.com/c/go/+/265759 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> (cherry picked from commit 368c40116434532dc0b53b72fa04788ca6742898) Reviewed-on: https://go-review.googlesource.com/c/go/+/271847
2020-11-16[release-branch.go1.15] cmd/go: permit CGO_LDFLAGS to appear in //go:ldflagIan Lance Taylor
For #42565 Fixes #42567 Change-Id: If7cf39905d124dbd54dfac6a53ee38270498efed Reviewed-on: https://go-review.googlesource.com/c/go/+/269818 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com> (cherry picked from commit 782cf560db4c919790fdb476d1bbe18e5ddf5ffd) Reviewed-on: https://go-review.googlesource.com/c/go/+/270137
2020-11-12[release-branch.go1.15] all: merge release-branch.go1.15-security into ↵Katie Hockman
release-branch.go1.15 Change-Id: I5690e7f4f7f04b9df1881fa60f3d3c6841cefe40
2020-11-12[release-branch.go1.15-security] go1.15.5go1.15.5Carlos Amedee
Change-Id: Id3b116c0f54c2131111bc8afacb8d81d06f96461 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/901407 Reviewed-by: Katie Hockman <katiehockman@google.com>
2020-11-11[release-branch.go1.15-security] math/big: fix shift for recursive divisionKatie Hockman
The previous s value could cause a crash for certain inputs. Will check in tests and documentation improvements later. Thanks to the Go Ethereum team and the OSS-Fuzz project for reporting this. Thanks to Rémy Oudompheng and Robert Griesemer for their help developing and validating the fix. Fixes CVE-2020-28362 Change-Id: Ibbf455c4436bcdb07c84a34fa6551fb3422356d3 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/899974 Reviewed-by: Roland Shoemaker <bracewell@google.com> Reviewed-by: Filippo Valsorda <valsorda@google.com> (cherry picked from commit 28015462c2a83239543dc2bef651e9a5f234b633) Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/901065
2020-11-11[release-branch.go1.15-security] cmd/go: in cgoflags, permit -DX1, prohibit ↵Ian Lance Taylor
-Wp,-D,opt Restrict -D and -U to ASCII C identifiers, but do permit trailing digits. When using -Wp, prohibit commas in -D values. Thanks to Imre Rad (https://www.linkedin.com/in/imre-rad-2358749b) for reporting this. Fixes CVE-2020-28367 Change-Id: Ibfc4dfdd6e6c258e131448e7682610c44eee9492 Reviewed-on: https://go-review.googlesource.com/c/go/+/267277 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/899924 Reviewed-by: Filippo Valsorda <valsorda@google.com>
2020-11-11[release-branch.go1.15-security] cmd/go, cmd/cgo: don't let bogus symbol set ↵Ian Lance Taylor
cgo_ldflag A hand-edited object file can have a symbol name that uses newline and other normally invalid characters. The cgo tool will generate Go files containing symbol names, unquoted. That can permit those symbol names to inject Go code into a cgo-generated file. If that Go code uses the //go:cgo_ldflag pragma, it can cause the C linker to run arbitrary code when building a package. If you build an imported package we permit arbitrary code at run time, but we don't want to permit it at package build time. This CL prevents this in two ways. In cgo, reject invalid symbols that contain non-printable or space characters, or that contain anything that looks like a Go comment. In the go tool, double check all //go:cgo_ldflag directives in generated code, to make sure they follow the existing LDFLAG restrictions. Thanks to Chris Brown and Tempus Ex for reporting this. Fixes CVE-2020-28366 Change-Id: Ia1ad8f3791ea79612690fa7d26ac451d0f6df7c1 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/895832 Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> (cherry picked from commit 6bc814dd2bbfeaafa41d314dd4cc591b575dfbf6) Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/901056 Reviewed-by: Filippo Valsorda <valsorda@google.com> Reviewed-by: Roland Shoemaker <bracewell@google.com>
2020-11-06[release-branch.go1.15] internal/poll: treat copy_file_range EIO as not-handledTobias Klauser
For #42334 Fixes #42369 Change-Id: Ife51df4e7d2539a04393abfdec45e3f902975fca Reviewed-on: https://go-review.googlesource.com/c/go/+/266940 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> (cherry picked from commit 633f9e206045176a12c301eb2c249c1c1d9a5d2e) Reviewed-on: https://go-review.googlesource.com/c/go/+/267917 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-11-05[release-branch.go1.15] go1.15.4go1.15.4Alexander Rakoczy
Change-Id: Ibcd61e2c7ef7cc6f8509dadea6c3952c5dd7016e Reviewed-on: https://go-review.googlesource.com/c/go/+/267879 Run-TryBot: Alexander Rakoczy <alex@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Trust: Alexander Rakoczy <alex@golang.org>
2020-10-30[release-branch.go1.15] net/http: update bundled x/net/http2Dmitri Shuralyov
Bring in the change in CL 266158 with: go mod edit -replace=golang.org/x/net=golang.org/x/net@release-branch.go1.15-bundle GOFLAGS='-mod=mod' go generate -run=bundle std go mod edit -dropreplace=golang.org/x/net go get -d golang.org/x/net@release-branch.go1.15 go mod tidy go mod vendor Updates #39337. Fixes #42113. Change-Id: I3ebef4b90c11ad271b7a3031aafd80c423c2c241 Reviewed-on: https://go-review.googlesource.com/c/go/+/266375 Trust: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2020-10-29[release-branch.go1.15] time: fix LoadLocationFromTZData with slim tzdataChristopher Hlubek
The extend information of a time zone file with last transition < now could result in a wrong cached zone because it used the zone of the last transition. This could lead to wrong zones in systems with slim zoneinfo. For #42216 Fixes #42138 Change-Id: I7c57c35b5cfa58482ac7925b5d86618c52f5444d Reviewed-on: https://go-review.googlesource.com/c/go/+/264939 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> (cherry picked from commit 70e022e4a83dc996ac4f108e811fbc399ad5565b) Reviewed-on: https://go-review.googlesource.com/c/go/+/266299 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-10-29[release-branch.go1.15] time: support slim tzdata formatIan Lance Taylor
Backport of part of https://golang.org/cl/261877 to support the slim tzdata format. As of tzdata 2020b, the default is to use the slim format. We need to support that format so that Go installations continue to work when tzdata is updated. Relevant part of the CL description: The reason for the failed tests was that when caching location data, the extended time format past the end of zone transitions was not considered. The respective change was introduced in (*Location).lookup by CL 215539. For #42138 Change-Id: I37f52a0917b2c6e3957e6b4612c8ef104c736e65 Reviewed-on: https://go-review.googlesource.com/c/go/+/264301 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-10-29[release-branch.go1.15] compress/flate: fix corrupted outputKlaus Post
The fastest compression mode can pick up a false match for every 2GB of input data resulting in incorrectly decompressed data. Since matches are allowed to be up to and including at maxMatchOffset we must offset the buffer by an additional element to prevent the first 4 bytes to match after an out-of-reach value after shiftOffsets has been called. We offset by `maxMatchOffset + 1` so offset 0 in the table will now fail the `if offset > maxMatchOffset` in all cases. Updates #41420. Fixes #41463. Change-Id: If1fbe01728e132b8a207e3f3f439edd832dcc710 GitHub-Last-Rev: 50fabab0da874c37543b139459a810e12e83cee2 GitHub-Pull-Request: golang/go#41477 Reviewed-on: https://go-review.googlesource.com/c/go/+/255879 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Joe Tsai <thebrokentoaster@gmail.com> Trust: Matthew Dempsky <mdempsky@google.com> (cherry picked from commit ab541a0560408999ac65d12bec2a3057994eda38) Reviewed-on: https://go-review.googlesource.com/c/go/+/266177 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Trust: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2020-10-29[release-branch.go1.15] cmd/go/internal/modfetch: drop ↵Tobias Klauser
gopkg.in/russross/blackfriday.v2 from TestCodeRepoVersions Follow-up for CL 265819. Given the -pre tag added recently, a new stable version is likely tagged soon. This would break TestCodeRepoVersions on the longtest builders again. Since the other test cases in codeRepoVersionsTests already provide enough coverage, drop gopkg.in/russross/blackfriday.v2 to avoid breaking TestCodeRepoVersions once the release happens. Updates #28856 Change-Id: If86a637b5e47f59faf9048fc1cbbae6e8f1dcc53 Reviewed-on: https://go-review.googlesource.com/c/go/+/265917 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org> (cherry picked from commit 421d4e72de802ed65cb38317660654771cfb13e9) Reviewed-on: https://go-review.googlesource.com/c/go/+/266178 Trust: Dmitri Shuralyov <dmitshur@golang.org> Trust: Jay Conrod <jayconrod@google.com> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-10-27[release-branch.go1.15] cmd/compile: fix storeType to handle pointers to ↵Keith Randall
go:notinheap types storeType splits compound stores up into a scalar parts and a pointer parts. The scalar part happens unconditionally, and the pointer part happens under the guard of a write barrier check. Types which are declared as pointers, but are represented as scalars because they might have "bad" values, were not handled correctly here. They ended up not getting stored in either set. Fixes #42151 Change-Id: I46f6600075c0c370e640b807066247237f93c7ac Reviewed-on: https://go-review.googlesource.com/c/go/+/264300 Trust: Keith Randall <khr@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> (cherry picked from commit 933721b8c7f981229974e2603850c2e9a7ffc5a1) Reviewed-on: https://go-review.googlesource.com/c/go/+/265719 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
2020-10-27[release-branch.go1.15] cmd/compile, runtime: store pointers to go:notinheap ↵Keith Randall
types indirectly pointers to go:notinheap types should be treated as scalars. That means they shouldn't be stored directly in interfaces, or directly in reflect.Value.ptr. Also be sure to use uintpr to compare such pointers in reflect.DeepEqual. Fixes #42169 Change-Id: I53735f6d434e9c3108d4940bd1bae14c61ef2a74 Reviewed-on: https://go-review.googlesource.com/c/go/+/264480 Trust: Keith Randall <khr@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> (cherry picked from commit 009d71409821a6ac4f1b32aaae2c856c20a29f92) Reviewed-on: https://go-review.googlesource.com/c/go/+/265720 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
2020-10-23[release-branch.go1.15] cmd/{compile,link}: backport fix for issue 39757Than McIntosh
During Go 1.15 development, a fix was added to the toolchain for issue information. The 1.15 line tables were slightly malformed in the way that they used the DWARF "end sequence" operator, resulting in incorrect line table info for the final instruction in the final function of a compilation unit. This problem was fixed in https://golang.org/cl/235739, which made it into Go 1.15. It now appears that while the fix works OK for linux, in certain cases it causes issues with the Darwin linker (the "address not in any section" ld64 error reported in issue #40974). During Go 1.16 development, the fix in https://golang.org/cl/235739 was revised so as to fix another related problem (described in issue #39757); the newer fix does not trigger the problem in the Darwin linker however. This CL back-ports the changes in https://golang.org/cl/239286 to the 1.15 release branch, so as to fix the Darwin linker error. Updates #38192. Updates #39757. Fixes #40974. Change-Id: I9350fec4503cd3a76b97aaea0d8aed1511662e29 Reviewed-on: https://go-review.googlesource.com/c/go/+/258422 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Trust: Than McIntosh <thanm@google.com>
2020-10-23[release-branch.go1.15] net/http: deep copy Request.TransferEncodingdqu123
The existing implementation in Request.Clone() assigns the wrong pointer to r2.TransferEncoding. Updates #41907. Fixes #41914. Change-Id: I7f220a41b1b46a55d1a1005e47c6dd69478cb025 Reviewed-on: https://go-review.googlesource.com/c/go/+/261378 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Carlos Amedee <carlos@golang.org> Trust: Emmanuel Odeke <emm.odeke@gmail.com>
2020-10-22[release-branch.go1.15] src, net/http: update vendor, regenerate h2_bundle.goEmmanuel T Odeke
Features CL: net/http2: send WINDOW_UPDATE on a body's write failure https://golang.org/cl/258478 (updates #41387) Created by: go mod edit -replace=golang.org/x/net=golang.org/x/net@release-branch.go1.15-bundle GOFLAGS='-mod=mod' go generate -run=bundle std go mod edit -dropreplace=golang.org/x/net go get -d golang.org/x/net@release-branch.go1.15 go mod tidy go mod vendor Updates #40423 Fixes #41387 Change-Id: I052037d6b6ed38b9d9782e19b8ce283875354c92 Reviewed-on: https://go-review.googlesource.com/c/go/+/258540 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Trust: Emmanuel Odeke <emm.odeke@gmail.com>
2020-10-20[release-branch.go1.15] runtime: wait for preemption signals before syscall.ExecIan Lance Taylor
For #41702 For #41704 For #42023 Change-Id: If07f40b1d73b8f276ee28ffb8b7214175e56c24d Reviewed-on: https://go-review.googlesource.com/c/go/+/262817 Trust: Ian Lance Taylor <iant@golang.org> Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> (cherry picked from commit 05739d6f17c57f09264272621b88725a463234d0) Reviewed-on: https://go-review.googlesource.com/c/go/+/264022
2020-10-20[release-branch.go1.15] syscall: use MustHaveExec in TestExecIan Lance Taylor
For #41702 For #41704 Change-Id: Ib2b15e52aa1fef2f5e644b316c726150252fa9f8 Reviewed-on: https://go-review.googlesource.com/c/go/+/262738 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> (cherry picked from commit 11cfb48df192c14d185c1cfcaad1ba3e7b84c807) Reviewed-on: https://go-review.googlesource.com/c/go/+/264020
2020-10-20[release-branch.go1.15] runtime: stop preemption during syscall.Exec on DarwinIan Lance Taylor
On current macOS versions a program that receives a signal during an execve can fail with a SIGILL signal. This appears to be a macOS kernel bug. It has been reported to Apple. This CL partially works around the problem by using execLock to not send preemption signals during execve. Of course some other stray signal could occur, but at least we can avoid exacerbating the problem. We can't simply disable signals, as that would mean that the exec'ed process would start with all signals blocked, which it likely does not expect. For #41702 Fixes #41704 Change-Id: I91b0add967b315671ddcf73269c4d30136e579b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/262438 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> (cherry picked from commit 64fb6ae95f1c322486cbfb758552bb8439a8e6e8) Reviewed-on: https://go-review.googlesource.com/c/go/+/262717
2020-10-14[release-branch.go1.15] go1.15.3go1.15.3Alexander Rakoczy
Change-Id: I8a45870039d0d3f210d883c464a7fed2abd9e28b Reviewed-on: https://go-review.googlesource.com/c/go/+/262337 Run-TryBot: Alexander Rakoczy <alex@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Trust: Alexander Rakoczy <alex@golang.org>