Commit graph

48427 commits

Author SHA1 Message Date
Cuong Manh Le c1cc9f9c3d cmd/compile: fix lookup package of redeclared dot import symbol
The compiler is relying on Sym.Def field to lookup symbol package in
DotImportRefs map. But the Sym.Def field is clear whenever the compiler
finish processing a file. If the dot import happen in file A, then the
redeclaration happen in file B, then the symbol lookup in file B will
see a nil Sym.Def, that cause the compiler crashes.

To fix this, we can interate over DotImportRefs and check for matching
symbol name and return the corresponding package. Though this operation
can be slow, but it only happens in invalid program, when printing error
message, so it's not worth to optimize it further.

Fixes #47201

Change-Id: I4ca1cb0a8e7432b19cf71434592a4cbb58d54adf
Reviewed-on: https://go-review.googlesource.com/c/go/+/334589
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-07-15 17:35:20 +00:00
Ian Lance Taylor 21a04e3335 doc/go1.17: mention GOARCH=loong64
For #46229

Change-Id: I54d01d90f2b0c892d76121f1350c0e8cf4b2772f
Reviewed-on: https://go-review.googlesource.com/c/go/+/334729
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-07-15 00:09:22 +00:00
WANG Xuerui 2b00a54baf go/build, runtime/internal/sys: reserve GOARCH=loong64
Per discussion at #46229 we are taking the "loong64" GOARCH value for
the upcoming LoongArch 64-bit port. It is not clear whether any 32-bit
non-bare-metal userland will exist for LoongArch, so only reserve
"loong64" for now.

Change-Id: I97d262b4ab68ff61c22ccf83e26baf70eefd568d
GitHub-Last-Rev: ecdd8c53bd
GitHub-Pull-Request: golang/go#47129
Reviewed-on: https://go-review.googlesource.com/c/go/+/333909
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Alexander Rakoczy <alex@golang.org>
2021-07-14 22:52:15 +00:00
Bryan C. Mills 60ddf42b46 cmd/go: change link in error message from /wiki to /doc.
The /doc link is currently a redirect (CL 334389),
but I plan to update it soon with a more detailed guide.

Updates #36460

Change-Id: I9e4a47ad0c8bcb7361cfa3e5b9d07ad241b13ba6
Reviewed-on: https://go-review.googlesource.com/c/go/+/332573
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2021-07-14 17:25:06 +00:00
Bryan C. Mills d8f348a589 cmd/go: remove a duplicated word from 'go help mod graph'
For #46366

Change-Id: Ie9735027a3c4c0f4a604df30ca4d64dcdc62b45a
Reviewed-on: https://go-review.googlesource.com/c/go/+/334375
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-07-13 21:57:39 +00:00
Roland Shoemaker a98589711d crypto/tls: test key type when casting
When casting the certificate public key in generateClientKeyExchange,
check the type is appropriate. This prevents a panic when a server
agrees to a RSA based key exchange, but then sends an ECDSA (or
other) certificate.

Fixes #47143
Fixes CVE-2021-34558

Thanks to Imre Rad for reporting this issue.

Change-Id: Iabccacca6052769a605cccefa1216a9f7b7f6aea
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1116723
Reviewed-by: Filippo Valsorda <valsorda@google.com>
Reviewed-by: Katie Hockman <katiehockman@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/334031
Trust: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-07-12 20:58:00 +00:00
Austin Clements cfbd73ba33 doc/go1.17: editing pass over the "Compiler" section
Change-Id: I08c082f548daa7011a8dc42769371329684c90e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/333609
Trust: Austin Clements <austin@google.com>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
2021-07-12 16:23:25 +00:00
Michael Anthony Knyszek ab4085ce84 runtime/pprof: call runtime.GC twice in memory profile test
This change fixes #46500 by working around #45315 which may cause freed
objects to get missed in the heap profile published for the test.

By calling runtime.GC one more time this change ensures that all freed
objects are accounted for.

Fixes #46500.

