1
0
mirror of https://github.com/golang/go synced 2024-11-07 09:06:20 -07:00
Commit Graph

42916 Commits

Author SHA1 Message Date
Bryan C. Mills
4615b39514 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.

Change-Id: I897e0a43e3aebe4c90553c414337a46bfc9c2bef
Reviewed-on: https://go-review.googlesource.com/c/go/+/216317
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2020-01-27 14:34:16 +00:00
Bryan C. Mills
f652015a0a doc/go1.14: document the new GOINSECURE variable
Fixes #36746

Change-Id: Iab9eaceb743ee52c82e7645216a671362189a021
Reviewed-on: https://go-review.googlesource.com/c/go/+/216380
Reviewed-by: witchard <ben.witchard@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2020-01-27 14:32:54 +00:00
Ian Lance Taylor
c333d07ebe strconv: stop describing Unicode graphic characters as non-ASCII
Fixes #36778

Change-Id: I3c4ce100fc219bda0ff1d7a086c2309ed695691d
Reviewed-on: https://go-review.googlesource.com/c/go/+/216478
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2020-01-26 20:38:34 +00:00
Joel Sing
73d213708e cmd/vendor: provide riscv64 support in tools/go/analysis/passes/asmdecl
Manually add riscv64 support.

Currently being added via https://go-review.googlesource.com/c/tools/+/216337.

Updates #27532

Change-Id: I0e1f7c0eeca4e85ae588f427eff818bb7946a851
Reviewed-on: https://go-review.googlesource.com/c/go/+/216262
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-01-25 16:34:18 +00:00
Joel Sing
bcd50e4cd0 vendor: provide golang.org/x/sys/cpu/cpu_riscv64.go
Manually provide golang.org/x/sys/cpu/cpu_riscv64.go until such time
as this code can be updated, post release.

This already exists in x/sys/cpu via:

  https://go-review.googlesource.com/c/sys/+/206860

Update #27532

Change-Id: I57d598ef737642f9c3aa7b280c6c680477ae7633
Reviewed-on: https://go-review.googlesource.com/c/go/+/216261
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-01-25 16:31:46 +00:00
Joel Sing
7f331e0e17 test: adjust tests for riscv64
This disables some tests that are unsupported on riscv64 and adds support
for risc64 to test/nosplit.

Updates #27532, #36739 and #36765

Change-Id: I0a57797a05bc80236709fc240c0a0efb0ee0d16b
Reviewed-on: https://go-review.googlesource.com/c/go/+/216263
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-01-25 16:30:26 +00:00
Joel Sing
69660ed7e0 cmd/go: disable link syso test on linux/riscv64
This test requires support for external linking, which does not currently
exist on linux/riscv64.

Updates #27532 and #36739

Change-Id: Ia0cdf69f1830b995f2882b47d1bc0be82c4b3039
Reviewed-on: https://go-review.googlesource.com/c/go/+/216259
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-01-25 05:48:48 +00:00
Joel Sing
01df6601d8 cmd/objdump: disable unsupported tests on riscv64
Updates #27532, #36738 and #36739.

Change-Id: If10031c6fd2c8ec2aa8c37f7edb148d8f26f8697
Reviewed-on: https://go-review.googlesource.com/c/go/+/216258
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-01-25 05:48:12 +00:00
Joel Sing
37981da9a4 cmd/vendor: cherry pick asm_linux_riscv64.s for x/sys/unix
Manually cherry pick asm_linux_riscv64.s from x/sys/unix rev 4c3a92842,
as needed for the linux/riscv64 port.

Normally this would be a vendor update, however this is significantly
more risky at this point in time - a full update can be done post release.

Updates #27532

Change-Id: I03bb191bc44dcd24b9a29243957b88d7a9091852
Reviewed-on: https://go-review.googlesource.com/c/go/+/216260
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-01-25 05:11:20 +00:00
Brian Kessler
f889845ad8 doc/go1.14: mention math/big.GCD argument change
Change-Id: Ib3b5f64471e7b9794b15a97ba86ba001f2c7d2ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/216200
Reviewed-by: Robert Griesemer <gri@golang.org>
2020-01-25 00:35:43 +00:00
Michael Knyszek
64c22b70bf Revert "runtime: don't hold worldsema across mark phase"
This reverts commit 7b294cdd8d, CL 182657.

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.

