1
0
mirror of https://github.com/golang/go synced 2024-11-14 05:50:27 -07:00
Commit Graph

35432 Commits

Author SHA1 Message Date
Filippo Valsorda
4b76b996cb [dev.boringcrypto.go1.10] all: merge go1.10.8 into dev.boringcrypto.go1.10
Change-Id: Iba5a8ddb67cfd119cf05274be79b840862009b4d
2019-01-23 19:12:46 -05:00
Julie Qiu
b0cb374daf [release-branch.go1.10-security] go1.10.8
Change-Id: Ie18399a328452f61b232a6929ecf53cb79306773
Reviewed-on: https://team-review.git.corp.google.com/c/400910
Reviewed-by: Filippo Valsorda <valsorda@google.com>
2019-01-23 19:47:24 +00:00
Ian Lance Taylor
ed3af1d472 [release-branch.go1.10-security] net: pass if at least one matching entry in TestLookupGmailTXT
Fixes #29698

Change-Id: I0531c0a274b120af8871aa2f5975744ff6c912a3
Reviewed-on: https://go-review.googlesource.com/c/157638
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://team-review.git.corp.google.com/c/401204
Reviewed-by: Filippo Valsorda <valsorda@google.com>
2019-01-23 19:05:45 +00:00
Julie Qiu
d4cad3c4b1 [release-branch.go1.10-security] doc: document Go 1.10.8
Change-Id: I97ce42e1e9a6d10bf1eeccc2763e043d8ebe5bab
Reviewed-on: https://team-review.git.corp.google.com/c/400906
Reviewed-by: Filippo Valsorda <valsorda@google.com>
(cherry picked from commit efe766c7c0918da96aa21e1ac03a9d3fa57ca156)
Reviewed-on: https://team-review.git.corp.google.com/c/400907
2019-01-23 17:57:18 +00:00
Filippo Valsorda
d5f2dc6a5c [release-branch.go1.10-security] crypto/elliptic: reduce subtraction term to prevent long busy loop
If beta8 is unusually large, the addition loop might take a very long
time to bring x3-beta8 back positive.

This would lead to a DoS vulnerability in the implementation of the
P-521 and P-384 elliptic curves that may let an attacker craft inputs
to ScalarMult that consume excessive amounts of CPU.

This fixes CVE-2019-6486.

Change-Id: Ia969e8b5bf5ac4071a00722de9d5e4d856d8071a
Reviewed-on: https://team-review.git.corp.google.com/c/399777
Reviewed-by: Adam Langley <agl@google.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
(cherry picked from commit 746d6abe2dfb9ce7609f8e1e1a8dcb7e221f423e)
Reviewed-on: https://team-review.git.corp.google.com/c/401143
Reviewed-by: Filippo Valsorda <valsorda@google.com>
2019-01-23 17:28:54 +00:00
Filippo Valsorda
8b246fe0f5 [dev.boringcrypto.go1.10] all: merge go1.10.7 into dev.boringcrypto.go1.10
Change-Id: Ifcd17a46d9f3bfaf64fe3d3e633b44f560dc6e10
2018-12-14 19:35:04 -05:00
Filippo Valsorda
f5ff72d623 [release-branch.go1.10] go1.10.7
Change-Id: Ic9020b53da56c34250801e996248edbd3a4c632e
Reviewed-on: https://go-review.googlesource.com/c/154308
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2018-12-14 23:34:23 +00:00
Filippo Valsorda
9a66eedd42 [release-branch.go1.10] doc: document Go 1.10.7
Change-Id: Id71aad4cf6149e0ba15f7fec0b74517827c37866
Reviewed-on: https://go-review.googlesource.com/c/154303
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
(cherry picked from commit 84bf9ce1fb)
Reviewed-on: https://go-review.googlesource.com/c/154305
2018-12-14 21:58:45 +00:00
Filippo Valsorda
a9ccbe0a69 Revert "[release-branch.go1.10] cmd/compile/internal/gc: OMUL should be evaluated when using soft-float"
This reverts commit d74e69c755.

Reason for revert: this fix has been backported to 1.11, and that makes
it ineligible for backport to 1.10, since upgrading to 1.11 is a valid
workaround according to https://github.com/golang/go/wiki/MinorReleases.