Change-Id: Iedcd0b37dbaffa688b0ff8631a8b79f7a1169634
Reviewed-on: https://go-review.googlesource.com/c/go/+/333549
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2021-07-09 18:00:16 +00:00
Roland Shoemaker 296ddf2a93 net: filter bad names from Lookup functions instead of hard failing
Instead of hard failing on a single bad record, filter the bad records
and return anything valid. This only applies to the methods which can
return multiple records, LookupMX, LookupNS, LookupSRV, and LookupAddr.

When bad results are filtered out, also return an error, indicating
that this filtering has happened.

Updates #46241
Fixes #46979

Change-Id: I6493e0002beaf89f5a9795333a93605abd30d171
Reviewed-on: https://go-review.googlesource.com/c/go/+/332549
Trust: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2021-07-08 17:53:43 +00:00
makdon ce76298ee7 Update oudated comment
Update comment cause gc/select.go has been moved to walk/select.go and gc/reflect.go has been moved to reflectdata/reflect.go

Change-Id: I6894527e1e9dbca50ace92a51bf942f9495ce88c
GitHub-Last-Rev: 6d6a447144
GitHub-Pull-Request: golang/go#45976
Reviewed-on: https://go-review.googlesource.com/c/go/+/317191
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Michael Pratt <mpratt@google.com>
2021-07-08 16:59:21 +00:00
Tobias Klauser 2ca44fe221 doc/go1.17: linkify time.UnixMilli and time.UnixMicro
Change-Id: I8503c4649fc42670f13d981f98af480467d6a3e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/332829
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-07-08 09:09:53 +00:00
Matthew Dempsky 5c59e11f5e cmd/compile: remove special-casing of blank in types.sconv{,2}
I'm not sure why blank was special-cased here before, but it's
wrong. Blank is a non-exported identifier, and writing it out without
package-qualification can result in linker symbol collisions.

Fixes #47087.

Change-Id: Ie600037c8e54e3d4fdaeec21e2ca212badbd830b
Reviewed-on: https://go-review.googlesource.com/c/go/+/333163
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-07-07 22:29:01 +00:00
Matthew Dempsky b003a8b1ae cmd/compile: optimize types.sconv
Now that symfmt is simpler, we can simply manually inline it into
sconv. Importantly, this allows us to avoid allocating a buffer +
writing a string + re-interning it when we don't need to qualify the
identifier.

Passes toolstash -cmp.

Updates #47087.

Change-Id: I47b57aef22301ba242556a645346f478f0c1a7d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/333162
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-07-07 22:28:19 +00:00
Matthew Dempsky 11f5df2d67 cmd/compile: extract pkgqual from symfmt
The logic in symfmt for deciding how to package-qualify an identifier
is easily refactored into a separate function, loosely similar to
go/types.Qualifier's API.

Passes toolstash -cmp.

Updates #47087.

Change-Id: Ib3e7cc35a6577dc28df8eca79ba3457c48168e86
Reviewed-on: https://go-review.googlesource.com/c/go/+/333161
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-07-07 22:27:48 +00:00
Jay Conrod 991fd381d5 cmd/go: don't lock .mod and .sum files for read in overlay
On Plan 9, locking a file requires a chmod call. In general, the go
command should not modify files in the overlay, even metadata. With
this change, we won't lock these files for reading.

The go command already reported errors when attempting to write these
files if they were in the overlay, but this change moves those checks
to the point of access for clearer error
messages. cmd/go/internal/lockedfile no longer imports
cmd/go/internal/fsys.

Fixes #44700

Change-Id: Ib544459dd6cf56ca0f7a27b3285f045f08040d7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/333012
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-07-07 21:57:42 +00:00
Bryan C. Mills 186a3bb4b0 cmd/go/internal/modfetch/codehost: skip hg tests if no hg binary is present
Change-Id: I5cf57bf1153eb662bcab71e3d2c04848212559a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/330989
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-07-07 20:33:11 +00:00
Bryan C. Mills 00c00558e1 cmd/go/internal/modload: remove unused functions
Also unexport functions that are not used outside the modload package.