Updates #19812.

Change-Id: Iaa26f4dec9b06b9db2a771a44e45f58d0aa8f26d
Reviewed-on: https://go-review.googlesource.com/c/go/+/216358
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-01-24 23:27:33 +00:00
Michael Knyszek
ad3cef184e Revert "runtime: release worldsema before Gosched in STW GC mode"
This reverts commit 05511a5c0a, CL 208379.

Reason for revert: So that we can cleanly revert
https://golang.org/cl/182657.

Change-Id: I4fdf4f864a093db7866b3306f0f8f856b9f4d684
Reviewed-on: https://go-review.googlesource.com/c/go/+/216357
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-01-24 23:27:22 +00:00
Carlos Amedee
e948d2b73e 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>
2020-01-24 19:47:23 +00:00
Draven
67539f6c53 runtime: update deltimer comments
Change-Id: I5f4c21bf650b9825ebd98330ac9faa7371a562be
GitHub-Last-Rev: 4a2e9aabe9
GitHub-Pull-Request: golang/go#36728
Reviewed-on: https://go-review.googlesource.com/c/go/+/216223
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-01-24 19:37:58 +00:00
Alexander Rakoczy
e35876ec65 Revert "runtime: speed up receive on empty closed channel"
This reverts CL 181543 (git e1446d9cee)

Reason for revert: Caused a regression in the race detector.

Updates #32529
Fixes #36714

Change-Id: Ifefe6784f86ea72f414a89f131c239e9c9fd74eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/216158
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-01-24 19:19:16 +00:00
Jay Conrod
1f9f88b95e 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>
2020-01-24 17:36:44 +00:00
Ariel Mashraki
8d7be1e3c9 text/template/parse: remove redundant return
Change the `itemChar` clause to be like all other clauses
that don't return a different state function than the default.

Change-Id: I56c863a7d699c1264b24b42ef23138ec47eaacd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/216117
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-01-23 23:07:10 +00:00
Filippo Valsorda
953bc8f391 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.

This is the same mitigation adopted by Chromium:

https://chromium-review.googlesource.com/c/chromium/src/+/1994434

Change-Id: I2c734f6fb2cb51d906c7fd77034318ffeeb3e146
Reviewed-on: https://go-review.googlesource.com/c/go/+/215905
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ryan Sleevi <sleevi@google.com>
Reviewed-by: Katie Hockman <katie@golang.org>
2020-01-23 22:31:25 +00:00
Carlos Amedee
ace25f82df 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>
2020-01-23 21:01:12 +00:00
Kirill Tatchihin
8453844ed7 time: document how Parse handles two-digit years
Fixes #36549

Change-Id: Ia803330fc046d5807bbefd67acb419cb81640a13
GitHub-Last-Rev: bd35431908
GitHub-Pull-Request: golang/go#36584
Reviewed-on: https://go-review.googlesource.com/c/go/+/214980
Reviewed-by: Rob Pike <r@golang.org>
2020-01-23 20:44:44 +00:00
Bryan C. Mills
39ea3d0a23 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>
2020-01-23 19:11:41 +00:00
Daniel Martí
8689ea6a4a 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>
2020-01-23 18:03:09 +00:00
Jay Conrod
64378c233b 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>
2020-01-23 16:52:00 +00:00
Joel Sing
82a2f825b7 runtime: add missing code for linux/riscv64
Makes linux/riscv64 runtime buildable.

Updates #27532

Change-Id: I91bcadaaecb8ff3ffd70fcb437b2b6e4bbe11eda
Reviewed-on: https://go-review.googlesource.com/c/go/+/215839
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-01-23 14:36:57 +00:00
Joel Sing
9f07cdd99e 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.

Updates #27532

Change-Id: Idb73d716be8eb2eb796591b30f1ec4dc104f2bf8
Reviewed-on: https://go-review.googlesource.com/c/go/+/215840
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-01-23 07:39:53 +00:00
Joel Sing
fa610c776e cmd/internal/obj/riscv: add missing instructions to the ternary expansion list
Updates #27532