Also, this triggers a bug on Wasm that would require a backport of
CL 149965, too.

Updates #28688
Updates #28959

Change-Id: I4e56554ea27b5db83bdb1e9d2103dd24e3da8cfc
Reviewed-on: https://go-review.googlesource.com/c/154297
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
2018-12-14 20:07:16 +00:00
Milan Knezevic
d74e69c755 [release-branch.go1.10] cmd/compile/internal/gc: OMUL should be evaluated when using soft-float
When using soft-float, OMUL might be rewritten to function call
so we should ensure it was evaluated first.

Updates #28688
Fixes #28959

Change-Id: I30b87501782fff62d35151f394a1c22b0d490c6c
Reviewed-on: https://go-review.googlesource.com/c/148837
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
(cherry picked from commit c92e73b702)
Reviewed-on: https://go-review.googlesource.com/c/151343
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2018-12-14 18:48:54 +00:00
Bryan C. Mills
25bee965c6 [release-branch.go1.10] cmd/go/internal/get: move wildcard-trimming to before CheckImportPath
Previously, RepoRootForImportPath trimmed certain "..." wildcards from
package patterns (even though its name suggests that the argument must
be an actual import path). It trimmed at the first path element that
was literally "..." (although wildcards in general may appear within a
larger path element), and relied on a subsequent check in
RepoRootForImportPath to catch confusing resolutions.

However, that causes 'go get' with wildcard patterns in fresh paths to
fail as of CL 154101: a wildcard pattern is not a valid import path,
and fails the path check. (The existing Test{Vendor,Go}Get* packages
in go_test.go and vendor_test.go catch the failure, but they are all
skipped when the "-short" flag is set — including in all.bash — and we
had forgotten to run them separately.)

We now trim the path before any element that contains a wildcard, and
perform the path check (and repo resolution) on only that prefix. It
is possible that the expanded path after fetching the repo will be
invalid, but a repository can contain directories that are not valid
import paths in general anyway.

Fixes #29247

Change-Id: I70fb2f7fc6603b7d339fd6c02e8cdeacfc93fc4b
Reviewed-on: https://go-review.googlesource.com/c/154108
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/154111
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2018-12-14 18:37:24 +00:00
Dmitri Shuralyov
f40c04941a [release-branch.go1.10] all: merge release-branch.go1.10-security into release-branch.go1.10
Change-Id: I7048387350b683030d9f3106979370b0d096ea38
2018-12-13 17:08:33 -05:00
Dmitri Shuralyov
25ca8f49c3 [release-branch.go1.10-security] go1.10.6
Change-Id: I1a05884b2df711da15d2ca3f09fcb6fc4a3264c7
Reviewed-on: https://team-review.git.corp.google.com/c/377324
Reviewed-by: Andrew Bonventre <andybons@google.com>
2018-12-13 17:16:47 +00:00
Dmitri Shuralyov
f1a7c2aae8 [release-branch.go1.10-security] doc: document Go 1.10.6
Change-Id: I3fe44887a84586d73be01df78a9cbb002c1fc9c5
Reviewed-on: https://team-review.git.corp.google.com/c/376467
Reviewed-by: Filippo Valsorda <valsorda@google.com>
2018-12-12 19:08:14 +00:00
Bryan C. Mills
9a80067643 [release-branch.go1.10-security] cmd/go/internal/get: relax pathOK check to allow any letter
This fixes a regression of #18660 with the new path checks.

Change-Id: I07cd248392ba8f5f9b1614b79a323cca1ad1d46d
Reviewed-on: https://team-review.git.corp.google.com/c/372708
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2018-12-07 14:48:24 +00:00
Bryan C. Mills
aaa5f47754 [release-branch.go1.10-security] cmd/go/internal/get: use a strings.Replacer in expand
This should be a no-op, but produces deterministic (and more correct)
behavior if we have accidentally failed to sanitize one of the inputs.