Change-Id: I0de187cbb673cadafce95a27f5ccff934ae21104
Reviewed-on: https://go-review.googlesource.com/c/go/+/332570
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-07-07 20:26:23 +00:00
Bryan C. Mills f264879f74 cmd/go/internal/modload: fix an apparent typo in the AutoRoot comment
Updates #40276

Change-Id: Ic192d51f9f0306e5c206c550ef02f6d4495d0851
Reviewed-on: https://go-review.googlesource.com/c/go/+/332569
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-07-07 20:25:29 +00:00
Michael Anthony Knyszek c96833e5ba doc: remove stale comment about arm64 port
Fixes #47079.

Change-Id: I8a671e3fdc13083e44e8d89064a5e7621e53bc4c
Reviewed-on: https://go-review.googlesource.com/c/go/+/333075
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-07-07 16:41:12 +00:00
Sean Liao 912f075047 net/http: mention socks5 support in proxy
Change-Id: I55b6d5c77221569eeafea625379affd476a65772
Reviewed-on: https://go-review.googlesource.com/c/go/+/326011
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-07-02 21:06:08 +00:00
go101 287c5e8066 cmd/compile: fix stack growing algorithm
The current stack growing implementation looks not right.
Specially, the line runtime/stack.go#L1068 never gets executed,
which causes many unnecessary copystack calls.

This PR is trying to correct the implementation.
As I'm not familiar with the code, the fix is just a guess.

Change-Id: I0bea1148175fad34f74f19d455c240c94d3cb78b
GitHub-Last-Rev: 57205f91fe
GitHub-Pull-Request: golang/go#47010
Reviewed-on: https://go-review.googlesource.com/c/go/+/332229
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-07-02 20:11:05 +00:00
Ian Lance Taylor 743f03eeb0 spec, unsafe: clarify unsafe.Slice docs
For #19367

Change-Id: If0ff8ddba3b6b48e2e198cf3653e73284c7572a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/332409
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-07-02 19:26:52 +00:00
komisan19 6125d0c426 cmd/dist: correct comment: SysProcAttri -> SysProcAttr
Fixes #46982

Change-Id: I07a18507b7aad828714b187f296fa7268f32b1c4
GitHub-Last-Rev: f498febffd
GitHub-Pull-Request: golang/go#46983
Reviewed-on: https://go-review.googlesource.com/c/go/+/331869
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-07-02 16:25:10 +00:00
Roland Shoemaker 03761ede02 net: don't reject null mx records
Bypass hostname validity checking when a null mx record is returned as,
defined in RFC 7505.

Updates #46979

Change-Id: Ibe683bd6b47333a8ff30909fb2680ec8e10696ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/332094
Trust: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-07-01 19:09:57 +00:00
Russ Cox 877688c838 testing: add TB.Setenv
For #41260 and #46688.

Change-Id: I6f42742cc3234a90003136ae8798a6b0e1291788
Reviewed-on: https://go-review.googlesource.com/c/go/+/326790
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-07-01 18:35:33 +00:00
Than McIntosh ef8ae82b37 cmd/compile: fix bug in dwarf-gen var location generation
This patch fixes a bug in the SSA back end's DWARF generation code
that determines variable locations / lifetimes.

The code in question was written to handle sequences of initial
pseudo-ops (zero width instructions such as OpPhi, OpArg, etc) in a
basic block, detecting these ops at the start of a block and then
treating the values specially when emitting ranges for the variables
in those values.  The logic in this code wasn't quite correct, meaning
that a flag variable wasn't being set properly to record the presence
of a block of zero-width value-bearing ops, leading to incorrect or
missing DWARF locations for register params.

