aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-09-10[dev.boringcrypto.go1.14] all: merge go1.14.9 into dev.boringcrypto.go1.14Filippo Valsorda
Change-Id: I810ef54d98b21ce3dfa51e55ec17ba2bab72f3e4
2020-09-09[release-branch.go1.14] go1.14.9go1.14.9Dmitri Shuralyov
Change-Id: I556ecd19f81692ddbd3faf1d918e36466833f12e Reviewed-on: https://go-review.googlesource.com/c/go/+/253737 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Alexander Rakoczy <alex@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-09-03[release-branch.go1.14] cmd/compile, runtime: mark R12 clobbered for write ↵Cherry Zhang
barrier call on PPC64 When external linking, for large binaries, the external linker may insert a trampoline for the write barrier call, which looks 0000000005a98cc8 <__long_branch_runtime.gcWriteBarrier>: 5a98cc8: 86 01 82 3d addis r12,r2,390 5a98ccc: d8 bd 8c e9 ld r12,-16936(r12) 5a98cd0: a6 03 89 7d mtctr r12 5a98cd4: 20 04 80 4e bctr It clobbers R12 (and CTR, which is never live across a call). As at compile time we don't know whether the binary is big and what link mode will be used, I think we need to mark R12 as clobbered for write barrier call. For extra safety (future-proof) we mark caller-saved register that cannot be used for function arguments, which includes R11, as potentially clobbered as well. Updates #40851. Fixes #40938. Change-Id: Iedd901c5072f1127cc59b0a48cfeb4aaec81b519 Reviewed-on: https://go-review.googlesource.com/c/go/+/248917 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> (cherry picked from commit b58d29741650c7bf10b17f455666e2727e1cdd2e) Reviewed-on: https://go-review.googlesource.com/c/go/+/249697
2020-09-03[release-branch.go1.14] cmd/internal/obj: stop removing NOPs from ↵Keith Randall
instruction stream This has already been done for s390x, ppc64. This CL is for all the other architectures. Fixes #40797 Change-Id: Idd1816e057df63022d47e99fa06617811d8c8489 Reviewed-on: https://go-review.googlesource.com/c/go/+/248684 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> (cherry picked from commit 46ca7b5ee2a8582736f1ddac27d8660e1104c345) Reviewed-on: https://go-review.googlesource.com/c/go/+/249443 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2020-09-03[release-branch.go1.14] cmd/internal/obj/ppc64: don't remove NOP in assemblerLynn Boger
Previously, the assembler removed NOPs from the Prog list in obj9.go. NOPs shouldn't be removed if they were added as an inline mark, as described in the issue below. Fixes #40766 Once the NOPs were left in the Prog list, some instructions were flagged as invalid because they had an operand which was not represented in optab. In order to preserve the previous assembler behavior, entries were added to optab for those operand cases. They were not flagged as errors before because the NOP instructions were removed before the code to check the valid opcode/operand combinations. Change-Id: Iae5145f94459027cf458e914d7c5d6089807ccf8 Reviewed-on: https://go-review.googlesource.com/c/go/+/247842 Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Paul Murphy <murp@ibm.com> Reviewed-by: Michael Munday <mike.munday@ibm.com> Reviewed-by: Keith Randall <khr@golang.org> (cherry picked from commit 7d7bd5abc7f7ac901830b79496f63ce86895e262) Reviewed-on: https://go-review.googlesource.com/c/go/+/248382 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2020-09-02[release-branch.go1.14] net/http/fgci: skip flaky testFilippo Valsorda
A test introduced in the security release is flaky due to a pre-existing issue that does not qualify for backport itself. Updates #41167 Fixes #41192 Change-Id: Ie6014e0796c1baee7b077881b5a799f9947fc9c2 Reviewed-on: https://go-review.googlesource.com/c/go/+/252718 Run-TryBot: Filippo Valsorda <filippo@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-09-02[release-branch.go1.14] doc/go1.14: document json.Umarshal map key support ↵ShihCheng Tu
of TextUnmarshaler Document that json.Unmarshal supports map keys whose underlying types implement encoding.TextUnmarshaler. Updates #38801. Fixes #38904. Change-Id: Icb9414e9067517531ba0da910bd4a2bb3daace65 Reviewed-on: https://go-review.googlesource.com/c/go/+/237857 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> (cherry picked from commit 47b450997778163dfed6f58cae379d928fc37687) Reviewed-on: https://go-review.googlesource.com/c/go/+/252617 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org>
2020-09-01[release-branch.go1.14] testing: treat PAUSE lines as changing the active ↵Bryan C. Mills
test name We could instead fix cmd/test2json to treat PAUSE lines as *not* changing the active test name, but that seems like it would be more confusing to humans, and also wouldn't fix tools that parse output using existing builds of cmd/test2json. Fixes #40848 Updates #40657 Change-Id: I937611778f5b1e7dd1d6e9f44424d7e725a589ed Reviewed-on: https://go-review.googlesource.com/c/go/+/248727 Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jean de Klerk <deklerk@google.com> (cherry picked from commit cdc77d34d7770ed02d84b9193380f9646017dce6) Reviewed-on: https://go-review.googlesource.com/c/go/+/249098 TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-09-01[release-branch.go1.14] all: merge release-branch.go1.14-security into ↵Filippo Valsorda
release-branch.go1.14 Change-Id: I52c14764e354cb9b11be6019cf8fb44930786ab8
2020-09-01[release-branch.go1.14-security] go1.14.8go1.14.8Dmitri Shuralyov
Change-Id: Ie582b6c53c6b120c56fbdd22b0c6946dd87f093b Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/835358 Reviewed-by: Filippo Valsorda <valsorda@google.com>
2020-09-01[release-branch.go1.14-security] net/http/cgi,net/http/fcgi: add ↵Roberto Clapis
Content-Type detection This CL ensures that responses served via CGI and FastCGI have a Content-Type header based on the content of the response if not explicitly set by handlers. If the implementers of the handler did not explicitly specify a Content-Type both CGI implementations would default to "text/html", potentially causing cross-site scripting. Thanks to RedTeam Pentesting GmbH for reporting this. Fixes CVE-2020-24553 Change-Id: I82cfc396309b5ab2e8d6e9a87eda8ea7e3799473 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/823217 Reviewed-by: Russ Cox <rsc@google.com> (cherry picked from commit 23d675d07fdc56aafd67c0a0b63d5b7e14708ff0) Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/835312 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2020-08-27[release-branch.go1.14] net/http: fix cancelation of requests with a ↵Damien Neil
readTrackingBody wrapper Use the original *Request in the reqCanceler map, not the transient wrapper created to handle body rewinding. Change the key of reqCanceler to a struct{*Request}, to make it more difficult to accidentally use the wrong request as the key. Updates #40453. Fixes #41016. Change-Id: I4e61ee9ff2c794fb4c920a3a66c9a0458693d757 Reviewed-on: https://go-review.googlesource.com/c/go/+/245357 Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-on: https://go-review.googlesource.com/c/go/+/250299 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
2020-08-27[release-branch.go1.14] net/http: make Transport.RoundTrip preserve RequestsDamien Neil
Ensure that the exact Request passed to Transport.RoundTrip is returned in the Response. Do not replace the Request with a copy when resetting the request body. Updates #39533. Fixes #40973. Change-Id: Ie6fb080c24b0f6625b0761b7aa542af3d2411817 Reviewed-on: https://go-review.googlesource.com/c/go/+/237560 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-on: https://go-review.googlesource.com/c/go/+/249880 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
2020-08-27[release-branch.go1.14] net/http: handle body rewind in HTTP/2 connection ↵Russ Cox
loss better In certain cases the HTTP/2 stack needs to resend a request. It obtains a fresh body to send by calling req.GetBody. This call was missing from the path where the HTTP/2 round tripper returns ErrSkipAltProtocol, meaning fall back to HTTP/1.1. The result was that the HTTP/1.1 fallback request was sent with no body at all. This CL changes that code path to rewind the body before falling back to HTTP/1.1. But rewinding the body is easier said than done. Some requests have no GetBody function, meaning the body can't be rewound. If we need to rewind and can't, that's an error. But if we didn't read anything, we don't need to rewind. So we have to track whether we read anything, with a new ReadCloser wrapper. That in turn requires adding to the couple places that unwrap Body values to look at the underlying implementation. This CL adds the new rewinding code in the main retry loop as well. The new rewindBody function also takes care of closing the old body before abandoning it. That was missing in the old rewind code. Thanks to Aleksandr Razumov for CL 210123 and to Jun Chen for CL 234358, both of which informed this CL. Updates #32441. Fixes #39279. Change-Id: Id183758526c087c6b179ab73cf3b61ed23a2a46a Reviewed-on: https://go-review.googlesource.com/c/go/+/234894 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> (cherry picked from commit e3491c46034cecbaf0f33928b09e1e3c0c6a0d20) Reviewed-on: https://go-review.googlesource.com/c/go/+/242117 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-08-22[release-branch.go1.14] runtime: detect services in signal handlerJason A. Donenfeld
The service handler needs to handle CTRL+C-like events -- including those sent by the service manager itself -- using the default Windows implementation if no signal handler from Go is already listening to those events. Ordinarily, the signal handler would call exit(2), but we actually need to allow this to be passed onward to the service handler. So, we detect if we're in a service and skip calling exit(2) in that case, just like we do for shared libraries. Updates #40167. Updates #40074. Fixes #40411. Change-Id: Ia77871737a80e1e94f85b02d26af1fd2f646af96 Reviewed-on: https://go-review.googlesource.com/c/go/+/244958 Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2020-08-22[release-branch.go1.14] runtime: ensure startm new M is consistently visible ↵Michael Pratt
to checkdead If no M is available, startm first grabs an idle P, then drops sched.lock and calls newm to start a new M to run than P. Unfortunately, that leaves a window in which a G (e.g., returning from a syscall) may find no idle P, add to the global runq, and then in stopm discover that there are no running M's, a condition that should be impossible with runnable G's. To avoid this condition, we pre-allocate the new M ID in startm before dropping sched.lock. This ensures that checkdead will see the M as running, and since that new M must eventually run the scheduler, it will handle any pending work as necessary. Outside of startm, most other calls to newm/allocm don't have a P at all. The only exception is startTheWorldWithSema, which always has an M if there is 1 P (i.e., the currently running M), and if there is >1 P the findrunnable spinning dance ensures the problem never occurs. This has been tested with strategically placed sleeps in the runtime to help induce the correct race ordering, but the timing on this is too narrow for a test that can be checked in. For #40368 Fixes #40398 Change-Id: If5e0293a430cc85154b7ed55bc6dadf9b340abe2 Reviewed-on: https://go-review.googlesource.com/c/go/+/245018 Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> (cherry picked from commit 85afa2eb190d5d1a06584803bde4b4ee9b0e79b0) Reviewed-on: https://go-review.googlesource.com/c/go/+/245297
2020-08-22[release-branch.go.1.14] runtime: validate candidate searchAddr in ↵Michael Anthony Knyszek
pageAlloc.find Currently pageAlloc.find attempts to find a better estimate for the first free page in the heap, even if the space its looking for isn't necessarily going to be the first free page in the heap (e.g. if npages >= 2). However, in doing so it has the potential to return a searchAddr candidate that doesn't actually correspond to mapped memory, but this candidate might still be adopted. As a result, pageAlloc.alloc's fast path may look at unmapped summary memory and segfault. This case is rare on most operating systems since the heap is kept fairly contiguous, so the chance that the candidate searchAddr discovered is unmapped is fairly low. Even so, this is totally possible and outside the user's control when it happens (in fact, it's likely to happen consistently for a given user on a given system). Fix this problem by ensuring that our candidate always points to mapped memory. We do this by looking at mheap's arenas structure first. If it turns out our candidate doesn't correspond to mapped memory, then we look at inUse to round up the searchAddr to the next mapped address. While we're here, clean up some documentation related to searchAddr. For #40191. Fixes #40192. Change-Id: I759efec78987e4a8fde466ae45aabbaa3d9d4214 Reviewed-on: https://go-review.googlesource.com/c/go/+/242680 Run-TryBot: Michael Knyszek <mknyszek@google.com> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> (cherry picked from commit b56791cdea5caa87ffcd585d29c294bd3d08a06a) Reviewed-on: https://go-review.googlesource.com/c/go/+/246197 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2020-08-21[release-branch.go1.14] cmd/link: fix GC data reading from shared library ↵Cherry Zhang
(attempt 2) This is a backport of CL 240621. This is not a clean cherry-pick, as Go 1.15 switches to the new linker while it is still the old linker here. Backporting is straightforward, though. When linking against a Go shared library, when a global variable in the main module has a type defined in the shared library, the linker needs to pull the GC data from the shared library to build the GC program for the global variable. Currently, this fails silently, as the shared library file is closed too early and the read failed (with no error check), causing a zero GC map emitted for the variable, which in turn causes the runtime to treat the variable as pointerless. For now, fix this by keeping the file open. In the future we may want to use mmap to read from the shared library instead. Also add error checking. And fix a (mostly harmless) mistake in size caluculation. Also remove an erroneous condition for ARM64. ARM64 has a special case to get the addend from the relocation on the gcdata field. But that doesn't actually work. And it's no longer necessary to have any special case, since the addend is now applied directly to the gcdata field on ARM64, like on all the other platforms. Fixes #39955. Updates #39927. Change-Id: I01c82422b9f67e872d833336885935bc509bc91b Reviewed-on: https://go-review.googlesource.com/c/go/+/240621 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> (cherry picked from commit 7799756a50f0a4070d66c67e9615375f852f2c04) Reviewed-on: https://go-review.googlesource.com/c/go/+/240511 Reviewed-by: Austin Clements <austin@google.com>
2020-08-21[release-branch.go1.14] cmd/compile: mark s390x int <-> float conversions as ↵Michael Munday
clobbering flags These conversion instructions set the condition code and so should be marked as clobbering flags. Updates #39651. Fixes #39690. Change-Id: I1e3f2cf33337128d321b52ac72f46d1b8798ebd9 Reviewed-on: https://go-review.googlesource.com/c/go/+/242237 Run-TryBot: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-08-21[release-branch.go1.14] cmd/compile: fix checkptr handling of &^Matthew Dempsky
checkptr has code to recognize &^ expressions, but it didn't take into account that "p &^ x" gets rewritten to "p & ^x" during walk, which resulted in false positive diagnostics. This CL changes walkexpr to mark OANDNOT expressions with Implicit when they're rewritten to OAND, so that walkCheckPtrArithmetic can still recognize them later. It would be slightly more idiomatic to instead mark the OBITNOT expression as Implicit (as it's a compiler-generated Node), but the OBITNOT expression might get constant folded. It's not worth the extra complexity/subtlety of relying on n.Right.Orig, so we set Implicit on the OAND node instead. To atone for this transgression, I add documentation for nodeImplicit. Updates #40917. Fixes #40968. Change-Id: I386304171ad299c530e151e5924f179e9a5fd5b8 Reviewed-on: https://go-review.googlesource.com/c/go/+/249477 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/249838 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-08-06[dev.boringcrypto.go1.14] all: merge go1.14.7 into dev.boringcrypto.go1.14Katie Hockman
Change-Id: I6185f2065dac651bf06cecae6bb1ea78d421be60
2020-08-06[release-branch.go1.14] all: merge release-branch.go1.14-security into ↵Katie Hockman
release-branch.go1.14 Change-Id: I9d47ff55ec056567d453e55b215b1e4fc906a407
2020-08-06[release-branch.go1.14-security] go1.14.7go1.14.7Alexander Rakoczy
Change-Id: Ifad33b3ca723231ef1c80ff01db90fd35e322f3d Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/814548 Reviewed-by: Katie Hockman <katiehockman@google.com>
2020-08-06[release-branch.go1.14-security] encoding/binary: read at most ↵Katie Hockman
MaxVarintLen64 bytes in ReadUvarint This CL ensures that ReadUvarint consumes only a limited amount of input (instead of an unbounded amount). On some inputs, ReadUvarint could read an arbitrary number of bytes before deciding to return an overflow error. After this CL, ReadUvarint returns that same overflow error sooner, after reading at most MaxVarintLen64 bytes. Fix authored by Robert Griesemer and Filippo Valsorda. Thanks to Diederik Loerakker, Jonny Rhea, Raúl Kripalani, and Preston Van Loon for reporting this. Fixes CVE-2020-16845 Change-Id: Ie0cb15972f14c38b7cf7af84c45c4ce54909bb8f Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/812099 Reviewed-by: Filippo Valsorda <valsorda@google.com> Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/812326
2020-08-03[release-branch.go1.14] cmd/compile: don't addLocalInductiveFacts if there ↵Keith Randall
is no direct edge from if block to phi block Currently in addLocalInductiveFacts, we only check whether direct edge from if block to phi block exists. If not, the following logic will treat the phi block as the first successor, which is wrong. This patch makes prove pass more conservative, so we disable some cases in test/prove.go. We will do some optimization in the following CL and enable these cases then. Fixes #40501. Change-Id: I27cf0248f3a82312a6f7dabe11c79a1a34cf5412 Reviewed-on: https://go-review.googlesource.com/c/go/+/244579 Reviewed-by: Zach Jones <zachj1@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-on: https://go-review.googlesource.com/c/go/+/245958 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2020-07-17[dev.boringcrypto.go1.14] all: merge go1.14.6 into dev.boringcrypto.go1.14Filippo Valsorda
Change-Id: Id9b320f56b488685ee2a0e4d75b5644d881c5c0f
2020-07-16[release-branch.go1.14] go1.14.6go1.14.6Andrew Bonventre
Change-Id: If9f503098056bd86b2bf51e3297b1bcecd8453bb Reviewed-on: https://go-review.googlesource.com/c/go/+/243138 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-07-16[release-branch.go1.14] testing: capture testname on --- PASS and --- FAIL linesJean de Klerk
This fixes an issue raised at https://github.com/golang/go/issues/38458#issuecomment-635617670 in which --- PASS and --- FAIL lines would not trigger --- CONT lines of other tests. Updates #38458. For #39308. Change-Id: I0d8cc54d682a370d0a6ea6816a11b2e462a92efe Reviewed-on: https://go-review.googlesource.com/c/go/+/235997 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/242058 Reviewed-by: Jean de Klerk <deklerk@google.com> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2020-07-16[release-branch.go1.14] cmd/go: fix parallel chatty tests on solaris-amd64 ↵Tobias Klauser
builder The parallel chatty tests added in CL 229085 fail on the solaris-amd64-oraclerel builder, because a +NN:NN offset time zone is used. Allow for the `+` character in the corresponding regex to fix these tests. Also move the '-' to the end of the character class, so it is not interpreted as the range 9-T. Updates #38458. For #39308. Change-Id: Iec9ae82ba45d2490176f274f0dc6812666eae718 Reviewed-on: https://go-review.googlesource.com/c/go/+/234978 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/c/go/+/242059 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2020-07-16[release-branch.go1.14] testing: reformat test chatty outputJean de Klerk
In #24929, we decided to stream chatty test output. It looks like, foo_test.go:138: TestFoo/sub-1: hello from subtest 1 foo_test.go:138: TestFoo/sub-2: hello from subtest 2 In this CL, we refactor the output to be grouped by === CONT lines, preserving the old test-file-before-log-line behavior: === CONT TestFoo/sub-1 foo_test.go:138 hello from subtest 1 === CONT TestFoo/sub-2 foo_test.go:138 hello from subtest 2 This should remove a layer of verbosity from tests, and make it easier to group together related lines. It also returns to a more familiar format (the pre-streaming format), whilst still preserving the streaming feature. Updates #38458. Fixes #39308. Change-Id: Iaef94c580d69cdd541b2ef055aa004f50d72d078 Reviewed-on: https://go-review.googlesource.com/c/go/+/229085 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Andrew Bonventre <andybons@golang.org> Reviewed-on: https://go-review.googlesource.com/c/go/+/242057 Reviewed-by: Jean de Klerk <deklerk@google.com> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Run-TryBot: Jean de Klerk <deklerk@google.com>
2020-07-16[release-branch.go1.14] database/sql: backport 5 Tx rollback related CLsEmmanuel T Odeke
Manually backported the subject CLs, because of lack of Gerrit "forge-author" permissions, but also because the prior cherry picks didn't apply cleanly, due to a tight relation chain. The backport comprises of: * CL 174122 * CL 216197 * CL 223963 * CL 216240 * CL 216241 Note: Due to the restrictions that we cannot retroactively introduce API changes to Go1.14.6 that weren't in Go1.14, the Conn.Validator interface (from CL 174122, CL 223963) isn't exposed, and drivers will just be inspected, for if they have an IsValid() bool method implemented. For a description of the content of each CL: * CL 174122: database/sql: process all Session Resets synchronously Adds a new interface, driver.ConnectionValidator, to allow drivers to signal they should not be used again, separatly from the session resetter interface. This is done now that the session reset is done after the connection is put into the connection pool. Previous behavior attempted to run Session Resets in a background worker. This implementation had two problems: untested performance gains for additional complexity, and failures when the pool size exceeded the connection reset channel buffer size. * CL 216197: database/sql: check conn expiry when returning to pool, not when handing it out With the original connection reuse strategy, it was possible that when a new connection was requested, the pool would wait for an an existing connection to return for re-use in a full connection pool, and then it would check if the returned connection was expired. If the returned connection expired while awaiting re-use, it would return an error to the location requestiong the new connection. The existing call sites requesting a new connection was often the last attempt at returning a connection for a query. This would then result in a failed query. This change ensures that we perform the expiry check right before a connection is inserted back in to the connection pool for while requesting a new connection. If requesting a new connection it will no longer fail due to the connection expiring. * CL 216240: database/sql: prevent Tx statement from committing after rollback It was possible for a Tx that was aborted for rollback asynchronously to execute a query after the rollback had completed on the database, which often would auto commit the query outside of the transaction. By W-locking the tx.closemu prior to issuing the rollback connection it ensures any Tx query either fails or finishes on the Tx, and never after the Tx has rolled back. * CL 216241: database/sql: on Tx rollback, retain connection if driver can reset session Previously the Tx would drop the connection after rolling back from a context cancel. Now if the driver can reset the session, keep the connection. * CL 223963 database/sql: add test for Conn.Validator interface This addresses comments made by Russ after https://golang.org/cl/174122 was merged. It addes a test for the connection validator and renames the interface to just "Validator". Updates #31480 Updates #32530 Updates #32942 Updates #34775 Fixes #39101 Change-Id: I043d2d724a367588689fd7d6f3cecb39abeb042c Reviewed-on: https://go-review.googlesource.com/c/go/+/242102 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
2020-07-14[release-branch.go1.14] all: merge release-branch.go1.14-security into ↵Katie Hockman
release-branch.go1.14 Change-Id: Ia002311f7206f11a98929361f55eb2ab765b7d5c
2020-07-14[release-branch.go1.14-security] go1.14.5go1.14.5Andrew Bonventre
Change-Id: Ic2fb9041f6610dd5ce54185e674ab4b62fabf3b5 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/794130 Reviewed-by: Katie Hockman <katiehockman@google.com>
2020-07-14[release-branch.go1.14-security] crypto/x509: respect ↵Filippo Valsorda
VerifyOptions.KeyUsages on Windows When using the platform verifier on Windows (because Roots is nil) we were always enforcing server auth EKUs if DNSName was set, and none otherwise. If an application was setting KeyUsages, they were not being respected. Started correctly surfacing IncompatibleUsage errors from the system verifier, as those are the ones applications will see if they are affected by this change. Also refactored verify_test.go to make it easier to add tests for this, and replaced the EKULeaf chain with a new one that doesn't have a SHA-1 signature. Thanks to Niall Newman for reporting this. Fixes #39360 Fixes CVE-2020-14039 Change-Id: If5c00d615f2944f7d57007891aae1307f9571c32 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/774414 Reviewed-by: Katie Hockman <katiehockman@google.com> Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/793511 Reviewed-by: Filippo Valsorda <valsorda@google.com>
2020-07-13[release-branch.go1.14-security] net/http: synchronize "100 Continue" write ↵Russ Cox
and Handler writes The expectContinueReader writes to the connection on the first Request.Body read. Since a Handler might be doing a read in parallel or before a write, expectContinueReader needs to synchronize with the ResponseWriter, and abort if a response already went out. The tests will land in a separate CL. Fixes #34902 Fixes CVE-2020-15586 Change-Id: Icdd8dd539f45e8863762bd378194bb4741e875fc Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/793350 Reviewed-by: Filippo Valsorda <valsorda@google.com> (cherry picked from commit b5e504f4a07c572744b228fa1b10e3989c4c44f3) Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/793500
2020-07-13[release-branch.go1.14] net/http: fix panic with If-None-Match value in ↵Marcus Weiner
http.ServeContent Updates #39817. Fixes #39920. Change-Id: I79f2ad7c836a8a46569f603aca583fdd526d22dc GitHub-Last-Rev: 5b88aada219aaa2af0c7e1969ed6fa646117d9da GitHub-Pull-Request: golang/go#39821 Reviewed-on: https://go-review.googlesource.com/c/go/+/239699 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> (cherry picked from commit ce81a8f5e4f6c33036aa0777fabc47eeeab468dc) Reviewed-on: https://go-review.googlesource.com/c/go/+/240343 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-07-11[release-branch.go1.14] reflect: zero stack slots before writing to them ↵Keith Randall
with write barriers reflect.assignTo writes to the target using write barriers. Make sure that the memory it is writing to is zeroed, so the write barrier does not read pointers from uninitialized memory. Fixes #39698 Change-Id: Ia64b2cacc193bffd0c1396bbce1dfb8182d4905b Reviewed-on: https://go-review.googlesource.com/c/go/+/238760 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> (cherry picked from commit 3dec253783e1211989102ac6abd34cddbf8ba0e6) Reviewed-on: https://go-review.googlesource.com/c/go/+/238861
2020-07-10[release-branch.go1.14] cmd/compile: remove check that Zero's arg has the ↵Keith Randall
correct base type It doesn't have to. The type in the aux field is authoritative. There are cases involving casting from interface{} where pointers have a placeholder pointer type (because the type is not known when the IData op is generated). The check was introduced in CL 13447. Fixes #39849 Change-Id: Id77a57577806a271aeebd20bea5d92d08ee7aa6b Reviewed-on: https://go-review.googlesource.com/c/go/+/239817 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> (cherry picked from commit 3b2f67a59702e4881625cb967f853ef56b0c4828) Reviewed-on: https://go-review.googlesource.com/c/go/+/239997 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2020-07-10[release-branch.go1.14] cmd/link: detect trampoline of deferreturn callCherry Zhang
This is a backport of CL 234105. This is not a clean cherry-pick, as CL 234105 is for the new linker, whereas we still use the old linker here. This CL backports the logic. The runtime needs to find the PC of the deferreturn call in a few places. So for functions that have defer, we record the PC of deferreturn call in its funcdata. For very large binaries, the deferreturn call could be made through a trampoline. The current code of finding deferreturn PC fails in this case. This CL handles the trampoline as well. Fixes #39991. Updates #39049. Change-Id: I929be54d6ae436f5294013793217dc2a35f080d4 Reviewed-on: https://go-review.googlesource.com/c/go/+/234105 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/240917 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Joel Sing <joel@sing.id.au>
2020-07-09[release-branch.go1.14] encoding/json: revert "avoid work when unquoting ↵Daniel Martí
strings, take 2" This reverts golang.org/cl/190659 and golang.org/cl/226218, minus the regression tests in the latter. The original work happened in golang.org/cl/151157, which was reverted in golang.org/cl/190909 due to a crash found by fuzzing. We tried a second time in golang.org/cl/190659, which shipped with Go 1.14. A bug was found, where strings would be mangled in certain edge cases. The fix for that was golang.org/cl/226218, which was backported into Go 1.14.4. Unfortunately, a second regression was just reported in #39555, which is a similar case of strings getting mangled when decoding under certain conditions. It would be possible to come up with another small patch to fix that edge case, but instead, let's just revert the entire optimization, as it has proved to do more harm than good. Moreover, it's hard to argue or prove that there will be no more such regressions. However, all the work wasn't for nothing. First, we learned that the way the decoder unquotes tokenized strings isn't simple; initially, we had wrongly assumed that each string was unquoted exactly once and in order. Second, we have gained a number of regression tests which will be useful to prevent the same mistakes in the future, including the test cases we add in this CL. For #39555. Fixes #39585. Change-Id: I66a6919c2dd6d9789232482ba6cf3814eaa70f61 Reviewed-on: https://go-review.googlesource.com/c/go/+/237838 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org> (cherry picked from commit 11389baf2ea0b5e920959b0aa8d406d8090a0a93) Reviewed-on: https://go-review.googlesource.com/c/go/+/241081 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2020-06-29[release-branch.go1.14] cmd/go: convert TestBuildIDContainsArchModeEnv to ↵Michael Matloob
the script framework Part of converting all tests to script framework to improve test parallelism. Fixes #39824 Updates #36320 Updates #17751 Change-Id: I69c69809fb1698c8198ef3ea00103a9acb7b6ce7 Reviewed-on: https://go-review.googlesource.com/c/go/+/214387 Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com> (cherry picked from CL 214387) Reviewed-on: https://go-review.googlesource.com/c/go/+/239738 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org>
2020-06-26[release-branch.go1.14] doc/go1.14: crypto/tls.Config.NameToCertificate is ↵Ian Lance Taylor
deprecated Also crypto/tls.Config.BuildNameToCertificate. Note that this field and method were deprecated in the Go 1.14 release, so this change is to the 1.14 release notes. For #37626 Fixes #38030 Change-Id: If8549bc746f42a93f1903439e1b464b3e81e2c19 Reviewed-on: https://go-review.googlesource.com/c/go/+/240005 Reviewed-by: Filippo Valsorda <filippo@golang.org> (cherry picked from commit 186e61f319c2fb0d0abc72c85d8818eba06e26e3) Reviewed-on: https://go-review.googlesource.com/c/go/+/240011
2020-06-18[release-branch.go1.14] reflect: handling flagIndir in DeepEqual potential ↵Ian Lance Taylor
cycles For #39607 Fixes #39636 Change-Id: Ia7e597e0da8a193a25382cc633a1c6080b4f7cbf Reviewed-on: https://go-review.googlesource.com/c/go/+/238361 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> (cherry picked from commit d872bbcfec29f2585ed8144fba6262d4228619cf) Reviewed-on: https://go-review.googlesource.com/c/go/+/238626
2020-06-15[release-branch.go1.14] cmd: update golang.org/x/tools to ↵Dmitri Shuralyov
v0.0.0-20200602230032-c00d67ef29d0 This teaches vet to recognize %O in a fmt.Printf format string. O has been supported since the 1.13 release, but vet would warn about it. Fixes #39288. For #29986. Change-Id: Ia7817ee60ae6beac32cc402c0c68afa917e4ef0f Reviewed-on: https://go-review.googlesource.com/c/go/+/236199 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-12[release-branch.go1.14] cmd/compile/internal/ssa: skip TestNexting with old ↵Dmitri Shuralyov
Delve on linux/386 Support for linux/386 was added to Delve in version 1.4.1, but the version of Delve currently installed on the linux-386-longtest builder is 1.2.0. That isn't new enough, which causes the test to fail. Skip it on that builder until it can be made to work. The only reason it used to pass on the linux-386-longtest builder before is because that builder was misconfigured to run tests for linux/amd64. This was resolved in CL 234520. Also improve internal documentation and the text of skip reasons. For #39309. Fixes #39562. Change-Id: I395cb1f076e59dd3a3feb53e1dcdce5101e9a0f5 Reviewed-on: https://go-review.googlesource.com/c/go/+/237619 Reviewed-by: David Chase <drchase@google.com>
2020-06-09[dev.boringcrypto.go1.14] all: merge go1.14.4 into dev.boringcrypto.go1.14Filippo Valsorda
Change-Id: I71db92e18e105a2082a51aec0bdee8e5dd0727ed
2020-06-01[release-branch.go1.14] go1.14.4go1.14.4Dmitri Shuralyov
Change-Id: I0daa397bee2ad754fc4860e1365c982de232f171 Reviewed-on: https://go-review.googlesource.com/c/go/+/235919 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-05-28[release-branch.go1.14] cmd/doc: fix merging comments in -src modeIvan Trubach
These changes fix go doc -src mode that vomits comments from random files if filesystem does not sort files by name. The issue was with parse.ParseDir using the Readdir order of files, which varies between platforms and filesystem implementations. Another option is to merge comments using token.FileSet.Iterate order in cmd/doc, but since ParseDir is mostly used in go doc, I’ve opted for smaller change because it’s unlikely to break other uses or cause any perfomance issues. Example (macOS APFS): `go doc -src net.ListenPacket` Fixes #38993 Change-Id: I7f9f368c7d9ccd9a2cbc48665f2cb9798c7b3a3f GitHub-Last-Rev: 654fb450421266a0bb64518016944db22bd681e3 GitHub-Pull-Request: golang/go#36104 Reviewed-on: https://go-review.googlesource.com/c/go/+/210999 Run-TryBot: Rob Pike <r@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org> (cherry picked from commit 585e31df63f6879c03b285711de6f9dcba1f2cb0) Reviewed-on: https://go-review.googlesource.com/c/go/+/235579 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
2020-05-27[release-branch.go1.14] encoding/json: don't mangle strings in an edge case ↵Daniel Martí
when decoding The added comment contains some context. The original optimization assumed that each call to unquoteBytes (or unquote) followed its corresponding call to rescanLiteral. Otherwise, unquoting a literal might use d.safeUnquote from another re-scanned literal. Unfortunately, this assumption is wrong. When decoding {"foo": "bar"} into a map[T]string where T implements TextUnmarshaler, the sequence of calls would be as follows: 1) rescanLiteral "foo" 2) unquoteBytes "foo" 3) rescanLiteral "bar" 4) unquoteBytes "foo" (for UnmarshalText) 5) unquoteBytes "bar" Note that the call to UnmarshalText happens in literalStore, which repeats the work to unquote the input string literal. But, since that happens after we've re-scanned "bar", we're using the wrong safeUnquote field value. In the added test case, the second string had a non-zero number of safe bytes, and the first string had none since it was all non-ASCII. Thus, "safely" unquoting a number of the first string's bytes could cut a rune in half, and thus mangle the runes. A rather simple fix, without a full revert, is to only allow one use of safeUnquote per call to unquoteBytes. Each call to rescanLiteral when we have a string is soon followed by a call to unquoteBytes, so it's no longer possible for us to use the wrong index. Also add a test case from #38126, which is the same underlying bug, but affecting the ",string" option. Before the fix, the test would fail, just like in the original two issues: --- FAIL: TestUnmarshalRescanLiteralMangledUnquote (0.00s) decode_test.go:2443: Key "开源" does not exist in map: map[开���:12345开源] decode_test.go:2458: Unmarshal unexpected error: json: invalid use of ,string struct tag, trying to unmarshal "\"aaa\tbbb\"" into string Fixes #38106. For #38105. For #38126. Change-Id: I761e54924e9a971a4f9eaa70bbf72014bb1476e6 Reviewed-on: https://go-review.googlesource.com/c/go/+/226218 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com> (cherry picked from commit 55361a26177b3faf151a1d35467db5d403b51f22) Reviewed-on: https://go-review.googlesource.com/c/go/+/233057 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2020-05-27[release-branch.go1.14] encoding/json: properly encode strings with ↵Daniel Martí
",string" again golang.org/cl/193604 fixed one bug when one encodes a string with the ",string" option: if SetEscapeHTML(false) is used, we should not be using HTML escaping for the inner string encoding. The CL correctly fixed that. The CL also tried to speed up this edge case. By avoiding an entire new call to Marshal, the new Issue34127 benchmark reduced its time/op by 45%, and lowered the allocs/op from 3 to 2. However, that last optimization wasn't correct: Since Go 1.2 every string can be marshaled to JSON without error even if it contains invalid UTF-8 byte sequences. Therefore there is no need to use Marshal again for the only reason of enclosing the string in double quotes. JSON string encoding isn't just about adding quotes and taking care of invalid UTF-8. We also need to escape some characters, like tabs and newlines. The new code failed to do that. The bug resulted in the added test case failing to roundtrip properly; before our fix here, we'd see an error: invalid use of ,string struct tag, trying to unmarshal "\"\b\f\n\r\t\"\\\"" into string If you pay close attention, you'll notice that the special characters like tab and newline are only encoded once, not twice. When decoding with the ",string" option, the outer string decode works, but the inner string decode fails, as we are now decoding a JSON string with unescaped special characters. The fix we apply here isn't to go back to Marshal, as that would re-introduce the bug with SetEscapeHTML(false). Instead, we can use a new encode state from the pool - it results in minimal performance impact, and even reduces allocs/op further. The performance impact seems fair, given that we need to check the entire string for characters that need to be escaped. name old time/op new time/op delta Issue34127-8 89.7ns ± 2% 100.8ns ± 1% +12.27% (p=0.000 n=8+8) name old alloc/op new alloc/op delta Issue34127-8 40.0B ± 0% 32.0B ± 0% -20.00% (p=0.000 n=8+8) name old allocs/op new allocs/op delta Issue34127-8 2.00 ± 0% 1.00 ± 0% -50.00% (p=0.000 n=8+8) Instead of adding another standalone test, we convert an existing "string tag" test to be table-based, and add another test case there. One test case from the original CL also had to be amended, due to the same problem - when escaping '<' due to SetEscapeHTML(true), we need to end up with double escaping, since we're using ",string". Fixes #38178. For #38173. Change-Id: I2b0df9e4f1d3452fff74fe910e189c930dde4b5b Reviewed-on: https://go-review.googlesource.com/c/go/+/226498 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com> (cherry picked from commit b1a48af7e8ee87cc46e1bbb07f81ac4853e0f27b) Reviewed-on: https://go-review.googlesource.com/c/go/+/233037 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>