Change-Id: I1271d0ffd01a691ec8c84906c4e02d9e2be19c72
Reviewed-on: https://team-review.git.corp.google.com/c/372707
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2018-12-07 14:48:05 +00:00
Bryan C. Mills
7ef6ee2c57 [release-branch.go1.10-security] cmd/go/internal/get: reject Windows shortnames as path components
Change-Id: Ia32d8ec1fc0c4e242f50d8871c0ef3ce315f3c65
Reviewed-on: https://team-review.git.corp.google.com/c/370573
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2018-12-07 14:47:58 +00:00
Bryan C. Mills
90d609ba61 [release-branch.go1.10-security] cmd/go: reject 'get' of paths containing leading dots or unsupported characters
On some platforms, directories beginning with dot are treated as
hidden files, and filenames containing unusual characters can be
confusing for users to manipulate (and delete).

Change-Id: I443bdeb98e4de24b8a93a75fb923f4d41052e8f7
Reviewed-on: https://team-review.git.corp.google.com/c/368703
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2018-12-07 14:47:30 +00:00
Filippo Valsorda
0a4a37f1f0 [release-branch.go1.10-security] crypto/x509: limit number of signature checks for each verification
That number grows quadratically with the number of intermediate
certificates in certain pathological cases (for example if they all have
the same Subject) leading to a CPU DoS. Set a fixed budget that should
fit all real world chains, given we only look at intermediates provided
by the peer.

The algorithm can be improved, but that's left for follow-up CLs:

    * the cache logic should be reviewed for correctness, as it seems to
      override the entire chain with the cached one
    * the equality check should compare Subject and public key, not the
      whole certificate
    * certificates with the right SKID but the wrong Subject should not
      be considered, and in particular should not take priority over
      certificates with the right Subject

Change-Id: Ib257c12cd5563df7723f9c81231d82b882854213
Reviewed-on: https://team-review.git.corp.google.com/c/370475
Reviewed-by: Andrew Bonventre <andybons@google.com>
(cherry picked from commit 09d57361bc99cbbfb9755ee30ddcb42ff5a9d7d6)
Reviewed-on: https://team-review.git.corp.google.com/c/372923
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2018-12-07 00:38:02 +00:00
Andrew Bonventre
1ae739797e [release-branch.go1.10] go1.10.5
Change-Id: Ibad4471510ea8546954c4361424daadb845b2f3f
Reviewed-on: https://go-review.googlesource.com/c/147183
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-02 20:17:59 +00:00
Andrew Bonventre
aaccedc781 [release-branch.go1.10] doc: document Go 1.10.5
Change-Id: I11adca150ab795607b832fb354a3e065655e1020
Reviewed-on: https://go-review.googlesource.com/c/147179
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 2764d5ee7b)
Reviewed-on: https://go-review.googlesource.com/c/147180
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-11-02 19:53:46 +00:00
Cherry Zhang
ce842c532a [release-branch.go1.10] cmd/internal/obj/arm64: fix branch-too-far with TBZ like instructions
The compiler now emits TBZ like instructions, but the assembler's
too-far-branch patch code didn't include that case. Add it.

Updates #23889
Fixes #25794

Change-Id: Ib75f9250c660b9fb652835fbc83263a5d5073dc5
Reviewed-on: https://go-review.googlesource.com/94902
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
(cherry picked from commit 911839c1f4)
Reviewed-on: https://go-review.googlesource.com/c/147057
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2018-11-02 17:45:38 +00:00
Alex Brainman
13a2f533e0 [release-branch.go1.10] internal/poll: advance file position in windows sendfile
Some versions of Windows (Windows 10 1803) do not set file
position after TransmitFile completes. So just use Seek
to set file position before returning from sendfile.

Updates #25722
Fixes #27419

Change-Id: I7a49be10304b5db19dda707b13ac93d338aeb190
Reviewed-on: https://go-review.googlesource.com/131976
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
(cherry picked from commit 8359b5e134)
Reviewed-on: https://go-review.googlesource.com/c/146779
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2018-11-01 22:47:33 +00:00
Daniel Theophanes
edd28f1e6d [release-branch.go1.10] database/sql: check for nil connRequest.conn before use
The connRequest may return a nil conn value. However in a rare
case that is difficult to test for it was being passed to
DB.putConn without a nil check. This was an error as this
made no sense if the driverConn is nil. This also caused
a panic in putConn.

A test for this would be nice, but didn't find a sane
way to test for this condition.

Updates #24445
Fixes #25235