Also in this patch is a tweak to some sanity-checking code intended to
catch scheduling problems with OpArg/OpPhi etc. The checks need to
allow for the possibility of an Arg op scheduled after a spill of an
incoming register param inserted by the register allocator. Example:

    b1:
      v13 = ArgIntReg <int> {p1+16} [2] : CX
      v14 = ArgIntReg <int> {p2+16} [5] : R8
      v38 = ArgIntReg <int> {p3+16} [8] : R11
      v35 = ArgIntReg <int> {p1+0} [0] : AX
      v15 = StoreReg <int> v35 : .autotmp_4[int]
      v40  = Arg <int> {p4} [16] : p4+16[int]
      v1 = InitMem <mem>
      v3 = SB <uintptr> : SB
      v18 = CMPQ <flags> v14 v13
      NE v18 → b3 b2 (unlikely) (18)

Here the register allocator has decided to spill v35, meaning that the
OpArg v40 is no longer going to be positioned prior to all other
non-zero-width ops; this is a valid scenario and needs to be handled
properly by the debug code.

Fixes #46425.

Change-Id: I239b3ad56a9c1b8ebf68af42e1f57308293ed7e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/332269
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-07-01 17:41:22 +00:00
Bryan C. Mills 770899f7e1 cmd/go: add a regression test for 'go mod vendor' path traversal
For #46867

Change-Id: I1547ebf7b91e9ddd7b67fd2f20e91391d79fa35d
Reviewed-on: https://go-review.googlesource.com/c/go/+/332250
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-07-01 17:10:57 +00:00
Yasuhiro Matsumoto 835d86a17e cmd/go: use path.Dir instead of filepath.Dir for package paths in 'go mod vendor'
copyMetadata walk-up to parent directory until the pkg become modPath.
But pkg should be slash-separated paths. It have to use path.Dir instead of
filepath.Dir.

Fixes #46867

Change-Id: I44cf1429fe52379a7415b94cc30ae3275cc430e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/330149
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Alexander Rakoczy <alex@golang.org>
Trust: Carlos Amedee <carlos@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-07-01 17:10:36 +00:00
go101 eb437ba92c cmd/compile: make stack value size threshold comparisons consistent
Consistency is beautiful.

Change-Id: Ib110dcff0ce2fa87b5576c79cd79c83aab385a7c
GitHub-Last-Rev: b8758f8ae0
GitHub-Pull-Request: golang/go#47011
Reviewed-on: https://go-review.googlesource.com/c/go/+/332230
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-07-01 17:07:36 +00:00
fanzha02 9d65578b83 cmd/compile: fix typos in document
Correct "a2Spill" to "a3Spill"

Change-Id: I6ac4c45973dfaeb16d3a90d835589b6af1aefe1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/331850
Trust: fannie zhang <Fannie.Zhang@arm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-07-01 01:38:42 +00:00
Bryan C. Mills 4711bf30e5 doc/go1.17: linkify "language changes" in the runtime section
Change-Id: I82bd3954bfc5da59c7952eba2a28ff0e3b41427f
Reviewed-on: https://go-review.googlesource.com/c/go/+/331969
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-30 22:02:09 +00:00
Josh Bleecher Snyder ed56ea73e8 path/filepath: deflake TestEvalSymlinksAboveRoot on darwin
On darwin, under load, it appears that the system occasionally
deletes the temp dir mid-test. Don't fail the test when that happens.

It would be nice to fix this in a deeper way.
See golang.org/cl/332009 for some discussion.

In the meantime, this will at least stop the flakiness.

Updates #37910

Change-Id: I6669e466fed9abda4a87ca88345c04cd7986b41e
Reviewed-on: https://go-review.googlesource.com/c/go/+/332009
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-06-30 20:03:34 +00:00
Ian Lance Taylor c080d0323b cmd/dist: pass -Wno-unknown-warning-option in swig_callback_lto
For #46557
Fixes #46991

Change-Id: Ic88ebaa13d3edf904657dc19ada4fd4ff7f44a8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/332010
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2021-06-30 18:03:06 +00:00
uji 7d0e9e6e74 image/gif: fix typo in the comment (io.ReadByte -> io.ByteReader)
Fixes #46967