Change-Id: I5beb7941c204755948350b181c713b046bc4f1f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/215841
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-01-23 07:33:33 +00:00
Jay Conrod
9f1d55c4e7 cmd/dist: print error if GOROOT is inside a module
Fixes #36701

Change-Id: I22738235e7a7ee06bc5d748213aab523aad8cf12
Reviewed-on: https://go-review.googlesource.com/c/go/+/215939
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Marwan Sulaiman <marwan.sameer@gmail.com>
2020-01-23 00:22:41 +00:00
Filippo Valsorda
f9fe783c6c Revert "net/http: support gzip, x-gzip Transfer-Encodings"
This reverts commit e6c12c3d02.

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.

Change-Id: I920ec928754cd8e96a06fb7ff8a53316c0f959e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/215757
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-01-22 22:06:30 +00:00
Austin Clements
9b5bd30716 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.

Change-Id: I2f59f8d8d6fb42d2f10006b55d605b5efd8ddc24
Reviewed-on: https://go-review.googlesource.com/c/go/+/213418
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-01-22 18:54:48 +00:00
Ian Lance Taylor
895b7c85ad 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>
2020-01-22 18:10:42 +00:00
Joel Sing
fb2e3b82f4 cmd/dist: mark cgo as disabled on linux/riscv64
cgo is not currently supported on this platform.

Updates #27532 and #36641

Change-Id: I4b35f887e869ebc5c156dd754b1c79897a8c5800
Reviewed-on: https://go-review.googlesource.com/c/go/+/215838
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-01-22 16:57:26 +00:00
Joel Sing
b4f15e79af cmd/dist: detect gohostarch on riscv64 hosts
Updates #27532

Change-Id: I66c194499bb7b831b569c66d0736fa7205eedd80
Reviewed-on: https://go-review.googlesource.com/c/go/+/215837
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-01-22 16:56:57 +00:00
Joel Sing
6718cb617f cmd/internal/obj/riscv: implement prologue and epilogue
Based on riscv-go port.

Updates #27532

Change-Id: If552225552bf8d27c29b08de31146dd34986a3a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/204630
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-01-22 15:24:05 +00:00
Jay Conrod
71bbffbc48 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>
2020-01-22 00:45:41 +00:00
Joel Sing
fb8cdb7e4b cmd/internal/obj/riscv: populate DWARF register mapping for riscv64
Updates #27532

Change-Id: If147242c45d5c2d5cdc5b0428db32eeec13a958a
Reviewed-on: https://go-review.googlesource.com/c/go/+/215377
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-01-21 23:58:54 +00:00
Joel Sing
1424889921 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>
2020-01-21 23:58:09 +00:00
Kévin Dunglas
88ed322afc 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.

Change-Id: Ief14f5063caebfccb87714f54cffa927c714e5fd
GitHub-Last-Rev: fd0bd29a18
GitHub-Pull-Request: golang/go#36672
Reviewed-on: https://go-review.googlesource.com/c/go/+/215617
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-01-21 21:51:46 +00:00
Carlos Eduardo Seo
71239b4f49 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.

Fixes #36592

Change-Id: Icf838075228dcdd62cf2c1279aa983e5993d66ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/215397
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-01-20 15:06:42 +00:00
Tobias Klauser
df2999ef43 test: disable test for #36516 when cgo is not enabled
CL 214679 added a -race test which shouldn't be run when cgo is not
enabled.

Fixes the nocgo builder.

Change-Id: Iceddf802c4ef6c0de2c3a968e86342303d2d27d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/215477
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-01-19 20:36:10 +00:00
Joel Sing
02816a2cad reflect: correct riscv64 assembly
R0 is not a thing in riscv64 assembly - use ZERO (rather than X0) since
the rest of this currently uses ABI names.

Updates #27532

Change-Id: I28fb68e9f80d05231a07c5921e7062777234e2c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/215437
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-01-19 15:28:32 +00:00
Joel Sing
8e0be05ec7 runtime: add support for linux/riscv64
Based on riscv-go port.