Change-Id: I827316e856788a5a3ced913f129bb5869b7bcf68
Reviewed-on: https://go-review.googlesource.com/102477
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexey Palazhchenko <alexey.palazhchenko@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit b98ffdf859)
Reviewed-on: https://go-review.googlesource.com/c/146778
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2018-11-01 22:08:28 +00:00
Ian Lance Taylor
fba2c4d76b [release-branch.go1.10] internal/poll, net: fix sendfile on Windows, add test
Cherry pick of CL 130855, done manually to avoid a merge conflict on the test.

Fixes #27085

Change-Id: I7c4939cf5db23253a824c46c3f00fab4edec86b4
Reviewed-on: https://go-review.googlesource.com/c/146797
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-01 22:07:01 +00:00
Ian Lance Taylor
7495cdaf3d [release-branch.go1.10] cmd/go: remove test that does nothing in 1.10
1.10 has no cmd/go/testdata/script directory.

Change-Id: I8985d457e8d6d0c8aeff9c17375f3c872593ab92
Reviewed-on: https://go-review.googlesource.com/c/146781
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-11-01 21:47:17 +00:00
Alex Brainman
4f4cf6abd7 [release-branch.go1.10] internal/poll: specify current file position when calling TransmitFile
Current SendFile implementation assumes that TransmitFile starts from
the current file position. But that appears not true for Windows 10
Version 1803.

TransmitFile documentation

https://msdn.microsoft.com/en-us/library/windows/desktop/ms740565(v=vs.85).aspx

suggests, "You can use the lpOverlapped parameter to specify a 64-bit
offset within the file at which to start the file data transfer by
setting the Offset and OffsetHigh member of the OVERLAPPED structure."

Do as it advises.

Fixes #25722

Change-Id: I241d3bf76d0d5590d4df27c6f922d637068232fb
Reviewed-on: https://go-review.googlesource.com/117816
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit af4d60428f)
Reviewed-on: https://go-review.googlesource.com/c/146780
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2018-11-01 21:42:02 +00:00
Alberto Donizetti
30ccc6284a [release-branch.go1.10] cmd/compile: prevent overflow in walkinrange
In the compiler frontend, walkinrange indiscriminately calls Int64()
on const CTINT nodes, even though Int64's return value is undefined
for anything over 2⁶³ (in practise, it'll return a negative number).

This causes the introduction of bad constants during rewrites of
unsigned expressions, which make the compiler reject valid Go
programs.

This change introduces a preliminary check that Int64() is safe to
call on the consts on hand. If it isn't, walkinrange exits without
doing any rewrite.

Fixes #27247

Change-Id: I2017073cae65468a521ff3262d4ea8ab0d7098d9
Reviewed-on: https://go-review.googlesource.com/130735
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
(cherry picked from commit 42cc4ca30a)
Reviewed-on: https://go-review.googlesource.com/c/131595
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2018-11-01 20:08:12 +00:00
Ian Lance Taylor
15c6cc7c67 [release-branch.go1.10] cmd/go: add GOMIPS value to build id for mipsle
Strip a trailing "le" from the GOARCH value when calculating the GOxxx
environment variable that affects it.

Updates #27260
Fixes #27421

Change-Id: I081f30d5dc19281901551823f4f56be028b5f71a
Reviewed-on: https://go-review.googlesource.com/131379
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 61318d7ffe)
Reviewed-on: https://go-review.googlesource.com/c/146560
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-11-01 19:27:43 +00:00
Lynn Boger
e97b7d68f1 [release-branch.go1.10] runtime: restore r2 when restoring state from gobuf in gogo on ppc64x
When using plugins with goroutines calling cgo, we hit a case where
an intermittent SIGSEGV occurs when referencing an address that is based
on r2 (TOC address). When the failure can be generated in gdb, the
contents of r2 is wrong even though the value in the current stack's
slot for r2 is correct. So that means it somehow switched to start
running the code in this function without passing through the beginning
of the function which had the correct value of r2 and stored it there.

It was noted that in runtime.gogo when the state is restored from
gobuf, r2 is not restored from its slot on the stack. Adding the
instruction to restore r2 prevents the SIGSEGV.

Fixes #25800