Change-Id: I66e69c70b74e904623e8ca854562d255692b2143
Reviewed-on: https://go-review.googlesource.com/c/go/+/331649
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Carlos Amedee <carlos@golang.org>
2021-06-30 17:58:50 +00:00
Eli Bendersky 0fa3265fe1 os: change example to avoid deprecated function
The IsNotExist function is deprecated; change package example to avoid
it and use the recommended way instead.

Fixes #46976

Change-Id: I3c301d0a89b6bda42184df314ba8418062ca39ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/331692
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-06-30 16:44:19 +00:00
Nigel Tao d19a53338f image: add Uniform.RGBA64At and Rectangle.RGBA64At
These types already implemented the Image interface. They should also
implement the RGBA64Image interface (new in Go 1.17)

Updates #44808

Change-Id: I9a2b13e305997088ae874efb95ad9e1648f94812
Reviewed-on: https://go-review.googlesource.com/c/go/+/331570
Trust: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-30 02:00:49 +00:00
Roland Shoemaker c45e800e0c crypto/x509: don't fail on optional auth key id fields
If a certificate contains an AuthorityKeyIdentifier extension that
lacks the keyIdentifier field, but contains the authorityCertIssuer
and/or the authorityCertSerialNumber fields, don't return an error and
continue parsing.

Fixes #46854

Change-Id: I82739b415441f639a722755cc1f449d73078adfc
Reviewed-on: https://go-review.googlesource.com/c/go/+/331689
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2021-06-30 01:29:49 +00:00
Xiangdong Ji f9d50953b9 net: fix failure of TestCVE202133195
TestCVE202133195 fails in testing LookupSRV if /etc/resolv.conf sets the option
'ndots' larger than the number of dots in the domain name under query.

Fix the issue by making the input domain name in test codes 'rooted' to skip search
list qualifying.

Fixes #46955

Change-Id: I1909fa7e54e9c9af57623e57cafc905729ff99fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/330842
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-29 21:54:24 +00:00
Levi(リーバイ) e294b8a49e doc/go1.17: fix typo "MacOS" -> "macOS"
Change-Id: Ie2ada2bf875a93b1cc9e86a81c8a25de39ce4752
GitHub-Last-Rev: 462753db01
GitHub-Pull-Request: golang/go#46962
Reviewed-on: https://go-review.googlesource.com/c/go/+/331589
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-29 19:30:24 +00:00
tkawakita 3463852b76 math/big: fix typo of comment (BytesScanner to ByteScanner)
Change-Id: I0c2d26d6ede1452008992efbea7392162da65014
Reviewed-on: https://go-review.googlesource.com/c/go/+/331651
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-06-29 16:57:13 +00:00
Cuong Manh Le fd4b587da3 cmd/compile: suppress details error for invalid variadic argument type
CL 255241 made error message involving variadic calls clearer. To do it,
we added a check that the type of variadic argument must be a slice.
That's why the compiler crashes for invalid variadic argument type.

Instead, we can just omit the details error message, and report not
enough arguments error, which matches the behavior of go/types and types2.

Fixes #46957

Change-Id: I638d7e8f031f0ee344d5d802104fd93a60aae00a
Reviewed-on: https://go-review.googlesource.com/c/go/+/331569
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-06-29 04:38:12 +00:00
eric fang e2e05af6e1 cmd/internal/obj/arm64: fix an encoding error of CMPW instruction
For arm64 CMP, ADD and other similar extended register instructions,
if there is no extension, the default extion is LSL<<0, but the default
encoding value (the value of 'option' field) of 32-bit instruction and
64-bit instruction is different, 32-bit is 2 and 64-bit is 3. But the
current assembler incorrectly encodes the value of 32-bit instruction
to 3. This CL fixes this error.

