aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-07-02[dev.boringcrypto.go1.9] all: merge go1.9.7 into dev.boringcrypto.go1.9dev.boringcrypto.go1.9Filippo Valsorda
Change-Id: I1f9769a0c2c7c090886afa31c86c403da29d2013
2018-06-06[release-branch.go1.9] go1.9.7go1.9.7Filippo Valsorda
Change-Id: I417f9b711f92d0297d9d24272cb88365cdd945d3 Reviewed-on: https://go-review.googlesource.com/116497 Run-TryBot: Filippo Valsorda <filippo@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-06-06[release-branch.go1.9] doc: document Go 1.9.7Filippo Valsorda
Change-Id: I10dededb41162a99dbc42792a9d314c6dabddcca Reviewed-on: https://go-review.googlesource.com/116362 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> (cherry picked from commit b3a9948126471ac285e30c7920465c4c28ea0526) Reviewed-on: https://go-review.googlesource.com/116475 Reviewed-by: Filippo Valsorda <filippo@golang.org>
2018-06-04[release-branch.go1.9] cmd/go: fix 'go get' compatibility for direct ↵Russ Cox
download of vgo-aware module CL 109340 added “minimal module-awareness for legacy operation.” One part of that is reinterpreting imports inside code trees with go.mod files as using semantic import versioning, and converting them back to legacy import paths by stripping the major version element (for example, interpreting import "x.com/foo/v2/bar" as import "x.com/foo/bar"). This rewrite was not being applied during "go get", with the effect that once you had the target code downloaded already, everything was fine, but it didn't download and build successfully the first time. Fixes #25687. Cherry-pick fixes #25691. Change-Id: I3e122efdc8fd9a0a4e66f5aa3e6a99f90c7df779 Reviewed-on: https://go-review.googlesource.com/115797 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-on: https://go-review.googlesource.com/116175
2018-06-04[release-branch.go1.9] cmd/go: add minimal module-awareness for legacy operationRuss Cox
We want authors to be able to publish code that works with both the current standard go command and the planned new go command support for modules. If authors have tagged their code v2 or later, semantic import versioning means the import paths must include a v2 path element after the path prefix naming the module. One option for making this convention compatible with original go get is to move code into a v2 subdirectory of the root. That makes sense for some authors, but many authors would prefer not to move all the code into a v2 subdirectory for a transition and then move it back up once we everyone has a module-aware go command. Instead, this CL teaches the old (non-module-aware) go command a tiny amount about modules and their import paths, to expand the options for authors who want to publish compatible packages. If an author has a v2 of a package, say my/thing/v2/sub/pkg, in the my/thing repo's sub/pkg subdirectory (no v2 in the file system path), then old go get continues to import that package as my/thing/sub/pkg. But when go get is processing code in any module (code in a tree with a go.mod file) and encounters a path like my/thing/v2/sub/pkg, it will check to see if my/thing/go.mod says "module my/thing/v2". If so, the go command will read the import my/thing/v2/sub/pkg as if it said my/thing/sub/pkg, which is the correct "old" import path for the package in question. This CL will be back-ported to Go 1.10 and Go 1.9 as well. Once users have updated to the latest Go point releases containing this new logic, authors will be able to update to using modules within their own repos, including using semantic import paths with vN path elements, and old go get will still be able to consume those repositories. This CL also makes "go get" ignore meta go-import lines using the new "mod" VCS type. This allows a package to specify both a "mod" type and a "git" type, to present more efficient module access to module-aware go but still present a Git repo to the old "go get". Fixes #24751. Fixes #25069. This backport to Go 1.9 also had to pick up p.Internal.RawImports from CL 74750 and CL 74356 and use it to prepare an updated set of -importmap arguments for the compiler. (The old code only understood vendor-related rewriting of import paths.) Backport fixes #25140. Change-Id: I378955613a0d63834d4f50f121f4db7e4d87dc0a Reviewed-on: https://go-review.googlesource.com/115298 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-05-31[release-branch.go1.9] cmd/go: accept more safe CFLAGS/LDFLAGSIan Lance Taylor
Fixes #23749 Fixes #24703 Fixes #24858 Change-Id: Ib32d8efee294004c70fdd602087df2da0867f099 Reviewed-on: https://go-review.googlesource.com/115415 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> (cherry picked from commit cc6e568c818053ddc16b80b0406a87d19de7a120) Reviewed-on: https://go-review.googlesource.com/115436 Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-05-26[release-branch.go1.9] strings: fix encoding of \u0080 in mapMartin Möhrmann
Fix encoding of PAD (U+0080) which has the same value as utf8.RuneSelf being incorrectly encoded as \x80 in strings.Map due to using <= instead of a < comparison operator to check one byte encodings for utf8. Fixes golang/go#25573 Change-Id: Ib6c7d1f425a7ba81e431b6d64009e713d94ea3bc Reviewed-on: https://go-review.googlesource.com/111286 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> (cherry picked from commit 8c62fc0ca3c96ecbd3a6e81546aa8c53e32ff500) Reviewed-on: https://go-review.googlesource.com/114636 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-05-09[release-branch.go1.9] crypto/x509: copy and use adjusted ↵Alex Brainman
syscall.CertChainPolicyPara As discussed in issue #21376, it is unsafe to have syscall.CertChainPolicyPara.ExtraPolicyPara uintptr - it has to be a pointer type. So copy syscall.CertChainPolicyPara into crypto/tls package, make ExtraPolicyPara unsafe.Pointer, and use new struct instead of syscall.CertChainPolicyPara. Fixes #25034 Change-Id: If914af056cbbb0c4d93ffaa915b3d2cb5ecad0cd Reviewed-on: https://go-review.googlesource.com/111715 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> Reviewed-on: https://go-review.googlesource.com/112179 Reviewed-by: Filippo Valsorda <filippo@golang.org> Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-05-08[release-branch.go1.9] misc/cgo/testcshared: use file descriptor 30 for ↵Ian Lance Taylor
TestUnexportedSymbols Backport of CL 108537 to 1.9 release branch. We were using file descriptor 100, which requires the Linux kernel to grow the fdtable size. That step may sometimes require a long time, causing the test to fail. Switch to file descriptor 30, which should not require growing the fdtable. Updates #23784 Fixes #25278 Change-Id: I19ea6ab1724ec1807643d5111c44631e20be76b0 Reviewed-on: https://go-review.googlesource.com/111996 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-30[release-branch.go1.9] go1.9.6go1.9.6Andrew Bonventre
Change-Id: I00cd8ac03baa5961eb2b6206a4f407b5d89bcece Reviewed-on: https://go-review.googlesource.com/110336 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-30[release-branch.go1.9] doc: document Go 1.9.6Andrew Bonventre
Change-Id: I9699b22d3a308cda685aa684b32dcde99333df46 Reviewed-on: https://go-review.googlesource.com/110315 Reviewed-by: Filippo Valsorda <filippo@golang.org> (cherry picked from commit 40685b230a012dd5a9ca471dbf21b65457c32147) Reviewed-on: https://go-review.googlesource.com/110375 Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-04-30[release-branch.go1.9] cmd/compile: permit go:cgo_import_dynamic anywhereIan Lance Taylor
It's used on Solaris to import symbols from shared libraries, e.g., in golang.org/x/sys/unix and golang.org/x/net/internal/socket. We could use a different directive but that would require build tags in all the places that use it. Fixes golang/go#23939 Change-Id: I47fcf72a6d2862e304204705979c2056c2f78ec5 Reviewed-on: https://go-review.googlesource.com/94018 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> (cherry picked from commit 41d3d153eb76f000e9f6e9edf68ed441d15081cb) Reviewed-on: https://go-review.googlesource.com/110077 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-04-27[release-branch.go1.9] cmd/compile: fix evaluation of "" < sJosh Bleecher Snyder
Fixes #24934 Change-Id: Ifa79ab3dfe69297eeef85f7193cd5f85e5982bc5 Reviewed-on: https://go-review.googlesource.com/106655 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-on: https://go-review.googlesource.com/108943 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-29[release-branch.go1.9] go1.9.5go1.9.5Andrew Bonventre
Change-Id: If8542fb3e9064971fb0b3be8f910fbfd5061010e Reviewed-on: https://go-review.googlesource.com/103167 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-03-29[release-branch.go1.9] cmd/go: add more C compiler/linker options to whitelistIan Lance Taylor
Fixes #23937 Change-Id: Ie63d91355d1a724d0012d99d457d939deeeb8d3e Reviewed-on: https://go-review.googlesource.com/102818 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org> Reviewed-on: https://go-review.googlesource.com/103156 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-29[release-branch.go1.9] cmd/go: permit pkg-config flags in any argument positionIan Lance Taylor
Fixes #23875 Change-Id: I503af71f44d11cd6b787fef100246b55735614a0 Reviewed-on: https://go-review.googlesource.com/94896 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-on: https://go-review.googlesource.com/103155 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-29[release-branch.go1.9] cmd/go: add options to security whitelistIan Lance Taylor
Also permit passing flags to pkg-config, as we used to. Also change the error message to refer to https://golang.org/s/invalidflag. Fixes #23749 Change-Id: I3fbeb4c346610e6fd55e8720e720b0a40e352ab5 Reviewed-on: https://go-review.googlesource.com/93836 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-on: https://go-review.googlesource.com/103135 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-29[release-branch.go1.9] cmd/compile: use unsigned loads for multi-element ↵Keith Randall
comparisons When loading multiple elements of an array into a single register, make sure we treat them as unsigned. When treated as signed, the upper bits might all be set, causing the shift-or combo to clobber the values higher in the register. Fixes #23719. Change-Id: Ic87da03e9bd0fe2c60bb214b99f846e4e9446052 Reviewed-on: https://go-review.googlesource.com/92335 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ilya Tocar <ilya.tocar@intel.com> Reviewed-on: https://go-review.googlesource.com/103115 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2018-03-29[release-branch.go1.9] doc: update 1.9.5 release notes to include net/http/pprofAndrew Bonventre
Change-Id: I7c0716711a2cadd347fdf242c792b109539f7355 Reviewed-on: https://go-review.googlesource.com/103163 Reviewed-by: Andrew Bonventre <andybons@golang.org> Reviewed-on: https://go-review.googlesource.com/103165 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-03-29[release-branch.go1.9] doc: update release notes for Go 1.9.5Andrew Bonventre
Change-Id: Idf88d289bac9603d852a9d19eb4b764f8589f8d9 Reviewed-on: https://go-review.googlesource.com/103159 Reviewed-by: Andrew Bonventre <andybons@golang.org> Reviewed-on: https://go-review.googlesource.com/103161 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-29[release-branch.go1.9] doc: document Go 1.9.5Andrew Bonventre
Change-Id: I8f12b188d2e13555e1d7634b9cc0319fc737cb1d Reviewed-on: https://go-review.googlesource.com/103216 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/103220 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-03-29[release-branch.go1.9] net/http/pprof: harden handler responsesAndrew Bonventre
A very small number of old browsers consider content as HTML even when it is explicitly stated in the Content-Type header that it is not. If content served is based on user-supplied input, then an XSS is possible. Introduce three mitigations: + Don't reflect user input in error strings + Set a Content-Disposition header when requesting a resource that should never be displayed in a browser window + Set X-Content-Type-Options: nosniff on all responses Change-Id: I81c9d6736e0439ebd1db99cd7fb701cc56d24805 Reviewed-on: https://go-review.googlesource.com/102318 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-on: https://go-review.googlesource.com/103164 Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-03-29[release-branch.go1.9] cmd/go: restrict meta imports to valid schemesIan Lance Taylor
Before this change, when using -insecure, we permitted any meta import repo root as long as it contained "://". When not using -insecure, we restrict meta import repo roots to be valid URLs. People may depend on that somehow, so permit meta import repo roots to be invalid URLs, but require them to have valid schemes per RFC 3986. Fixes #23867 Change-Id: Iac666dfc75ac321bf8639dda5b0dba7c8840922d Reviewed-on: https://go-review.googlesource.com/94603 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-on: https://go-review.googlesource.com/102776 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-29[release-branch.go1.9] cmd/compile: fix constant folding of right shifts on ↵Keith Randall
s390x Repeat previous fix on amd64 for s390x. Sub-word right shifts should sign extend before shifting. Update #23812 Change-Id: I2d770190c7d8a22310b0dbd9facb3fb05afa362a Reviewed-on: https://go-review.googlesource.com/94028 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-on: https://go-review.googlesource.com/102777 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2018-03-29[release-branch.go1.9] cmd/compile: fix constant folding of right shiftsKeith Randall
The sub-word shifts need to sign-extend before shifting, to avoid bringing in data from higher in the argument. Fixes #23812 Change-Id: I0a95a0b49c48f3b40b85765bb4a9bb492be0cd73 Reviewed-on: https://go-review.googlesource.com/93716 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-on: https://go-review.googlesource.com/102775 Run-TryBot: Andrew Bonventre <andybons@golang.org>
2018-02-09[dev.boringcrypto.go1.9] all: merge go1.9.4 into dev.boringcryptoRuss Cox
Change-Id: Ieff4c038bdd8babc9db764bd088d981f4a0805d5
2018-02-07[release-branch.go1.9] go1.9.4go1.9.4Russ Cox
Change-Id: I2ab24e37b21d4b3275ffaeab3cb27d4e8e276e1e Reviewed-on: https://team-review.git.corp.google.com/213171 Reviewed-by: Andrew Bonventre <andybons@google.com>
2018-02-07[release-branch.go1.9] doc: document Go 1.9.4Russ Cox
Change-Id: Ia3e35328d50bbd08948b34e09a9e8bb4f9b07888 Reviewed-on: https://team-review.git.corp.google.com/213170 Reviewed-by: Andrew Bonventre <andybons@google.com>
2018-02-07[release-branch.go1.9] cmd/go: accept only limited compiler and linker flags ↵Russ Cox
in #cgo directives Both gcc and clang accept an option -fplugin=code.so to load a plugin from the ELF shared object file code.so. Obviously that plugin can then do anything it wants during the build. This is contrary to the goal of "go get" never running untrusted code during the build. (What happens if you choose to run the result of the build is your responsibility.) Disallow this behavior by only allowing a small set of known command-line flags in #cgo CFLAGS directives (and #cgo LDFLAGS, etc). The new restrictions can be adjusted by the environment variables CGO_CFLAGS_ALLOW, CGO_CFLAGS_DISALLOW, and so on. See the documentation. In addition to excluding cgo-defined flags, we also have to make sure that when we pass file names on the command line, they don't look like flags. So we now refuse to build packages containing suspicious file names like -x.go. A wrinkle in all this is that GNU binutils uniformly accept @foo on the command line to mean "if the file foo exists, then substitute its contents for @foo in the command line". So we must also reject @x.go, flags and flag arguments beginning with @, and so on. Fixes #23673, CVE-2018-6574. Change-Id: I59e7c1355155c335a5c5ae0d2cf8fa7aa313940a Reviewed-on: https://team-review.git.corp.google.com/212507 Reviewed-by: Ian Lance Taylor <iant@google.com>
2018-02-01all: merge go1.9.3 into dev.boringcrypto.go1.9Russ Cox
Change-Id: I184dd79b7398a8989e0b8284c7c81bb59343c1cb
2018-01-23[release-branch.go1.9] doc: document Go 1.8.6Andrew Bonventre
Update golang/go#23515 Change-Id: Id334d8663bf4cbb68f224d1bba4c9ad3855f8aae Reviewed-on: https://go-review.googlesource.com/89155 Reviewed-by: Andrew Gerrand <adg@golang.org> (cherry picked from commit 6c27114cedb47e8bd2723416ea0c63d047a2cefc) Reviewed-on: https://go-review.googlesource.com/89176 Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-01-22[release-branch.go1.9] go1.9.3go1.9.3Andrew Bonventre
Change-Id: I9347a78c86dcc13cd5f6f000e788934cb1bda491 Reviewed-on: https://go-review.googlesource.com/89015 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-01-22[release-branch.go1.9] doc/contrib.html: fix outdated linkStanislav Afanasev
Change-Id: I6d94a14a781a2fbeb90db35ae3490ce2ac5f8ed1 Reviewed-on: https://go-review.googlesource.com/83315 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> (cherry picked from commit 2fb9fe48c63ed0b7eee36d0d8c2d494ad70602b0) Reviewed-on: https://go-review.googlesource.com/89036 Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-01-22[release-branch.go1.9] doc: update 1.9.3 release dateAndrew Bonventre
Change-Id: I689ccfb8452a170629425dc97da503b28766c6f9 Reviewed-on: https://go-review.googlesource.com/89035 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> (cherry picked from commit 7abbaddea4819515e1dad817cc1090e18f655b60) Reviewed-on: https://go-review.googlesource.com/89055 Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-01-22[release-branch.go1.9] doc: change anchor URLs from golang.org/dl/ to /dl/Andrew Bonventre
When running locally, it will redirect properly to golang.org/dl/ (see https://github.com/golang/tools/blob/master/cmd/godoc/dl.go). This is to support domains in prod other than golang.org. Change-Id: I6d3051fcd7e06a86442324a64d781d8ad95c624f Reviewed-on: https://go-review.googlesource.com/88679 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-on: https://go-review.googlesource.com/88715 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-22[release-branch.go1.9] net/http: update bundled http2Andrew Bonventre
Updates http2 to x/net/http2 git rev 44b7c21 for http2: Discard data reads on HEAD requests https://golang.org/cl/88655 Fixes golang/go#22376 Change-Id: I931d9065d7309bc6d3f978bfe8cc6a9f940ce9e9 Reviewed-on: https://go-review.googlesource.com/88676 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-22[release-branch.go1.9] cmd/compile: fix mapassign_fast* routines for pointer ↵Keith Randall
keys The signature of the mapassign_fast* routines need to distinguish the pointerness of their key argument. If the affected routines suspend part way through, the object pointed to by the key might get garbage collected because the key is typed as a uint{32,64}. This is not a problem for mapaccess or mapdelete because the key in those situations do not live beyond the call involved. If the object referenced by the key is garbage collected prematurely, the code still works fine. Even if that object is subsequently reallocated, it can't be written to the map in time to affect the lookup/delete. Fixes #22781 Change-Id: I0bbbc5e9883d5ce702faf4e655348be1191ee439 Reviewed-on: https://go-review.googlesource.com/79018 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Martin Möhrmann <moehrmann@google.com> Reviewed-on: https://go-review.googlesource.com/88635 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2018-01-22[release-branch.go1.9] net/url: reject invalid userinfo values when parsing URLsBrad Fitzpatrick
Fixes #23392 Change-Id: I5822b082b14d886b9c3b5ad7beebb2c01a77851b Reviewed-on: https://go-review.googlesource.com/87038 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/88535 Run-TryBot: Andrew Bonventre <andybons@golang.org>
2018-01-22[release-branch.go1.9] runtime: call amd64 VDSO entry points on large stackIan Lance Taylor
NOTE: This elides changes to src/runtime/sys_linux_386.s since that requires another change (golang.org/cl/69390) which we don’t want to backport. If the Linux kernel was built with CONFIG_OPTIMIZE_INLINING=n and was built with hardening options turned on, GCC will insert a stack probe in the VDSO function that requires a full page of stack space. The stack probe can corrupt memory if another thread is using it. Avoid sporadic crashes by calling the VDSO on the g0 or gsignal stack. While we're at it, align the stack as C code expects. We've been getting away with a misaligned stack, but it's possible that the VDSO code will change in the future to break that assumption. Benchmarks show a 11% hit on time.Now, but it's only 6ns. name old time/op new time/op delta AfterFunc-12 1.66ms ± 0% 1.66ms ± 1% ~ (p=0.905 n=9+10) After-12 1.90ms ± 6% 1.86ms ± 0% -2.05% (p=0.012 n=10+8) Stop-12 113µs ± 3% 115µs ± 2% +1.60% (p=0.017 n=9+10) SimultaneousAfterFunc-12 145µs ± 1% 144µs ± 0% -0.68% (p=0.002 n=10+8) StartStop-12 39.5µs ± 3% 40.4µs ± 5% +2.19% (p=0.023 n=10+10) Reset-12 10.2µs ± 0% 10.4µs ± 0% +2.45% (p=0.000 n=10+9) Sleep-12 190µs ± 1% 190µs ± 1% ~ (p=0.971 n=10+10) Ticker-12 4.68ms ± 2% 4.64ms ± 2% -0.83% (p=0.043 n=9+10) Now-12 48.4ns ±11% 54.0ns ±11% +11.42% (p=0.017 n=10+10) NowUnixNano-12 48.5ns ±13% 56.9ns ± 8% +17.30% (p=0.000 n=10+10) Format-12 489ns ±11% 504ns ± 6% ~ (p=0.289 n=10+10) FormatNow-12 436ns ±23% 480ns ±13% +10.25% (p=0.026 n=9+10) MarshalJSON-12 656ns ±14% 587ns ±24% ~ (p=0.063 n=10+10) MarshalText-12 647ns ± 7% 638ns ± 9% ~ (p=0.516 n=10+10) Parse-12 348ns ± 8% 328ns ± 9% -5.66% (p=0.030 n=10+10) ParseDuration-12 136ns ± 9% 140ns ±11% ~ (p=0.425 n=10+10) Hour-12 14.8ns ± 6% 15.6ns ±11% ~ (p=0.085 n=10+10) Second-12 14.0ns ± 6% 14.3ns ±12% ~ (p=0.443 n=10+10) Year-12 32.4ns ±11% 33.4ns ± 6% ~ (p=0.492 n=10+10) Day-12 41.5ns ± 9% 42.3ns ±12% ~ (p=0.239 n=10+10) Fixes #20427 Change-Id: Ia395cbb863215f4499b8e7ef95f4b99f51090911 Reviewed-on: https://go-review.googlesource.com/76990 Reviewed-by: Austin Clements <austin@google.com> Reviewed-on: https://go-review.googlesource.com/88495 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-22[release-branch.go1.9] runtime: use MAP_ANON in sigstack checkAustin Clements
MAP_ANON is the deprecated but more portable spelling of MAP_ANONYMOUS. Use MAP_ANON to un-break the Darwin 10.10 builder. Updates #22930. Change-Id: Iedd6232b94390b3b2a7423c45cdcb25c1a5b3323 Reviewed-on: https://go-review.googlesource.com/88316 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-22[release-branch.go1.9] runtime: restore the Go-allocated signal stack in unminitAustin Clements
Currently, when we minit on a thread that already has an alternate signal stack (e.g., because the M was an extram being used for a cgo callback, or to handle a signal on a C thread, or because the platform's libc always allocates a signal stack like on Android), we simply drop the Go-allocated gsignal stack on the floor. This is a problem for Ms on the extram list because those Ms may later be reused for a different thread that may not have its own alternate signal stack. On tip, this manifests as a crash in sigaltstack because we clear the gsignal stack bounds in unminit and later try to use those cleared bounds when we re-minit that M. On 1.9 and earlier, we didn't clear the bounds, so this manifests as running more than one signal handler on the same signal stack, which could lead to arbitrary memory corruption. This CL fixes this problem by saving the Go-allocated gsignal stack in a new field in the m struct when overwriting it with a system-provided signal stack, and then restoring the original gsignal stack in unminit. This CL is designed to be easy to back-port to 1.9. It won't quite cherry-pick cleanly, but it should be sufficient to simply ignore the change in mexit (which didn't exist in 1.9). Now that we always have a place to stash the original signal stack in the m struct, there are some simplifications we can make to the signal stack handling. We'll do those in a later CL. Fixes #22930. Change-Id: I55c5a6dd9d97532f131146afdef0b216e1433054 Reviewed-on: https://go-review.googlesource.com/88315 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-22[release-branch.go1.9] cmd/compile: fix decomposition of 1-element arraysKeith Randall
The offending rule could move the load to a different block, which is always a bad idea. Fixes #22683 Change-Id: I973c88389b2359f734924d9f45c3fb38e166691d Reviewed-on: https://go-review.googlesource.com/77331 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com>
2018-01-22[release-branch.go1.9] doc: document Go 1.9.3Andrew Bonventre
Change-Id: Ic7a5d3118754b34ab0652fcef889259a03baebc3 Reviewed-on: https://go-review.googlesource.com/88536 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/88678 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-01-22[release-branch.go1.9] cmd/compile: fix large load/store offsets on 386Keith Randall
Pointer arithemetic is done mod 2^32 on 386, so we can just drop the high bits of any large constant offsets. The bounds check will make sure wraparounds are never observed. Fixes #21655 Change-Id: I68ae5bbea9f02c73968ea2b21ca017e5ecb89223 Reviewed-on: https://go-review.googlesource.com/82675 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-on: https://go-review.googlesource.com/88324 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2018-01-22[release-branch.go1.9] database/sql: fix transaction leakkirk
When the user context which passed in (*DB)BeginTx is canceled or timeout, the current implementation could cause db transaction leak in some extreme scenario. Goroutine 1: Call (*DB) BeginTx begins a transaction with a userContext. In (*DB)BeginTx, a new goroutine (*Tx)awaitDone which monitor context and rollback tx if needed will be created Goroutine 2(awaitDone): block on tx.ctx.Done() Goroutine 1: Execute some insert or update sqls on the database Goroutine 1: Commit the transaction, (*Tx)Commit set the atomic variable tx.done to 1 Goroutine 3(maybe global timer): Cancel userContext which be passed in Tx Goroutine 1: (*Tx)Commit checks tx.ctx.Done(). Due to the context has been canceled, it will return context.Canceled or context.DeadlineExceeded error immediately and abort the real COMMIT operation of transaction Goroutine 2: Release with tx.ctx.Done() signal, execute (*Tx)rollback. However the atomic variable tx.done is 1 currently, it will return ErrTxDone error immediately and abort the real ROLLBACK operation of transaction Fixes #22976 Change-Id: I3bc23adf25db823861d91e33d3cca6189fb1171d Reviewed-on: https://go-review.googlesource.com/81736 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Daniel Theophanes <kardianos@gmail.com> Reviewed-on: https://go-review.googlesource.com/88323 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-22[release-branch.go1.9] math/big: protect against aliasing in nat.divLargeAlberto Donizetti
In nat.divLarge (having signature (z nat).divLarge(u, uIn, v nat)), we check whether z aliases uIn or v, but aliasing is currently not checked for the u parameter. Unfortunately, z and u aliasing each other can in some cases cause errors in the computation. The q return parameter (which will hold the result's quotient), is unconditionally initialized as q = z.make(m + 1) When cap(z) ≥ m+1, z.make() will reuse z's backing array, causing q and z to share the same backing array. If then z aliases u, setting q during the quotient computation will then corrupt u, which at that point already holds computation state. To fix this, we add an alias(z, u) check at the beginning of the function, taking care of aliasing the same way we already do for uIn and v. Fixes #22830 Change-Id: I3ab81120d5af6db7772a062bb1dfc011de91f7ad Reviewed-on: https://go-review.googlesource.com/78995 Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-on: https://go-review.googlesource.com/88322 Run-TryBot: Andrew Bonventre <andybons@golang.org>
2018-01-22[release-branch.go1.9] runtime: fix gctrace STW CPU time and CPU fractionAustin Clements
The CPU time reported in the gctrace for STW phases is simply work.stwprocs times the wall-clock duration of these phases. However, work.stwprocs is set to gcprocs(), which is wrong for multiple reasons: 1. gcprocs is intended to limit the number of Ms used for mark termination based on how well the garbage collector actually scales, but the gctrace wants to report how much CPU time is being stolen from the application. During STW, that's *all* of the CPU, regardless of how many the garbage collector can actually use. 2. gcprocs assumes it's being called during STW, so it limits its result to sched.nmidle+1. However, we're not calling it during STW, so sched.nmidle is typically quite small, even if GOMAXPROCS is quite large. Fix this by setting work.stwprocs to min(ncpu, GOMAXPROCS). This also fixes the overall GC CPU fraction, which is based on the computed CPU times. Fixes #22725. Change-Id: I64b5ce87e28dbec6870aa068ce7aecdd28c058d1 Reviewed-on: https://go-review.googlesource.com/77710 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rick Hudson <rlh@golang.org> Reviewed-on: https://go-review.googlesource.com/88321 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2018-01-22[release-branch.go1.9] cmd/compile: fix runtime.KeepAliveKeith Randall
KeepAlive needs to introduce a use of the spill of the value it is keeping alive. Without that, we don't guarantee that the spill dominates the KeepAlive. This bug was probably introduced with the code to move spills down to the dominator of the restores, instead of always spilling just after the value itself (CL 34822). Fixes #22458. Change-Id: I94955a21960448ffdacc4df775fe1213967b1d4c Reviewed-on: https://go-review.googlesource.com/74210 Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-on: https://go-review.googlesource.com/88318 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2018-01-22[release-branch.go1.9] cmd/compile: make sure not to use SP as an index registerKeith Randall
...because that's an illegal addressing mode. I double-checked handling of this code, and 387 is the only place where this check is missing. Fixes #22429 Change-Id: I2284fe729ea86251c6af2f04076ddf7a5e66367c Reviewed-on: https://go-review.googlesource.com/73551 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/88317 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2018-01-20doc: hide content blocked by GFW when served in CNAndrew Bonventre
Change-Id: Ia3d0fa0517d96f0672d3c5ce7e7b7bb8bd0ce093 Reviewed-on: https://go-review.googlesource.com/60070 Reviewed-by: Chris Broadfoot <cbro@golang.org> (cherry picked from commit 98603e7af6056734e0f5bee5f05b3623ca5189de) Reviewed-on: https://go-review.googlesource.com/88735 Reviewed-by: Andrew Bonventre <andybons@golang.org>