Change-Id: I6028b6f1f8775d5c23f4ebb57ae273330a28eb8f
Reviewed-on: https://go-review.googlesource.com/117515
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
(cherry picked from commit 30a63ecee3)
Reviewed-on: https://go-review.googlesource.com/c/117915
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-30 15:40:52 +00:00
Cherry Zhang
1f8a5b8cc8 [release-branch.go1.10] cmd/link: put runtime.framepointer_enabled in DATA instead of RODATA
On darwin, only writable symbol is exported
(cmd/link/internal/ld/macho.go:/machoShouldExport).
For plugin to work correctly, global variables, including
runtime.framepointer_enabled which is set by the linker, need
to be exported when dynamic linking. Put it in DATA so it is
exported. Also in Go it is defined as a var, which is not
read-only.

While here, do the same for runtime.goarm.

Fixes #25038.

Change-Id: I9d1b7d5a648be17103d20b97be65a901cb69f5a2
Reviewed-on: https://go-review.googlesource.com/104715
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/122116
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-29 19:25:12 +00:00
Filippo Valsorda
2e2a04a605 [dev.boringcrypto.go1.10] all: merge go1.10.4 into dev.boringcrypto.go1.10
Change-Id: I999b1bc5e7ac175ad5fb82a55d1840a8a3e622d9
2018-09-24 21:19:42 -04:00
Ian Lance Taylor
95b56b3879 [release-branch.go1.10] cmd/go: add -Wl,--export-dynamic to linker flag whitelist
Fixes #27496

Change-Id: I53538c7697729294a9e50ace26a6a7183131e837
Reviewed-on: https://go-review.googlesource.com/134016
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
(cherry picked from commit ceb7745cc8)
Reviewed-on: https://go-review.googlesource.com/134135
2018-09-07 19:56:20 +00:00
Andrew Bonventre
2191fce26a [release-branch.go1.10] go1.10.4
Change-Id: Idef60b8ac0411bacc09e98b0a79a7df7279d76bc
Reviewed-on: https://go-review.googlesource.com/131337
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-24 19:26:40 +00:00
Andrew Bonventre
713120eab6 [release-branch.go1.10] doc: document Go 1.10.4
Change-Id: I7383e7d37a71defcad79fc662c4b4d1ca02189d1
Reviewed-on: https://go-review.googlesource.com/131336
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 74ac46d5a4f33f5da9c5a16b070ec2331ec4e7c9)
Reviewed-on: https://go-review.googlesource.com/131355
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-08-24 19:22:23 +00:00
Keith Randall
305b0de625 [release-branch.go1.10] cmd/compile: fix zero extend after float->int conversion
Don't do direct loads from argument slots if the sizes don't match.
This prevents us from loading from a float32 using a uint64 load
during expressions like uint64(math.float32Bits(f)) where f is a float32 arg.

Fixes #25335

Change-Id: I3887d76f78c844ba546243e7721d811c3d4a9700
Reviewed-on: https://go-review.googlesource.com/112637
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/131276
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-24 16:18:39 +00:00
Damien Mathieu
ba5e308ea9 [release-branch.go1.10] net/http: lock the read-only mutex in shouldRedirect
Since that method uses `mux.m`, we need to lock the mutex to avoid data races.

Fixes #27129

Change-Id: I998448a6e482b5d6a1b24f3354bb824906e23172
Reviewed-on: https://go-review.googlesource.com/95775
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-08-22 02:03:14 +00:00
Ian Lance Taylor
4d6ae73dfc [release-branch.go1.10] cmd/link: treat cgo exported symbols as C symbols
Fixes #25827

Change-Id: I6736c3ac061ca32aac2eb68b01ba53a179d68cf4
Reviewed-on: https://go-review.googlesource.com/118076
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
(cherry picked from commit f861f66d1d)
Reviewed-on: https://go-review.googlesource.com/126455
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-21 03:42:22 +00:00
Keith Randall
dea961ebd9 [release-branch.go1.10] cmd/compile: reset branch prediction when deleting a branch
When we go from a branch block to a plain block, reset the
branch prediction bit. Downstream passes asssume that if the
branch prediction is set, then the block has 2 successors.

Fixes #23504
Fixes #26851

