Bryan C. Mills [Wed, 5 Feb 2020 15:22:07 +0000 (10:22 -0500)]
doc/install.html: streamline the “Test your installation” step and make it module-agnostic
In CL 199417, we updated “How to Write Go Code” to give a basic
introduction to modules and to include module-mode commands.
However, most new users will end up reading “Getting Started”
(doc/install.html) before “How to Write Go Code”, and we forgot to
update the handful of commands there for module mode.
Before this change, the “Test your installation” section also covered
quite a few operations beoyond merely testing the installation: it
included setting up a GOPATH, building a binary, and installing and
cleaning binaries. Those are valuable operations to learn, but they
arguably belong in “How to Write Go Code”, not “Test your
installation” — and having all that extra detail in the install
instructions may well discourage folks from further essential reading.
Rather than updating all of those operations here, I've removed them.
A companion CL will update “How to Write Go Code” to ensure that it
mentions GOPATH (as the location of the module cache and the default
install location for binaries) and 'go clean -i'.
Updates #37042
Change-Id: I157f21ccbe3896575fa1115dc821abf6c71ed15e
Reviewed-on: https://go-review.googlesource.com/c/go/+/217840
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tyler Bui-Palsulich <tbp@google.com>
Dmitri Shuralyov [Wed, 5 Feb 2020 10:23:42 +0000 (05:23 -0500)]
doc: rename HTML element IDs to avoid duplicates
These 3 release notes have had an element ID collision because both
the runtime changes and changes to the package "runtime" used the
same ID. Fix it by using a "pkg-" prefix for the runtime package.
Move the "runtime-again" ID from CL 129635 to a nearby <dt> element
so that existing links to https://golang.org/doc/go1.11#runtime-again
don't break.
Fixes #37036
Updates #36878
Change-Id: Ib68d93acfac802fd84c0a57485937e45dea2064a
Reviewed-on: https://go-review.googlesource.com/c/go/+/217797 Reviewed-by: Toshihiro Shiino <shiino.toshihiro@gmail.com> Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Ian Lance Taylor [Mon, 3 Feb 2020 23:53:53 +0000 (15:53 -0800)]
runtime: don't treat SIGURG as a bad signal
It's possible for the scheduler to try to preempt a goroutine running
on a thread created by C code just as the goroutine returns from Go code
to C code. If that happens, the goroutine will have a nil g,
which would normally cause us to enter the badsignal code.
The badsignal code will allocate an M, reset the signal handler,
and raise the signal. This is all wasted work for SIGURG,
as the default behavior is for the kernel to ignore the signal.
It also means that there is a period of time when preemption requests
are ignored, because the signal handler is reset to the default.
And, finally, it triggers a bug on 386 OpenBSD 6.2. So stop doing it.
No test because there is no real change in behavior (other than on OpenBSD),
the new code is just more efficient
Katie Hockman [Tue, 4 Feb 2020 17:48:20 +0000 (12:48 -0500)]
doc: remove paragraph break for upgrading to modules
Previously, the release notes broke up the sentences that modules
is now ready for production use and where to file issues for
migration problems into separate paragraphs. This made it look like
the migration paragraph was about upgrading to 1.14, not to modules,
and made the reading a bit confusing. Now the entire idea is in one
paragraph.
Dmitri Shuralyov [Tue, 4 Feb 2020 15:24:20 +0000 (15:24 +0000)]
doc/go1.14: remove TODO about Solaris port
The solaris-amd64-oraclerel builder is passing for the main Go repo
(on tip and release branches for 1.13 and 1.12), and golang.org/x repos
(also on tip and release branches for 1.13 and 1.12).
The builder is still maintained as described at
https://golang.org/issue/15581#issuecomment-550368581.
Updates #36878
Updates #15581
Change-Id: Icc6f7529ca2e05bb34f09ce4363d9582e80829c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/217738 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Alexander Rakoczy <alex@golang.org>
Dmitri Shuralyov [Tue, 4 Feb 2020 15:15:39 +0000 (15:15 +0000)]
doc/go1.14: remove TODO about Illumos port
There is an active builder that was added in CL 201597,
and it is passing on Go tip and release-branch.go1.13
(with one failure that appears to be flaky due to being
out of memory). It's also passing on all golang.org/x repos
on tip and release-branch.go1.13. It's not configured to
run on Go 1.12 release branches.
Updates #36878
Updates #15581
Change-Id: I4ed7fc62c11a09743832fca39bd61fa0cf6e7ded
Reviewed-on: https://go-review.googlesource.com/c/go/+/217737 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Alexander Rakoczy <alex@golang.org>
Tobias Klauser [Sun, 2 Feb 2020 13:43:54 +0000 (14:43 +0100)]
doc/go1.14: remove TODO about Dragonfly passing
Both the Dragonfly release and tip builder have been passing for a
while. The net package's interface API is working on both builders since
CL 202317 which has been re-vendored in CL 202438.
Updates #34368
Updates #36878
Change-Id: I187178b3a59f2604187af453207fb4e24a56105c
Reviewed-on: https://go-review.googlesource.com/c/go/+/217358 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Toshihiro Shiino [Tue, 4 Feb 2020 12:32:58 +0000 (12:32 +0000)]
doc/go1.14: add missing slashes
This saves a redirect and makes the document more consistent.
Change-Id: I67840f5dc05dffd8893a055618eb202b682a0ebc
Reviewed-on: https://go-review.googlesource.com/c/go/+/217698 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Filippo Valsorda [Fri, 31 Jan 2020 23:41:03 +0000 (15:41 -0800)]
std,cmd: sync go.mod with new release branches
cd src
go get golang.org/x/sys@release-branch.go1.14-std
go mod tidy && go mod vendor
cd cmd
go get golang.org/x/sys@release-branch.go1.14-cmd
go get golang.org/x/tools@release-branch.go1.14
go mod tidy && go mod vendor
Fixes #36851
Change-Id: Ib0a78eec90c92515b6f421972102cc8e8d0c08a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/217305
Run-TryBot: Filippo Valsorda <filippo@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Filippo Valsorda [Fri, 31 Jan 2020 22:49:11 +0000 (14:49 -0800)]
math/big: simplify GCD docs
We don't usually document past behavior (like "As of Go 1.14 ...") and
in isolation the current docs made it sound like a and b could only be
negative or zero.
Change-Id: I0d3c2b8579a9c01159ce528a3128b1478e99042a
Reviewed-on: https://go-review.googlesource.com/c/go/+/217302 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Filippo Valsorda [Fri, 31 Jan 2020 22:54:21 +0000 (14:54 -0800)]
doc/go1.14: fix math/big.(*Int).GCD notes
GCD is a method, not a function, so the link was broken.
Change-Id: Icbb09d39959e7c71a48987b15bb82febe12c3a19
Reviewed-on: https://go-review.googlesource.com/c/go/+/217303 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Filippo Valsorda [Tue, 28 Jan 2020 22:37:58 +0000 (14:37 -0800)]
doc/go1.14: add crypto/tls release notes
A few minor changes that didn't feel worth mentioning:
* CL 205059: support leaving Certificates/GetCertificate nil if
GetConfigForClient is set
* CL 205059: send the unrecognized_name alert when there are no
available certificates
* CL 205068: add correct names for CHACHA20_POLY1305 ciphersuite constants
* CL 204046: fix CreateCRL for Ed25519 CAs
* CL 205058: add CertificateRequestInfo.Version
Change-Id: Ie820fb0c6842e669edde031132c7cda5b09e7682
Reviewed-on: https://go-review.googlesource.com/c/go/+/216759
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Dmitri Shuralyov [Fri, 31 Jan 2020 18:21:57 +0000 (13:21 -0500)]
doc/go1.14: move "Minor changes to the library" heading up
This heading was below the minor changes to the standard library.
It should be on top.
Many of the minor changes have been documented, so remove the broad
TODO comment. It is still a TODO to highlight more prominent changes
to the library, if there are any, under the "Core library" heading.
Updates #36878
Change-Id: If7fd9af9a933af917523e33fd2922c5f3c02c98b
Reviewed-on: https://go-review.googlesource.com/c/go/+/217277 Reviewed-by: Alexander Rakoczy <alex@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org>
Robert Griesemer [Fri, 31 Jan 2020 04:13:02 +0000 (20:13 -0800)]
go/types: unexport Checker.LookupFieldOrMethod
Implementation changes in go/types for #6977 required that internal
LookupFieldOrMethod calls had access to the current *Checker. In
order to make quick progress, I added a *Checker receiver to the
function LookupFieldOrMethod (thus making it a method), and added
a new function LookupFieldOrMethod. The plan was always to rename
that function (Checker.LookupFieldOrMethod) such that it wouldn't
be exported; with the obvious name being Checker.lookupFieldOrMethod.
But that name was already in use which is why I postponed the rename.
Eventually I forgot to clean it up. This CL fixes that with the
following renames:
Change-Id: Icfafd0de9a19841ba5bd87142730fe7323204491
Reviewed-on: https://go-review.googlesource.com/c/go/+/217134
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Keith Randall [Thu, 30 Jan 2020 18:49:12 +0000 (10:49 -0800)]
doc: document new hash/maphash package
Update #36878
Update #28322
Change-Id: I793c7c4dbdd23fdecd715500e90b7cc0cbe4cea5
Reviewed-on: https://go-review.googlesource.com/c/go/+/217099 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Filippo Valsorda [Thu, 30 Jan 2020 22:18:42 +0000 (14:18 -0800)]
cmd/go.mod: sync x/crypto with std
go get golang.org/x/crypto@v0.0.0-20200128174031-69ecbb4d6d5d
go mod vendor
git checkout -- vendor/golang.org/x/sys/unix/asm_linux_riscv64.s \
vendor/golang.org/x/tools/go/analysis/passes/asmdecl/asmdecl.go
Robert Griesemer [Thu, 30 Jan 2020 20:26:20 +0000 (12:26 -0800)]
math/big: update comment on Int.GCD
Per the suggestion https://golang.org/cl/216200/2/doc/go1.14.html#423.
Updates #28878.
Change-Id: I654d2d114409624219a0041916f0a4030efc7573
Reviewed-on: https://go-review.googlesource.com/c/go/+/217104 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Robert Griesemer [Thu, 30 Jan 2020 19:34:24 +0000 (11:34 -0800)]
doc/go1.14: fix minor typo (update release notes)
Follow-up on https://golang.org/cl/216200/2/doc/go1.14.html#423 .
Updates #36878.
Change-Id: I693a9eb05c6f1f42721a92fda46a4f3449defa24
Reviewed-on: https://go-review.googlesource.com/c/go/+/217100 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Change-Id: I40594be85ee0a0d4b35bacc90104568d2b8a4761
Reviewed-on: https://go-review.googlesource.com/c/go/+/216997 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Hana Kim [Wed, 29 Jan 2020 22:09:28 +0000 (17:09 -0500)]
doc/go1.14.html: describe the runtime/pprof change
golang.org/cl/204636
golang.org/cl/205097
Updates #36874
Change-Id: I773868fd027e9cc2187f0a738900f0fcb7711635
Reviewed-on: https://go-review.googlesource.com/c/go/+/216877 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Bryan C. Mills [Wed, 29 Jan 2020 14:14:50 +0000 (09:14 -0500)]
go/build: update TestImportDirNotExist to accept more detailed error strings
In CL 203820, we switched go/build to use the caller's working
directory for the main module (rather than srcDir), so that go/build
resolution now respects the requirements and replacements of the main
module. When the passed-in srcDir is empty, as of that CL we use "go
list" instead of falling back to in-process (GOPATH-mode) path lookup.
Unfortunately, that broke go/build.TestImportDirNotExist when
GO111MODULE=on: the test was looking for the specific error message
produced by the in-process lookup.
This change relaxes the test to accept the error message produced by
"go list" when srcDir is empty.
Joel Sing [Wed, 29 Jan 2020 09:14:18 +0000 (20:14 +1100)]
cmd/internal/obj/riscv,cmd/link: shorten the riscv64 call sequence
Now that the other dependent offset has been identified, we can remove the
unnecessary ADDI instruction from the riscv64 call sequence (reducing it
to AUIPC+JALR, rather than the previous AUIPC+ADDI+JALR).
Joel Sing [Wed, 29 Jan 2020 09:06:54 +0000 (20:06 +1100)]
cmd/compile,cmd/link: fix and re-enable open-coded defers on riscv64
The R_CALLRISCV relocation marker is on the JALR instruction, however the actual
relocation is currently two instructions previous for the AUIPC+ADDI sequence.
Adjust the platform dependent offset accordingly and re-enable open-coded defers.
Fixes #36786.
Change-Id: I71597c193c447930fbe94ce44b7355e89ae877bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/216797
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Daniel Martí [Wed, 22 Jan 2020 12:20:02 +0000 (12:20 +0000)]
doc: add the change to json.Compact in the 1.14 changelog
Fixes #36690.
Change-Id: Id4234ab9467270d51f0411375b71ece7f41269b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/215817 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Brad Fitzpatrick [Tue, 28 Jan 2020 21:40:08 +0000 (21:40 +0000)]
doc/go1.14: document RISC-V support
Fixes #36708
Updates #27532
Change-Id: I9e3bb92d15825e2c4a505e1aea41b2897f18e0ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/216757 Reviewed-by: Joel Sing <joel@sing.id.au> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Ian Lance Taylor [Tue, 28 Jan 2020 00:35:28 +0000 (16:35 -0800)]
net/http: don't treat an alternate protocol as a known round tripper
As of CL 175857, the client code checks for known round tripper
implementations, and uses simpler cancellation code when it finds one.
However, this code was not considering the case of a request that uses
a user-defined protocol, where the user-defined protocol was
registered with the transport to use a different round tripper.
The effect was that round trippers that worked with earlier
releases would not see the expected cancellation semantics with tip.
Fixes #36820
Change-Id: I60e75b5d0badcfb9fde9d73a966ba1d3f7aa42b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/216618
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Brad Fitzpatrick [Tue, 28 Jan 2020 22:57:18 +0000 (22:57 +0000)]
cmd/dist: remove riscv64 from set of incomplete ports
Fixes #27532
Fixes #36853
Updates #28944
Change-Id: I4d0f212deb361c941ce7e5999e237a951c89a296
Reviewed-on: https://go-review.googlesource.com/c/go/+/216758 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Joel Sing <joel@sing.id.au>
Michael Anthony Knyszek [Tue, 28 Jan 2020 19:59:19 +0000 (19:59 +0000)]
runtime: ensure that searchAddr always refers to inUse memory
This change formalizes an assumption made by the page allocator, which
is that (*pageAlloc).searchAddr should never refer to memory that is not
represented by (*pageAlloc).inUse. The portion of address space covered
by (*pageAlloc).inUse reflects the parts of the summary arrays which are
guaranteed to mapped, and so looking at any summary which is not
reflected there may cause a segfault.
In fact, this can happen today. This change thus also removes a
micro-optimization which is the only case which may cause
(*pageAlloc).searchAddr to point outside of any region covered by
(*pageAlloc).inUse, and adds a test verifying that the current segfault
can no longer occur.
Dmitri Shuralyov [Tue, 28 Jan 2020 18:20:57 +0000 (13:20 -0500)]
src/go.mod: import x/crypto/cryptobyte security fix for 32-bit archs
cryptobyte: fix panic due to malformed ASN.1 inputs on 32-bit archs
When int is 32 bits wide (on 32-bit architectures like 386 and arm), an
overflow could occur, causing a panic, due to malformed ASN.1 being
passed to any of the ASN1 methods of String.
Tested on linux/386 and darwin/amd64.
This fixes CVE-2020-7919 and was found thanks to the Project Wycheproof
test vectors.
x/crypto/cryptobyte is used in crypto/x509 for parsing certificates.
Malformed certificates might cause a panic during parsing on 32-bit
architectures (like arm and 386).
Joel Sing [Wed, 22 Jan 2020 16:38:31 +0000 (03:38 +1100)]
cmd/internal/obj/riscv: use signed immediates for U-instructions
On RISCV64, the U-instructions (AUIPC and LUI) take 20 bits, append 12 bits
of zeros and sign extend to 64-bits. As such, the 20 bit immediate value is
signed not unsigned.
Duplicate the register definitions and names to avoid importing the
cmd/internal/obj/riscv64 package. This makes it possible to build compiler rules
with a stable Go tool chain.
Cherry Zhang [Fri, 24 Jan 2020 19:11:04 +0000 (14:11 -0500)]
cmd/compile: on PPC64, fold offset into some loads/stores only when offset is 4-aligned
On PPC64, MOVWload, MOVDload, and MOVDstore are assembled to a
"DS from" instruction which requiers the offset is a multiple of
4. Only fold offset to such instructions if it is a multiple of 4.
Fixes #36723.
"GOARCH=ppc64 GOOS=linux go build -gcflags=all=-d=ssa/check/on std cmd"
passes now.
Change-Id: I67f2a6ac02f0d33d470f68ff54936c289a4c765b
Reviewed-on: https://go-review.googlesource.com/c/go/+/216379 Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
Bryan C. Mills [Fri, 24 Jan 2020 15:26:24 +0000 (10:26 -0500)]
doc/go1.14: note that module support is ready for production use
The public proxy and checksum database launched with Go 1.13 have been
running smoothly, pkg.go.dev is serving module-aware documentation,
and in 1.14 we have improved the vendoring workflow and finished
Subversion support to reach parity with GOPATH mode for users of those
features, updated documentation (including the “How to Write Go Code”
intro document) and published blog posts describing common modes of
usage, and improved the migration path for existing v2+ modules by
making version resolution less aggressive about "+incompatible" major
versions.
We (always) have more fit-and-finish work to do, but at this point we
believe that module mode will provide a better user experience than
GOPATH mode for most users, including in production use.
Reason for revert: This change may be causing latency problems
for applications which call ReadMemStats, because it may cause
all goroutines to stop until the GC completes.
https://golang.org/cl/215157 fixes this problem, but it's too
late in the cycle to land that.
Carlos Amedee [Thu, 23 Jan 2020 21:05:29 +0000 (16:05 -0500)]
cmd/link: ensure cgo cflags do not leak into dwarf tests
Running the dwarf tests with CGO_CFLAGS set
with certain values would cause the test to fail. all.bash
would fail when CGO_CFLAGS was set to '-mmacosx-version-min=10.10'
because the --macosx-version-min flag is incompatible with some dwarf
tests. The change guards against using an unintended flag in the unit test.
Updates #35459
Change-Id: Idc9b354aba44fdab424cb0081a4b3ea7a6d0f8e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/216177
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Jay Conrod [Fri, 24 Jan 2020 16:25:52 +0000 (08:25 -0800)]
cmd/go: fix cgo test when min macOS version is set
Regression tests for #24161 use a macro to conditionally compile some
stub definitions. The macro tests that the minimum macOS version is
less than 10.12.
We get duplicate definitions when building this test with
CGO_CFLAGS=-mmacosx-version-min=10.x where 10.x < 10.12. With this
change, we use a different macro, __MAC_OS_X_VERSION_MAX_ALLOWED__,
which tests the SDK version instead of the minimum macOS version. This
checks whether these definitions are present in headers.
After this change, 'go tool dist test cgo_test' should pass with
CGO_FLAGS=-mmacosx-version-min=10.10.
Updates #35459
Change-Id: I88d63601c94b0369c73c38d216a2d41ba7d4e579
Reviewed-on: https://go-review.googlesource.com/c/go/+/216243
Run-TryBot: Jay Conrod <jayconrod@google.com> Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Filippo Valsorda [Tue, 21 Jan 2020 19:45:15 +0000 (14:45 -0500)]
crypto/x509: mitigate CVE-2020-0601 verification bypass on Windows
An attacker can trick the Windows system verifier to use a poisoned set
of elliptic curve parameters for a trusted root, allowing it to generate
spoofed signatures. When this happens, the returned chain will present
the unmodified original root, so the actual signatures won't verify (as
they are invalid for the correct parameters). Simply double check them
as a safety measure and mitigation.
Windows users should still install the system security patch ASAP.
Carlos Amedee [Wed, 22 Jan 2020 20:30:52 +0000 (15:30 -0500)]
cmd/link: ensure cgo cflags do not leak into tvOS test
Running the 'TestBuildForTvOS' test with CGO_CFLAGS set
with certain values would cause the test to fail. all.bash
would fail when CGO_CFLAGS was set to '-mmacosx-version-min=10.10'
because the --macosx-version-min flag is incompatible with tvOS.
The change guards against using an unintended flag in the unit test.
Updates #35459
Change-Id: Ifc43f3ebfb23d37aabeaac2ea9efae5b877991bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/215957
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Bryan C. Mills [Thu, 23 Jan 2020 17:51:26 +0000 (12:51 -0500)]
cmd/go: add a control case to the mod_vendor_trimpath test
In reviewing CL 215940, it took me a while to find the control
condition for the test, which was located in build_cache_trimpath.txt.
We could consolidate the two tests, but since they check for
regressions of separate issues (with separate root-causes), I think it
makes sense to keep them separate.
However, I would like the control condition to be present in the same
source file, so that we'll be more likely to update both cases if the
behavior of one of them is changed.
Updates #36566
Change-Id: Ic588f1dfb7977dd78d1d5ef61b9841e22bad82e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/216018
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Daniel Martí [Tue, 21 Jan 2020 10:21:17 +0000 (10:21 +0000)]
cmd/go: make Script/test_regexps less flaky under load
With the command below, I was able to reproduce failures within the
first 50 or so runs:
go test -c -o test && stress -p 32 ./test -test.run Script/test_regexp
When printing the full failure output, we'd see:
BenchmarkX
BenchmarkX: x_test.go:13: LOG: X running N=1
BenchmarkX/Y
BenchmarkX/Y: x_test.go:15: LOG: Y running N=1
BenchmarkX/Y: x_test.go:15: LOG: Y running N=100
BenchmarkX/Y: x_test.go:15: LOG: Y running N=10000
BenchmarkX/Y: x_test.go:15: LOG: Y running N=1000000
BenchmarkX/Y: x_test.go:15: LOG: Y running N=100000000
BenchmarkX/Y: x_test.go:15: LOG: Y running N=1000000000
BenchmarkX/Y 1000000000 0.000050 ns/op
BenchmarkX/Y: x_test.go:15: LOG: Y running N=1
BenchmarkX/Y: x_test.go:15: LOG: Y running N=30
BenchmarkX/Y: x_test.go:15: LOG: Y running N=1207
BenchmarkX/Y: x_test.go:15: LOG: Y running N=120700
BenchmarkX/Y: x_test.go:15: LOG: Y running N=12070000
BenchmarkX/Y: x_test.go:15: LOG: Y running N=1000000000
BenchmarkX/Y 1000000000 0.000715 ns/op
In other words, the N values aren't required to be exact. It seems like
they are cut short if the machine is under stress. That's the exact
scenario we reproduce above, since I used -p=32 on my laptop with only 4
real CPU cores.
First, don't require each line to be present. Instead, use patterns
that span multiple lines, so that we can just match the first and last
N= lines.
Second, don't require the last N= lines to be exact; simply require
them to have a reasonably large number of digits.
Fixes #36664.
Change-Id: I7a9818f1a07099fa6482a26da2ac5cbea0f8ab30
Reviewed-on: https://go-review.googlesource.com/c/go/+/215578
Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Jay Conrod [Wed, 22 Jan 2020 23:46:11 +0000 (15:46 -0800)]
cmd/go: unify trimpath logic for -mod=vendor, -mod=mod
If a package has a module with a version, the package's directory is
replaced with the module path and version, followed by the package's
path within the module.
This is a follow up to CL 214945. We no longer check whether the
module has a directory (with -mod=vendor, it does not).
Updates #36566
Change-Id: I5bc952b13bc7b4659f58ee555bd6c6a087eb7792
Reviewed-on: https://go-review.googlesource.com/c/go/+/215940
Run-TryBot: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Joel Sing [Wed, 22 Jan 2020 16:31:49 +0000 (03:31 +1100)]
cmd/internal/obj/riscv: restore the ADDI instruction in jalrToSym
While this instruction is not needed for the relocation (the lower immediate
can be patched directly into the JALR instruction), other code currently
depends on the jump sequence being 12 bytes (or three instructions) long.
Put the ADDI instruction back until these can be found and fixed.
Reason for revert: the assumption that a T-E of "gzip" implies
"chunked" seems incorrect. The RFC does state that one "MUST apply
chunked as the final transfer coding" but that should be interpreted to
mean that a "chunked" encoding must be listed as the last one, not that
one should be assumed to be there if not. This is confirmed by the
alternative option to chunking on the server side being to "terminate
the message by closing the connection".
The issue seems confirmed by the fact that the code in the body of
#29162 fails with the following error:
net/http: HTTP/1.x transport connection broken: http: failed to gunzip body: unexpected EOF
This late in the cycle, revert rather than fix, also because we don't
apparently have tests for the correct behavior.
Austin Clements [Mon, 6 Jan 2020 16:10:26 +0000 (11:10 -0500)]
runtime: document special memmove requirements
Unlike C's memmove, Go's memmove must be careful to do indivisible
writes of pointer values because it may be racing with the garbage
collector reading the heap.
We've had various bugs related to this over the years (#36101, #13160,
#12552). Indeed, memmove is a great target for optimization and it's
easy to forget the special requirements of Go's memmove.
The CL documents these (currently unwritten!) requirements. We're also
adding a test that should hopefully keep everyone honest going
forward, though it's hard to be sure we're hitting all cases of
memmove.
Ian Lance Taylor [Wed, 22 Jan 2020 00:50:56 +0000 (16:50 -0800)]
runtime: don't skip checkTimers if we would clear deleted timers
The timers code used to have a problem: if code started and stopped a
lot of timers, as would happen with, for example, lots of calls to
context.WithTimeout, then it would steadily use memory holding timers
that had stopped but not been removed from the timer heap.
That problem was fixed by CL 214299, which would remove all deleted
timers whenever they got to be more than 1/4 of the total number of
timers on the heap.
The timers code had a different problem: if there were some idle P's,
the running P's would have lock contention trying to steal their timers.
That problem was fixed by CL 214185, which only acquired the timer lock
if the next timer was ready to run or there were some timers to adjust.
Unfortunately, CL 214185 partially undid 214299, in that we could now
accumulate an increasing number of deleted timers while there were no
timers ready to run. This CL restores the 214299 behavior, by checking
whether there are lots of deleted timers without acquiring the lock.
This is a performance issue to consider for the 1.14 release.
Change-Id: I13c980efdcc2a46eb84882750c39e3f7c5b2e7c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/215722
Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Jay Conrod [Tue, 21 Jan 2020 22:50:36 +0000 (14:50 -0800)]
cmd/go: add -d flag to mod_get_test
'go get all' was run in this test without -d. This caused some std
packages to be reinstalled if the test is run in a slightly different
configuration than make.bash was run. run.bash would fail in some
situations because of this. Nothing in the cmd/go tests should modify
installed std or cmd packages.
Updates #35459
Change-Id: Idd259a27d55502923b7fc54f361a77f0ac11eea2
Reviewed-on: https://go-review.googlesource.com/c/go/+/215721
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org>
Joel Sing [Thu, 16 Jan 2020 15:51:40 +0000 (02:51 +1100)]
cmd/internal/obj/riscv: correctly split immediates for FLW/FLD/FSW/FSD
The FLW/FLD/FSW/FSD instructions can have immediates that exceed 12-bits and
therefore cannot be encoded in the RISCV instruction. Handle these as we do
for other load/store instructions. Also add test coverage for all load/store
instructions with large immediates.
Fixes compilation issue reported by Carlos Eduardo de Paula.
Updates #27532
Change-Id: Ifa62f19493b3acaba5a90ac31d2df209a3afea81
Reviewed-on: https://go-review.googlesource.com/c/go/+/215037 Reviewed-by: Carlos Eduardo de Paula <me@carlosedp.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Kévin Dunglas [Tue, 21 Jan 2020 21:48:41 +0000 (21:48 +0000)]
net/http/httputil: add docs about X-Forwarded-For in ReverseProxy
ReverseProxy automatically sets the X-Forwarded-For header, if the request
already contains a X-Forwarded-For header, the value of the client IP is
appended to the existing header value.
This behavior isn't documented anywhere, and can lead to IP spoofing
security issues is the client is untrusted (the most common situation).
This PR documents this behavior.
For future versions, I proposed #36678 that implements a more secure
default behavior and adds support for other forwarded headers.
Carlos Eduardo Seo [Fri, 17 Jan 2020 20:59:59 +0000 (17:59 -0300)]
runtime: fix wrong offset when calling ppc64x nanotime syscall
There is a wrong offset when getting the results of a clock_gettime
syscall. Although the syscall will never be called in native ppc64x,
QEMU doesn't implement VDSO, so it will return wrong values.