aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-03-23[dev.boringcrypto.go1.15] all: merge go1.15.10 into dev.boringcrypto.go1.15Filippo Valsorda
Change-Id: I2ac6b45dbfcfdaf956f2f4b11b60f8d24130141b
2021-03-11[release-branch.go1.15] go1.15.10go1.15.10Carlos Amedee
Change-Id: Ib4e90da6307bb80be8b9d67e0efa35d9dd5dd463 Reviewed-on: https://go-review.googlesource.com/c/go/+/300970 Run-TryBot: Carlos Amedee <carlos@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Trust: Carlos Amedee <carlos@golang.org>
2021-03-10[dev.boringcrypto.go1.15] all: merge go1.15.9 into dev.boringcrypto.go1.15Filippo Valsorda
Change-Id: I618981e3ae425ce492aa9affb2703f074d778198
2021-03-10[release-branch.go1.15] cmd/go: don't report missing std import errors for ↵Jay Conrod
tidy and vendor 'go mod tidy' and 'go mod vendor' normally report errors when a package can't be imported, even if the import appears in a file that wouldn't be compiled by the current version of Go. These errors are common for packages introduced in higher versions of Go, like "embed" in 1.16. This change causes 'go mod tidy' and 'go mod vendor' to ignore missing package errors if the import path appears to come from the standard library because it lacks a dot in the first path element. NOTE: This change is not a clean cherry-pick of CL 298749 because parts of modload were substantially rewritten after 1.15. Fixes #44792 Updates #27063 Change-Id: I61d6443e77ab95fd8c0d1514f57ef4c8885a77cc Reviewed-on: https://go-review.googlesource.com/c/go/+/298749 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 56d52e661114be60fb1893b034ac0c5976b622af) Reviewed-on: https://go-review.googlesource.com/c/go/+/298950
2021-03-10[release-branch.go1.15] all: merge release-branch.go1.15-security into ↵Katie Hockman
release-branch.go1.15 Change-Id: I755738ad72337dcb4f942ffd1dc5d699e6bb027d
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-03-02[release-branch.go1.15] net/http: add connections back that haven't been ↵Michael Fraenkel
canceled Issue #41600 fixed the issue when a second request canceled a connection while the first request was still in roundTrip. This uncovered a second issue where a request was being canceled (in roundtrip) but the connection was put back into the idle pool for a subsequent request. The fix is the similar except its now in readLoop instead of roundTrip. A persistent connection is only added back if it successfully removed the cancel function; otherwise we know the roundTrip has started cancelRequest. Fixes #42935. Updates #42942. Change-Id: Ia56add20880ccd0c1ab812d380d8628e45f6f44c Reviewed-on: https://go-review.googlesource.com/c/go/+/274973 Trust: Dmitri Shuralyov <dmitshur@golang.org> Trust: Damien Neil <dneil@google.com> Reviewed-by: Damien Neil <dneil@google.com> (cherry picked from commit 854a2f8e01a554d8052445563863775406a04b71) Reviewed-on: https://go-review.googlesource.com/c/go/+/297910 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
2021-03-02[release-branch.go1.15] net/http: ignore connection closes once done with ↵Michael Fraenkel
the connection Once the connection is put back into the idle pool, the request should not take any action if the connection is closed. For #42935. Updates #41600. Change-Id: I5e4ddcdc03cd44f5197ecfbe324638604961de84 Reviewed-on: https://go-review.googlesource.com/c/go/+/257818 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Trust: Damien Neil <dneil@google.com> (cherry picked from commit 212d385a2f723a8dd5e7d2e83efb478ddd139349) Reviewed-on: https://go-review.googlesource.com/c/go/+/297909 Trust: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
2021-03-01[release-branch.go1.15] cmd/compile: fix escape analysis of heap-allocated ↵Matthew Dempsky
results One of escape analysis's responsibilities is to summarize whether/how each function parameter flows to the heap so we can correctly incorporate those flows into callers' escape analysis data flow graphs. As an optimization, we separately record when parameters flow to result parameters, so that we can more precisely analyze parameter flows based on how the results are used at the call site. However, if a named result parameter itself needs to be heap allocated, this optimization isn't safe and the parameter needs to be recorded as flowing to heap rather than flowing to result. Escape analysis used to get this correct because it conservatively rewalked the data-flow graph multiple times. So even though it would incorrectly record the result parameter flow, it would separately find a flow to the heap. However, CL 196811 (specifically, case 3) optimized the walking logic to reduce unnecessary rewalks causing us to stop finding the extra heap flow. This CL fixes the issue by correcting location.leakTo to be sensitive to sink.escapes and not record result-flows when the result parameter escapes to the heap. Fixes #44658. Change-Id: I48742ed35a6cab591094e2d23a439e205bd65c50 Reviewed-on: https://go-review.googlesource.com/c/go/+/297289 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-on: https://go-review.googlesource.com/c/go/+/297291
2021-03-01[release-branch.go1.15] time: correct unusual extension string casesIan Lance Taylor
This fixes two uncommon cases. First, the tzdata code permits timezone offsets up to 24 * 7, although the POSIX TZ parsing does not. The tzdata code uses this to specify a day of week in some cases. Second, we incorrectly rejected a negative time offset for when a time zone change comes into effect. For #44385 Fixes #44617 Change-Id: I5f2efc1d385e9bfa974a0de3fa81e7a94b827602 Reviewed-on: https://go-review.googlesource.com/c/go/+/296392 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> (cherry picked from commit d9fd38e68ba00a51c2c7363150688d0e7687ef84) Reviewed-on: https://go-review.googlesource.com/c/go/+/297229
2021-03-01[release-branch.go1.15] syscall: do not overflow key memory in ↵Jason A. Donenfeld
GetQueuedCompletionStatus The third argument to GetQueuedCompletionStatus is a pointer to a uintptr, not a uint32. Users of this functions have therefore been corrupting their memory every time they used it. Either that memory corruption was silent (dangerous), or their programs didn't work so they chose a different API to use. This fixes the problem by passing through an intermediate buffer. Updates #44538. Fixes #44592. Change-Id: Icacd71f705b36e41e52bd8c4d74898559a27522f Reviewed-on: https://go-review.googlesource.com/c/go/+/296151 Trust: Jason A. Donenfeld <Jason@zx2c4.com> Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-03-01[release-branch.go1.15] cmd/compile: do not assume TST and TEQ set V on armJason A. Donenfeld
These replacement rules assume that TST and TEQ set V. But TST and TEQ do not set V. This is a problem because instructions like LT are actually checking for N!=V. But with TST and TEQ not setting V, LT doesn't do anything meaningful. It's possible to construct trivial miscompilations from this, such as: package main var x = [4]int32{-0x7fffffff, 0x7fffffff, 2, 4} func main() { if x[0] > x[1] { panic("fail 1") } if x[2]&x[3] < 0 { panic("fail 2") // Fails here } } That first comparison sets V, via the CMP that subtracts the values causing the overflow. Then the second comparison operation thinks that it uses the result of TST, when it actually uses the V from CMP. Before this fix: TST R0, R1 BLT loc_6C164 After this fix: TST R0, R1 BMI loc_6C164 The BMI instruction checks the N flag, which TST sets. This commit fixes the issue by using [LG][TE]noov instead of vanilla [LG][TE], and also adds a test case for the direct issue. Updates #42876. Fixes #42930. Change-Id: I13c62c88d18574247ad002b671b38d2d0b0fc6fa Reviewed-on: https://go-review.googlesource.com/c/go/+/282432 Trust: Jason A. Donenfeld <Jason@zx2c4.com> Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-26[release-branch.go1.15] internal/poll: netpollcheckerr before sendfileWei Fu
In net/http package, the ServeContent/ServeFile doesn't check the I/O timeout error from chunkWriter or *net.TCPConn, which means that both HTTP status and headers might be missing when WriteTimeout happens. If the poll.SendFile() doesn't check the *poll.FD state before sending data, the client will only receive the response body with status and report "malformed http response/status code". This patch is to enable netpollcheckerr before sendfile, which should align with normal *poll.FD.Write() and Splice(). For #43822 Fixes #44294 Change-Id: I32517e3f261bab883a58b577b813ef189214b954 Reviewed-on: https://go-review.googlesource.com/c/go/+/285914 Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Trust: Emmanuel Odeke <emmanuel@orijtech.com> Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> (cherry picked from commit f0d23c9dbb2142b975fa8fb13a57213d0c15bdd1) Reviewed-on: https://go-review.googlesource.com/c/go/+/296530 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
2021-02-16[release-branch.go1.15] internal/poll: if copy_file_range returns 0, assume ↵Ian Lance Taylor
it failed On current Linux kernels copy_file_range does not correctly handle files in certain special file systems, such as /proc. For those file systems it fails to copy any data and returns zero. This breaks Go's io.Copy for those files. Fix the problem by assuming that if copy_file_range returns 0 the first time it is called on a file, that that file is not supported. In that case fall back to just using read. This will force an extra system call when using io.Copy to copy a zero-sized normal file, but at least it will work correctly. For #36817 For #44272 Fixes #44273 Change-Id: I02e81872cb70fda0ce5485e2ea712f219132e614 Reviewed-on: https://go-review.googlesource.com/c/go/+/291989 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> (cherry picked from commit 30641e36aa5b547eee48565caa3078b0a2e7c185) Reviewed-on: https://go-review.googlesource.com/c/go/+/292289
2021-02-05[dev.boringcrypto.go1.15] all: merge go1.15.8 into dev.boringcrypto.go1.15Dmitri Shuralyov
Change-Id: Ife009bce76e8aecb2255c69dbb5cadb61c22d2c3
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[dev.boringcrypto.go1.15] all: merge go1.15.7 into dev.boringcrypto.go1.15Roland Shoemaker
Change-Id: I2d5a481ef3862f558467c6d71f46e483cc50e1fe
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-07[dev.boringcrypto.go1.15] all: merge go1.15.6 into dev.boringcrypto.go1.15Filippo Valsorda
Change-Id: I0c17db50b6cab4b59d26e8e247870c0d709665b5
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-13[dev.boringcrypto.go1.15] all: merge go1.15.5 into dev.boringcrypto.go1.15Filippo Valsorda
Change-Id: I075fd29b5d035cac905c7bc3145405bf622a981b
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>