Change-Id: I2898ec002228b2e34fe80ce420c6939201c0a5aa
Reviewed-on: https://go-review.googlesource.com/88955
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
(cherry picked from commit 4313d7767d)
Reviewed-on: https://go-review.googlesource.com/128855
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-08-09 21:44:22 +00:00
Ian Lance Taylor
b8ae3569c8 [release-branch.go1.10] cmd/cgo: don't give inconsistent typedef error for cgo-defined types
The cgo tool predefines some C types such as C.uint. Don't give an
error if the type that cgo defines does not match the type in a header file.

Fixes #26743

Change-Id: I9ed3b4c482b558d8ffa8bf61eb3209415b7a9e3c
Reviewed-on: https://go-review.googlesource.com/127356
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
(cherry picked from commit c29370c98e)
Reviewed-on: https://go-review.googlesource.com/128396
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-08-08 01:13:46 +00:00
Ian Lance Taylor
097d642de5 [release-branch.go1.10] cmd/cgo: don't resolve typedefs in -godefs mode
In -godefs mode any typedefs that appear in struct fields and the like
will presumably be defined in the input file. If we resolve to the
base type, those cross-references will not work. So for -godefs mode,
keep the Go 1.10 behavior and don't resolve the typedefs in a loop.

Fixes #26644

Change-Id: I48cf72d9eb5016353c43074e6aff6495af326f35
Reviewed-on: https://go-review.googlesource.com/125995
Reviewed-by: Keith Randall <khr@golang.org>
(cherry picked from commit ead59f4bf3)
Reviewed-on: https://go-review.googlesource.com/128395
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-08-08 01:13:28 +00:00
Keith Randall
0fae49df57 [release-branch.go1.10] cmd/cgo: stop expanding typedefs once we reach __builtin types
Expanding __builtin types (__builtin_va_list, particularly) leads
to problems because they are expanded by the compiler itself - the
expansions are not generated by anything in a .h file. The types
a __builtin type expand to are thus very confusing to cgo.

See CL 126275.

Fixes #25036.

Change-Id: I66eb6a4f27f652f1b934ba702f580f6daa62a566
Reviewed-on: https://go-review.googlesource.com/127156
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/128096
2018-08-08 00:28:44 +00:00
Keith Randall
0f1c9decc9 [release-branch.go1.10] cmd/cgo: make sure we FinishType everything
Ensure that we call FinishType on all the types added to the ptrs map.
We only add a key to ptrKeys once. Once we FinishType for that key,
we'll never look at that key again. But we can add a new type under that
key later, and we'll never finish it.

Make sure we add the key to the ptrKeys list every time we make the list
of types for that key non-empty.

This makes sure we FinishType each pointer type exactly once.

Update #25036

Change-Id: Iad86150d516fcfac167591daf5a26c38bec7d143
Reviewed-on: https://go-review.googlesource.com/126275
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-on: https://go-review.googlesource.com/128095
2018-08-08 00:27:20 +00:00
Keith Randall
2b07564d19 [release-branch.go1.10] misc/cgo: fix darwin test, again
TARGET_OS_OSX is the right macro, but it also was only introduced
in 1.12.  For 1.11 and earlier a reasonable substitution is
TARGET_OS_IPHONE == 0.

Update #25036

Change-Id: I5f43c463d14fada9ed1d83cc684c7ea05d94c5f3
Reviewed-on: https://go-review.googlesource.com/124075
Run-TryBot: Keith Randall <khr@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/124218
2018-08-08 00:27:12 +00:00
Keith Randall
1dea6c5269 [release-branch.go1.10] misc/cgo: fix test on iOS
The test in CL 123715 doesn't work on iOS, it needs to use a different
version scheme to determine whether SecKeyAlgorithm and friends exist.
Restrict the old version test to OSX only.

The same problem occurs on iOS: the functions tested don't exist before
iOS 10.  But we don't have builders below iOS 10, so it isn't a big issue.
If we ever get older builders, or someone wants to run all.bash on an
old iOS, they'll need to figure out the right incantation.

Update #25036

Change-Id: Ia3ace86b00486dc172ed00c0c6d668a95565bff7
Reviewed-on: https://go-review.googlesource.com/123959
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/124217
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-08-08 00:27:05 +00:00
Keith Randall
61e4c11693 [release-branch.go1.10] misc/cgo/test: fix issue 24161 test for 1.11 and earlier
The test uses functions from C that were introduced in OSX 1.12.
Include stubs for those functions when compiling for 1.11 and earlier.
This test really a compile-time test, it doesn't matter much what the
executed code actually does.
Use a nasty #define hack to work around the fact that cgo doesn't
support static global variables.