Updates #27532

Change-Id: If522807a382130be3c8d40f4b4c1131d1de7c9e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/204632
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-01-19 14:04:09 +00:00
Yasser Abdolmaleki
cbaa666682 net: document *OpError.Err must not be nil
The point of *net.OpError is to add details to an underlying lower
level error. It makes no sense to have an OpError without an Err and
a nil *OpError.Err will cause *OpError.Error() method to panic.

Fixes #33007

Change-Id: If4fb2501e02dad110a095b73e18c47312ffa6015
Reviewed-on: https://go-review.googlesource.com/c/go/+/187677
Reviewed-by: Rob Pike <r@golang.org>
2020-01-19 02:25:54 +00:00
Joel Sing
98d2717499 cmd/compile: implement compiler for riscv64
Based on riscv-go port.

Updates #27532

Change-Id: Ia329daa243db63ff334053b8807ea96b97ce3acf
Reviewed-on: https://go-review.googlesource.com/c/go/+/204631
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-01-18 14:41:40 +00:00
Joel Sing
91d75f4e4c reflect: add support for riscv64
Based on riscv-go port.

Update #27532

Change-Id: I791924f71078fd8dfe9c2fc03a3f21a3bc673721
Reviewed-on: https://go-review.googlesource.com/c/go/+/204634
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-01-18 13:45:50 +00:00
Roger Peppe
03eeaa9656 testing: clarify that Cleanup is run after subtests complete.
It's good to be explicit, as it's not necessarily obvious (and indeed
the behavior has changed recently with https://go-review.googlesource.com/c/go/+/214822)
without an associated doc comment change).

Change-Id: I99d6398bf15b404b1b1b196e712e926e363251e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/215217
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-01-18 08:45:35 +00:00
David Chase
c112289ee4 cmd/compile: change the "bogus line" to be 1
The previous value was "too bogus" and caused objdump to crash.
Updated infinite loop test results (only run if -args -f) in ssa/debug_test.go
Probably also fixes #36621 but that bug needs more info to tell for certain.

Fixes #36570

Change-Id: I51144641d25d559308a98d726d87806bd340cc5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/215297
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-01-17 23:14:48 +00:00
Keith Randall
316fd8cc4a cmd/compile: mark ... argument to checkptrArithmetic as not escaping
Fixes #36516

Change-Id: Ibf4f86fb3a25fa30e0cd54e2dd2e12c60ee75ddb
Reviewed-on: https://go-review.googlesource.com/c/go/+/214679
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-01-17 17:38:40 +00:00
Jay Conrod
574c286607 cmd/go: trim paths from vendored packages with -trimpath
In CL 199821, we stopped setting the module directory for vendored
packages when -mod=vendor is used. This broke -trimpath, since we
replace the module directory with a string derived from the module
path and version. A comment in CL 202977 makes it clear that the
module directory should not be set.

With this change, -trimpath falls back to replacing the package
directory with the package path if the module directory is not set. We
also fall back to replacing the package directory if the module
version is not set to avoid adding a meaningless @ only for the main
module.

As a consequence of this change, file names in vendored packages will
not have module versions, so file names will be a little different
between -mod=mod and -mod=vendor.

Fixes #36566

Change-Id: I0e9cd76d36a2028a49d0b6697ea9a9b3140d7ff3
Reviewed-on: https://go-review.googlesource.com/c/go/+/214945
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2020-01-16 22:25:09 +00:00
Ian Lance Taylor
998cbe2983 testing: don't run Cleanup functions until parallel subtests complete
Fixes #31651

Change-Id: Idbab0c4355fcc58520e210126795223435cf0078
Reviewed-on: https://go-review.googlesource.com/c/go/+/214822
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-01-16 21:32:12 +00:00
Ian Lance Taylor
d2de9bd59c runtime: ignore power notification error seen on Windows Docker
Fixes #36557

Change-Id: Ia8125f382d5e14e5612da811268a58971cc9ac08
Reviewed-on: https://go-review.googlesource.com/c/go/+/214917
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Austin Clements <austin@google.com>
2020-01-16 04:02:37 +00:00