Change-Id: I0e09af2c9c5047a4ed2db7d1183290283db9c31c
Reviewed-on: https://go-review.googlesource.com/c/go/+/329749
Reviewed-by: eric fang <eric.fang@arm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: eric fang <eric.fang@arm.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-29 02:34:20 +00:00
Matthew Dempsky 4bb0847b08 cmd/compile,runtime: change unsafe.Slice((*T)(nil), 0) to return []T(nil)
This CL removes the unconditional OCHECKNIL check added in
walkUnsafeSlice by instead passing it as a pointer to
runtime.unsafeslice, and hiding the check behind a `len == 0` check.

While here, this CL also implements checkptr functionality for
unsafe.Slice and disallows use of unsafe.Slice with //go:notinheap
types.

Updates #46742.

Change-Id: I743a445ac124304a4d7322a7fe089c4a21b9a655
Reviewed-on: https://go-review.googlesource.com/c/go/+/331070
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2021-06-28 23:31:13 +00:00
Matthew Dempsky 1519271a93 spec: change unsafe.Slice((*T)(nil), 0) to return []T(nil)
Updates #46742.

Change-Id: I044933a657cd1a5cdb29863e49751df5fe9c258a
Reviewed-on: https://go-review.googlesource.com/c/go/+/331069
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-06-28 23:31:05 +00:00
Mia Zhu 5385e2386b runtime/internal/atomic: drop Cas64 pointer indirection in comments
Change-Id: Ieff0065cbd81e045594ce12e10338b0666816d70
GitHub-Last-Rev: d842f5cb3e
GitHub-Pull-Request: golang/go#46949
Reviewed-on: https://go-review.googlesource.com/c/go/+/331309
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-06-28 21:17:28 +00:00
Matthew Dempsky 956c81bfe6 cmd/go: add GOEXPERIMENT to go env output
This CL adds GOEXPERIMENT to `go env` output, and also makes it
configurable via `GOENV`. Thanks to Baokun Lee's CL 304350 for the
test and initial work on this.

Fixes #45226.

Change-Id: Ie7f92a8a503b6a2a4df3f6598f0b2bf2915e2e7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/328751
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
2021-06-28 20:51:30 +00:00
Matthew Dempsky a1d27269d6 cmd/go: prep for 'go env' refactoring
This CL refactors code a little to make it easier to add GOEXPERIMENT
support in the future.

Change-Id: I87903056f7863049e58be72047b2b8a60a213baf
Reviewed-on: https://go-review.googlesource.com/c/go/+/329654
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-06-28 20:51:04 +00:00
hao 901510ed4e cmd/link/internal/ld: skip the windows ASLR test when CGO_ENABLED=0
the test case is still using gcc when CGO is disabled.

Change-Id: I2d255bfaeb92816c8343ab72fd7984b6632d421d
GitHub-Last-Rev: de14748bd5
GitHub-Pull-Request: golang/go#46120
Reviewed-on: https://go-review.googlesource.com/c/go/+/319169
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-28 16:42:42 +00:00
Koichi Shiraishi 361159c055 cmd/cgo: fix 'see gmp.go' to 'see doc.go'
Change-Id: I303edc9dfbf4185b5b461b121ab504f6ed9f8630
Reviewed-on: https://go-review.googlesource.com/c/go/+/330839
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-28 16:41:43 +00:00
Matthew Dempsky c95464f0ea internal/buildcfg: refactor GOEXPERIMENT parsing code somewhat
This CL extracts out a ParseGOEXPERIMENT helper function that parses
GOOS/GOARCH/GOEXPERIMENT values and returns active and baseline
experiment flag sets and an error value, without affecting any global
state. This will be used in the subsequent CL for 'go env' support for
GOEXPERIMENT to validate configuration changes.

The existing package initialization for Experiment and
experimentBaseline and also UpdateExperiments are updated to use it as
well.

Change-Id: Ic2ed3fd36d2a6f7f3d8172fccb865e02505c0052
Reviewed-on: https://go-review.googlesource.com/c/go/+/331109
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
2021-06-27 05:06:30 +00:00