Update #25036

Change-Id: Icf6f7bc9b6b36cacc81d5d0e033a2ebaff7e0298
Reviewed-on: https://go-review.googlesource.com/123715
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/124216
2018-08-08 00:26:58 +00:00
Keith Randall
424f4ea0bd [release-branch.go1.10] cmd/cgo: fix cgo bad typedefs
Two fixes:

1) Typedefs of the bad typedefs should also not be rewritten to the
   underlying type.  They shouldn't just be uintptr, though, they should
   retain the C naming structure.  For example, in C:

   typedef const __CFString * CFStringRef;
   typedef CFStringRef SecKeyAlgorithm;

   we want the Go:

   type _Ctype_CFStringRef uintptr
   type _Ctype_SecKeyAlgorithm = _Ctype_CFStringRef

2) We need more types than just function arguments/return values.
   At least we need types of global variables, so when we see a reference to:

   extern const SecKeyAlgorithm kSecKeyAlgorithmECDSASignatureDigestX962SHA1;

   we know that we need to investigate the type SecKeyAlgorithm.
   Might as well just find every typedef and check the badness of all of them.
   This requires looping until a fixed point of known types is reached.
   Usually it takes just 2 iterations, sometimes 3.

Update #25036

Change-Id: I32ca7e48eb4d4133c6242e91d1879636f5224ea9
Reviewed-on: https://go-review.googlesource.com/123177
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/124215
2018-08-08 00:26:51 +00:00
Keith Randall
48016b89d9 [release-branch.go1.10] cmd/cgo: check function argument/return types for bad C pointer types
We need to determine whether arguments to and return values from C
functions are "bad" typedef'd pointer types which need to be uintptr
on the Go side.

The type of those arguments are not specified explicitly. As a result,
we never look through the C declarations for the GetTypeID functions
associated with that type, and never realize that they are bad.
However, in another function in the same package there might be an
explicit reference. Then we end up with the declaration being uintptr
in one file and *struct{...} in another file. Badness ensues.

Fix this by doing a 2-pass algorithm. In the first pass, we run as
normal, but record all the argument and result types we see. In the
second pass, we include those argument types also when reading the C
types.

Update #25036

Change-Id: I8d727e73a2fbc88cb9d9899f8719ae405f59f753
Reviewed-on: https://go-review.googlesource.com/122575
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit 20803e0f52809fa6088285c1c87246642df2b62d)
Reviewed-on: https://go-review.googlesource.com/122818
2018-08-08 00:26:43 +00:00
Ian Lance Taylor
815e0f9755 [release-branch.go1.10] cmd/cgo: don't report inconsistency error for incomplete typedef
In CLs 122575 and 123177 the cgo tool started explicitly looking up
typedefs. When there are two Go files using import "C", and the first
one has an incomplete typedef and the second one has a complete
version of the same typedef, then we will now record a version of the
first typedef which will not match the recorded version of the second
typedef, producing an "inconsistent definitions" error. Fix this by
silently merging incomplete typedefs with complete ones.

Fixes #26430

Change-Id: I9e629228783b866dd29b5c3a31acd48f6e410a2d
Reviewed-on: https://go-review.googlesource.com/124575
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
(cherry picked from commit a371bc2dfd)
Reviewed-on: https://go-review.googlesource.com/128155
2018-08-07 05:18:07 +00:00
Ian Lance Taylor
4c77cb3087 [release-branch.go1.10] strings: do much less redundant testing in TestCompareStrings
On the OpenBSD builder this reduces the test time from 213 seconds to
60 seconds, without loss of testing.

Not sure why the test is so much slower on OpenBSD, so not closing the
issues.

Updates #26155
Updates #26174

Change-Id: I13b58bbe3b209e591c308765077d2342943a3d2a
Reviewed-on: https://go-review.googlesource.com/121820
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ralph Corderoy <ralph@inputplus.co.uk>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 869884daea)
Reviewed-on: https://go-review.googlesource.com/124115
Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
2018-07-16 23:14:19 +00:00