aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-01-27cmd/go: skip issue33139 when the 'cc' script command is unavailableNehal J Wani
With CGO disabled, the test suite tries to run the following and fail: CGO_ENABLED=0 go test -run=TestScript/link_syso_issue33139 cmd/go go test proxy running at GOPROXY=http://127.0.0.1:38829/mod --- FAIL: TestScript (0.01s) --- FAIL: TestScript/link_syso_issue33139 (0.01s) script_test.go:215: # Test that we can use the external linker with a host syso file that is # embedded in a package, that is referenced by a Go assembly function. # See issue 33139. (0.000s) # External linking is not supported on linux/ppc64. # See: https://github.com/golang/go/issues/8912 (0.000s) # External linking is not supported on linux/riscv64. # See: https://github.com/golang/go/issues/36739 (0.001s) > [linux] [riscv64] skip > cc -c -o syso/objTestImpl.syso syso/src/objTestImpl.c FAIL: testdata/script/link_syso_issue33139.txt:15: unexpected error starting command: fork/exec /dev/null: permission denied CC was set to /dev/null (during build) in the scenario mentioned above This patch replaces [!exec:cc] with [!cgo] because we care about the availability of the 'cc' builtin and not the 'cc' executable in $PATH Change-Id: Ifbd2441f5f8e903ca3da213aba76f44c2e2eebab GitHub-Last-Rev: 3b743787d08502f7a936e800ee7b6909fcf56068 GitHub-Pull-Request: golang/go#43912 Reviewed-on: https://go-review.googlesource.com/c/go/+/286633 Trust: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-01-27runtime: switch runtime to libc for openbsd/arm64Joel Sing
Use libc rather than performing direct system calls for the runtime on openbsd/arm64. Updates #36435 Change-Id: I8bd41dfec16209f2b9a83dda24b9a1e4b06757c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/286814 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-01-27runtime: convert openbsd/arm64 locking to libcJoel Sing
Switch openbsd/arm64 to locking via libc, rather than performing direct system calls. Update #36435 Change-Id: I2f30432c4bc232224cf87dca750665b8c40c7b72 Reviewed-on: https://go-review.googlesource.com/c/go/+/286813 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-01-27syscall: clean up mkasm related changesJoel Sing
The mkasm_darwin.go file was renamed to mkasm.go in CL 270380, with OpenBSD support being added. The mkasm_openbsd.go file should not have been merged, so remove it. Fix up references to mkasm_$GOOS.go and provide $GOOS as an argument on invocation. Updates #36435 Change-Id: I868d3f2146973d026e6a663d437749dbb6b312ec Reviewed-on: https://go-review.googlesource.com/c/go/+/286812 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-01-27doc/go1.16: fix closing brace in .Export formatRyuji Iwata
A parenthesis of go list "-f" flag format is double curly braces. Change-Id: Ifd38e0b0ae3c46272a4acd65584818228168b7c6 GitHub-Last-Rev: b46030492b5caf18fe127621fdf92cbec4c03ad5 GitHub-Pull-Request: golang/go#43924 Reviewed-on: https://go-review.googlesource.com/c/go/+/286752 Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Tobias Klauser <tobias.klauser@gmail.com>
2021-01-27math: fix typo in sqrt.go code commentPaul Davis
"it does not necessary" -> "it is not necessary" Change-Id: I66f9cf2670d76b3686badb4a537b3ec084447d62 GitHub-Last-Rev: 52a0f9993abf25369cdb6b31eaf476df1626cf87 GitHub-Pull-Request: golang/go#43935 Reviewed-on: https://go-review.googlesource.com/c/go/+/287052 Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Robert Griesemer <gri@golang.org>
2021-01-26runtime,syscall: convert syscall on openbsd/amd64 to libcJoel Sing
Convert the syscall package on openbsd/amd64 to use libc rather than performing direct system calls. Updates #36435 Change-Id: Ieb5926a91ed34f7c722e3667004ec484c86804ef Reviewed-on: https://go-review.googlesource.com/c/go/+/270380 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-01-26os: further document limitations around naked file descriptorsVictor Michel
NewFile requires the file descriptor to be either closed through the returned File instance, or to stay valid at least until the finalizer runs during garbage collection. These requirements are easily violated when file descriptors are closed via unix.Close, or when the *File returned by NewFile is garbage collected while the underlying file descriptor is still in use. This commit adds further documentation for NewFile and Fd, making it explicit that using naked file descriptors is subject to constraints due to garbage collection of File objects. Fixes #43863 Change-Id: I49ea1f0054eb2d2a72b616450c8e83476f4d07fb GitHub-Last-Rev: 180d0130ae9009456914fb265b4bafa0e599de0e GitHub-Pull-Request: golang/go#43867 Reviewed-on: https://go-review.googlesource.com/c/go/+/286032 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2021-01-26os: correct names in CreateTemp and MkdirTemp doc commentsIan Lance Taylor
For #42026 Change-Id: I51e3ce9d3a4729cfac44bd3ff3f3ec80dcd5abb5 Reviewed-on: https://go-review.googlesource.com/c/go/+/285376 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-01-26net/http/fcgi: remove locking added to prevent a test-only raceHilko Bengen
The race reported in issue #41167 was detected only because the ReadWriter used in test code happened to be a bytes.Buffer whose Read and Write operate (unsafely) on shared state. This is not the case in any realistic scenario where the FastCGI protocol is spoken over sockets or pairs of pipes. Since tests that use nopWriteCloser don't care about any output generate by child.Serve(), we change nopWriteCloser to provide a dummy Write method. Remove the locking added in CL 252417, since it causes a deadlock during write as reported in #43901. The race in tests no longer happens thanks to the aforementioned change to nopWriteCloser. Fixes #43901. Updates #41167. Change-Id: I8cf31088a71253c34056698f8e2ad0bee9fcf6c6 GitHub-Last-Rev: b06d8377fdada075775d79a20577d38a7c471b45 GitHub-Pull-Request: golang/go#43027 Reviewed-on: https://go-review.googlesource.com/c/go/+/275692 Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-01-25doc/go1.16: mention os.DirFS in os sectionIan Lance Taylor
For #40700 For #41190 Change-Id: I8ade6efd5be09003fc3e5db5a9b91ba6e0f023f7 Reviewed-on: https://go-review.googlesource.com/c/go/+/285593 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-01-25cmd/compile: fix order-of-assignment issue w/ defersMatthew Dempsky
CL 261677 fixed a logic issue in walk's alias detection, where it was checking the RHS expression instead of the LHS expression when trying to determine the kind of assignment. However, correcting this exposed a latent issue with assigning to result parameters in functions with defers, where an assignment could become visible earlier than intended if a later expression could panic. Fixes #43835. Change-Id: I061ced125e3896e26d65f45b28c99db2c8a74a8c Reviewed-on: https://go-review.googlesource.com/c/go/+/285633 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Trust: Matthew Dempsky <mdempsky@google.com>
2021-01-25doc/go1.16: mention os.DirEntry and types moved from os to io/fsIan Lance Taylor
For #40700 For #41467 For #41190 Change-Id: Id94e7511c98c38a22b1f9a55af6e200c9df07fd3 Reviewed-on: https://go-review.googlesource.com/c/go/+/285592 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-01-25doc/go1.16: mention new testing/iotest functionsIan Lance Taylor
For #38781 For #40700 For #41190 Change-Id: I72f1055e51edb517041d3861640734ba6ef5f342 Reviewed-on: https://go-review.googlesource.com/c/go/+/285673 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-01-25doc/go1.16: mention deprecation of io/ioutilIan Lance Taylor
For #40025 For #40700 For #42026 Change-Id: Ib51b5e1398c4eb811506df21e3bd56dd84bd1f7e Reviewed-on: https://go-review.googlesource.com/c/go/+/285377 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-01-25doc/go1.16: mention go/build changesIan Lance Taylor
For #40070 For #41191 For #43469 For #43632 Change-Id: I6dc6b6ea0f35876a4c252e4e287a0280aca9d502 Reviewed-on: https://go-review.googlesource.com/c/go/+/285213 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-01-25html/template: revert "avoid race when escaping updates template"Ian Lance Taylor
This reverts CLs 274450 and 279492, except for the new tests. The new race test is changed to skip, as it now fails. We can try again for 1.17. Original CL descriptions: html/template: attach functions to namespace The text/template functions are stored in a data structure shared by all related templates, so do the same with the original, unwrapped, functions on the html/template side. html/template: avoid race when escaping updates template For #39807 Fixes #43855 Change-Id: I2ce91321ada06ea496a982aefe170eb5af9ba847 Reviewed-on: https://go-review.googlesource.com/c/go/+/285957 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-01-25cmd/go: fix TestScript/cgo_path, cgo_path_space when CC setJay Conrod
These tests failed if CC was set to a path containing a separator during make.bash. They now set CC explicitly. Fixes #43897 Change-Id: Ic6e7f192fcb363f0ac9f45b329113255453bf76f Reviewed-on: https://go-review.googlesource.com/c/go/+/286292 Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-01-25doc/asm: add a section on go_asm.h, clean up go_tls.h sectionAustin Clements
Currently the only mention of go_asm.h is buried in a confusing section about the runtime-specific go_tls.h header. We actually want people to use go_asm.h, so this CL adds a section with a proper discussion of this header. As part of this, we remove the discussion of go_asm.h from the go_tls.h section and clean up what remains. I stumbled on this when working on the internal ABI specification. I wanted to refer to stable documentation on how to access struct fields from assembly and found there was none. Change-Id: I0d53741e7685e65794611939e76285f7c82e1d65 Reviewed-on: https://go-review.googlesource.com/c/go/+/286052 Trust: Austin Clements <austin@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2021-01-25lib/time, time/tzdata: update tzdata to 2021aTobias Klauser
Changelog: South Sudan changes from +03 to +02 on 2021-02-01 at 00:00. Release announcement: http://mm.icann.org/pipermail/tz-announce/2021-January/000065.html Updates #22487 Change-Id: Ia0a1a7a8f5d47adac9782bc2a445f69e02440f77 Reviewed-on: https://go-review.googlesource.com/c/go/+/285719 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
2021-01-25os: force consistent mtime before running fstest on directory on WindowsJason A. Donenfeld
FindFileNext sometimes returns a different mtime than looking at the file directly, because the MFT on NTFS is written to lazily. In order to keep these in sync, we use GetFileInformationByHandle to get the actual mtime, and then write it back to the file explicitly. Fixes #42637. Change-Id: I774016d3ac55d0dc9b0f9c1b681516c33ba0d28a Reviewed-on: https://go-review.googlesource.com/c/go/+/285720 Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Trust: Jason A. Donenfeld <Jason@zx2c4.com>
2021-01-25doc/go1.16: fix WalkDir and Walk linksTobias Klauser
Reported by Ben on golang-dev: https://groups.google.com/g/golang-dev/c/gsoj5Vv15j0/m/XR9CYSRkAgAJ For #40700. Change-Id: If4702cf0e9858aaef99c231251dc646a67d1026e Reviewed-on: https://go-review.googlesource.com/c/go/+/285718 Trust: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
2021-01-23doc/go1.16: add crypto/x509 memory optimizationBrad Fitzpatrick
Change-Id: I0c61b0e0d1430f66e3f7dbf07817264258a1c15a Reviewed-on: https://go-review.googlesource.com/c/go/+/285682 Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Brad Fitzpatrick <bradfitz@golang.org>
2021-01-23doc/go1.16: reword ambiguously parsable sentenceBrad Fitzpatrick
Change-Id: Idc54967e962352a598c9d4c563d1d9f51ec5c889 Reviewed-on: https://go-review.googlesource.com/c/go/+/285680 Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Brad Fitzpatrick <bradfitz@golang.org>
2021-01-23cmd/internal/obj/arm64: fix VMOVQ instruction encoding erroreric fang
The VMOVQ instruction moves a 128-bit constant into a V register, as 128-bit constant can't be loaded into a register directly, we split it into two 64-bit constants and load it from constant pool. Currently we add the 128-bit constant to literal pool by calling the 'addpool' function twice, this is not the right way because it doesn't guarantee the two DWORD instructions are consecutive, and the second call of addpool will overwrite the p.Pool field,resulting in a wrong PC-relative offset value of the Prog. This CL renames the flag LFROM3 to LFROM128, and adds a new function addpool128 to add a 128-bit constant to the literal pool. Change-Id: I616f043c99a9a18a663f8768842cc980de2e6f79 Reviewed-on: https://go-review.googlesource.com/c/go/+/282334 Reviewed-by: eric fang <eric.fang@arm.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: eric fang <eric.fang@arm.com> Trust: eric fang <eric.fang@arm.com>
2021-01-23runtime: restore cgo_import_dynamic for libc.so on openbsdJoel Sing
This was removed in change 285692, however we need to explicitly pull libc.so in when libpthread.so is being used. The current code works on openbsd/amd64 since we pull libc.so in via runtime/sys_openbsd2.go, however openbsd/arm64 does not do this currently. Change-Id: Ibe93d936a22e69e2fe12620f6d27ccca7a91dba5 Reviewed-on: https://go-review.googlesource.com/c/go/+/285912 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-01-22io/ioutil: fix example test for WriteFile to allow it to run in the playgroundPantonshire
The example for WriteFile assumed the existence of a testdata/ directory, which is not present on the playground. The example now writes the file to the current working directory, rather than to testdata/. Fixes #32916 Change-Id: I577caac7e67ba9d9941b2dd19346ad5ff61e78d9 GitHub-Last-Rev: 40f14e0adc4ebc00fb2946fe0cbaf8e0cb99f62c GitHub-Pull-Request: golang/go#43757 Reviewed-on: https://go-review.googlesource.com/c/go/+/284452 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Bryan C. Mills <bcmills@google.com>
2021-01-22runtime: define dummy msanmoveCherry Zhang
In msan mode we instrument code with msan* functions, including msanmove. In some configurations the code is instrumented by the compiler but msan is not actually linked in, so we need dummy definitions for those functions so the program links. msanmove is newly added in CL 270859 but a dummy definition in msan0.go was not added, causing link failures. Add it. Change-Id: I91f8e749919f57f1182e90b43412b0282cf4767c Reviewed-on: https://go-review.googlesource.com/c/go/+/285955 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-01-22runtime: check for g0 stack last in signal handlerCherry Zhang
In the signal handler, we adjust gsingal's stack to the stack where the signal is delivered. TSAN may deliver signals to the g0 stack, so we have a special case for the g0 stack. However, we don't have very good accuracy in determining the g0 stack's bounds, as it is system allocated and we don't know where it is exactly. If g0.stack.lo is too low, the condition may be triggered incorrectly, where we thought the signal is delivered to the g0 stack but it is actually not. In this case, as the stack bounds is actually wrong, when the stack grows, it may go below the (inaccurate) lower bound, causing "morestack on gsignal" crash. Check for g0 stack last to avoid this situation. There could still be false positives, but for those cases we'll crash either way. (If we could in some way determine the g0 stack bounds accurately, this would not matter (but probably doesn't hurt).) Fixes #43853. Change-Id: I759717c5aa2b0deb83ffb23e57b7625a6b249ee8 Reviewed-on: https://go-review.googlesource.com/c/go/+/285772 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2021-01-22cmd/go: don't lookup the path for CC when invoking cgoJay Conrod
Previously, if CC was a path without separators (like gcc or clang), we'd look it up in PATH in cmd/go using internal/execabs.LookPath, then pass the resolved path to cgo in CC. This caused a regression: if the directory in PATH containing CC has a space, cgo splits it and interprets it as multiple arguments. With this change, cmd/go no longer resolves CC before invoking cgo. cgo does the path lookup on each invocation. This reverts the security fix CL 284780, but that was redundant with the addition of internal/execabs (CL 955304), which still protects us. Fixes #43808 Updates #41400 Change-Id: I65d91a1e303856df8653881eb6e2e75a3bf95c49 Reviewed-on: https://go-review.googlesource.com/c/go/+/285873 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-01-22runtime: switch runtime to libc for openbsd/amd64Joel Sing
Use libc rather than performing direct system calls for the runtime on openbsd/amd64. Updates #36435 Change-Id: Ib708009c3743f56a3fd6cb3bc731451e4a398849 Reviewed-on: https://go-review.googlesource.com/c/go/+/270379 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-01-22cmd/go: add documentation for test and xtest fields output by go listMichael Matloob
The TestEmbedPatterns, TestEmbedFiles, XTestEmbedPatterns, and XTestEmbedFiles fields were left out of golang.org/cl/282195 which was supposed to document the embed fields available in the go list output. Add documentation for them in this CL. Fixes #43081 Change-Id: Ifc256c476daec7c0f0e2c41f86b82f958b3e2b1a Reviewed-on: https://go-review.googlesource.com/c/go/+/284258 Trust: Michael Matloob <matloob@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-01-22runtime: remove pthread_kill/pthread_self for openbsdJoel Sing
We're now using getthrid() and thrkill() instead. Updates #36435 Change-Id: I1c6bcfb9b46d149e0a2a10e936a244576489a88e Reviewed-on: https://go-review.googlesource.com/c/go/+/285692 Trust: Joel Sing <joel@sing.id.au> Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-01-22runtime: fix typo in mgcscavenge.goIkko Ashimine
recieved -> received Change-Id: I84336170e179832604e1311ea9263af36f9ce15a GitHub-Last-Rev: a6068c1d2b5a7711b93899f798dbc84f1ea339e4 GitHub-Pull-Request: golang/go#43845 Reviewed-on: https://go-review.googlesource.com/c/go/+/285675 Reviewed-by: Keith Randall <khr@golang.org> Trust: Alberto Donizetti <alb.donizetti@gmail.com>
2021-01-22net/http: fix flaky TestDisableKeepAliveUpgradeDamien Neil
This test hijacks a connection. It was reading from the net.Conn returned by Hijack, not the bufio.ReadWriter, causing flaky failures when a read-ahead byte was held in the read buffer. Fixes #43073. Change-Id: Ic3e7f704fba9635fd851cb3c0c0c74e312b75f6e Reviewed-on: https://go-review.googlesource.com/c/go/+/285596 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Anmol Sethi <nhooyr@gmail.com>
2021-01-22time: clarify Timer.Reset behavior on AfterFunc TimersBrad Fitzpatrick
Fixes #28100 Change-Id: I37d4d7badf455e4ecf982d4fc7cb070052de2e45 Reviewed-on: https://go-review.googlesource.com/c/go/+/285632 Trust: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-01-22doc/go1.16: mention net/http.Transport.GetProxyConnectHeaderIan Lance Taylor
For #40700 For #41048 Change-Id: Ida6bcaaf5edaa2bba9ba2b8e02ec9959481f8302 Reviewed-on: https://go-review.googlesource.com/c/go/+/285594 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-01-22doc/go1.16: mention path/filepath.WalkDirIan Lance Taylor
For #40700 For #42027 Change-Id: Ifb73050dfdab21784fa52d758ad9c408e6489684 Reviewed-on: https://go-review.googlesource.com/c/go/+/285595 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-01-22doc/go1.16: mention syscall.AllThreadsSyscallIan Lance Taylor
For #1435 For #40700 Change-Id: I01d277617ab511c90b9663fc89e418402e5ee2be Reviewed-on: https://go-review.googlesource.com/c/go/+/285597 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-01-21doc/go1.16: add notes about package-specific fs.FS changesIan Lance Taylor
For #40700 For #41190 Change-Id: I964d6856d5cad62c859d0f3a7afdd349a8ad87cb Reviewed-on: https://go-review.googlesource.com/c/go/+/285093 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-01-21doc/go1.16: minor formatting fixAustin Clements
Change-Id: Ie924a15da0d9a35089d1d4b3d6c4a07b93bdf270 Reviewed-on: https://go-review.googlesource.com/c/go/+/285393 Trust: Austin Clements <austin@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-01-21doc/go1.16: mention new debug/elf constantsIan Lance Taylor
For #40700 Change-Id: If105d2f043539bb0893f577a984f14ee3e7ca753 Reviewed-on: https://go-review.googlesource.com/c/go/+/285212 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-01-21cmd/go: overwrite program name with full pathRoland Shoemaker
If the program path is resolved, replace the first argument of the exec.Cmd, which is the bare program name with the resolved path. Change-Id: I92cf5e6f4bb7c8fef9b59f5eab963f4e75b90d07 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/957908 Reviewed-by: Katie Hockman <katiehockman@google.com> Reviewed-by: Russ Cox <rsc@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/284784 Trust: Roland Shoemaker <roland@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Roland Shoemaker <roland@golang.org>
2021-01-21all: introduce and use internal/execabsRoland Shoemaker
Introduces a wrapper around os/exec, internal/execabs, for use in all commands. This wrapper prevents exec.LookPath and exec.Command from running executables in the current directory. All imports of os/exec in non-test files in cmd/ are replaced with imports of internal/execabs. This issue was reported by RyotaK. Fixes CVE-2021-3115 Fixes #43783 Change-Id: I0423451a6e27ec1e1d6f3fe929ab1ef69145c08f Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/955304 Reviewed-by: Russ Cox <rsc@google.com> Reviewed-by: Katie Hockman <katiehockman@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/284783 Run-TryBot: Roland Shoemaker <roland@golang.org> Reviewed-by: Katie Hockman <katie@golang.org> Trust: Roland Shoemaker <roland@golang.org>
2021-01-21cmd/go: add test case for cgo CC settingRuss Cox
Change-Id: Ied986053a64447c5eac6369f6c9b69ed3d3f94d9 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/949415 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/284782 Run-TryBot: Roland Shoemaker <roland@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Roland Shoemaker <roland@golang.org>
2021-01-21cmd/cgo: report exec errors a bit more clearlyRuss Cox
Change-Id: I0e6bebf0e2e6efdef4be880e0c6c7451b938924b Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/949417 Reviewed-by: Katie Hockman <katiehockman@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/284781 Run-TryBot: Roland Shoemaker <roland@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Roland Shoemaker <roland@golang.org>
2021-01-21cmd/go: pass resolved CC, GCCGO to cgoRuss Cox
This makes sure the go command and cgo agree about exactly which compiler is being used. This issue was reported by RyotaK. Fixes CVE-2021-3115 Fixes #43783 Change-Id: If171c5c8b2523efb5ea2d957e5ad1380a038149c Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/949416 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/284780 Run-TryBot: Roland Shoemaker <roland@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Roland Shoemaker <roland@golang.org>
2021-01-21runtime: switch openbsd/arm64 to pthreadsJoel Sing
This switches openbsd/arm64 to thread creation via pthreads, rather than doing direct system calls. Update #36435 Change-Id: I7cf60fa954f92628e05f15d2732833a2fbdccdb9 Reviewed-on: https://go-review.googlesource.com/c/go/+/250182 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-01-21crypto/elliptic: fix P-224 field reductionFilippo Valsorda
This patch fixes two independent bugs in p224Contract, the function that performs the final complete reduction in the P-224 field. Incorrect outputs due to these bugs were observable from a high-level P224().ScalarMult() call. The first bug was in the calculation of out3GT. That mask was supposed to be all ones if the third limb of the value is greater than the third limb of P (out[3] > 0xffff000). Instead, it was also set if they are equal. That meant that if the third limb was equal, the value was always considered greater than or equal to P, even when the three bottom limbs were all zero. There is exactly one affected value, P - 1, which would trigger the subtraction by P even if it's lower than P already. The second bug was more easily hit, and is the one that caused the known high-level incorrect output: after the conditional subtraction by P, a potential underflow of the lowest limb was not handled. Any values that trigger the subtraction by P (values between P and 2^224-1, and P - 1 due to the bug above) but have a zero lowest limb would produce invalid outputs. Those conditions apply to the intermediate representation before the subtraction, so they are hard to trace to precise inputs. This patch also adds a test suite for the P-224 field arithmetic, including a custom fuzzer that automatically explores potential edge cases by combining limb values that have various meanings in the code. contractMatchesBigInt in TestP224Contract finds the second bug in less than a second without being tailored to it, and could eventually find the first one too by combining 0, (1 << 28) - 1, and the difference of (1 << 28) and (1 << 12). The incorrect P224().ScalarMult() output was found by the elliptic-curve-differential-fuzzer project running on OSS-Fuzz and reported by Philippe Antoine (Catena cyber). Fixes CVE-2021-3114 Fixes #43786 Change-Id: I50176602d544de3da854270d66a293bcaca57ad7 Reviewed-on: https://go-review.googlesource.com/c/go/+/284779 Run-TryBot: Roland Shoemaker <roland@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Trust: Ian Lance Taylor <iant@golang.org> Trust: Roland Shoemaker <roland@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org>
2021-01-20cmd/internal/moddeps: check content of all modules in GOROOTDmitri Shuralyov
Expand the scope of the TestAllDependenciesVendored test to check that all modules in GOROOT are tidy, that packages are vendored, the vendor content matches the upstream copy exactly, and that bundled packages are re-generated (using x/tools/cmd/bundle at the version selected in cmd module; this is deterministic and guaranteed to be updated over time). This is done in a conceptually simple way: 1. Make a temporary copy of the entire GOROOT tree (except .git), one that is safe to modify. 2. Run a list of high-level commands, the same commands we expect Go developers should be able to run in a normal complete GOROOT tree to make it clean and tidy. 3. Diff the end result with the original GOROOT tree being tested to catch any unexpected differences. The current set of commands that are run require the cmd/go command, and a functional compiler itself (because re-generating the syscall package involves a directive like //go:generate go run [...]). As a result, copying a large majority of the GOROOT tree is a requirement. Instead of looking for the few files or directories that can we can get away not copying (e.g., the testdata directories aren't strictly needed at this time), we opt not to optimize and just do the simple copy. This is motivated by these reasons: • We end up having a complete, normal GOROOT tree, one that happens to be located at another path. There's a very high likelihood that module management/code generation commands, both the ones we run today and any additional ones that we might want to add in the future, will result in correct results even as the Go project evolves over time. • Having a completely stand-alone copy of the GOROOT tree without symlinks minimizes the risk of some of the module management/code generation commands, either now or in the future, from modifying the user's original GOROOT tree, something that should not happen during test execution. Overlays achieved with symlinks work well when we can guarantee only new files are added, but that isn't the case here. • Copying the entire GOROOT (without .git), takes around 5 seconds on a fairly modern computer with an SSD. The most we can save is a couple of seconds. (We make some minor exceptions: the GOROOT/.git directory isn't copied, and GOROOT/{bin,pkg} are deemed safe to share and thus symlink instead of copying. If these optimizations cease to be viable to make, we'll need to remove them.) Since this functionality is fairly expensive to execute and requires network access, it runs only when the test is executed without -short flag. The previous behavior of the TestAllDependenciesVendored test is kept in -short test mode. all.bash runs package tests with -short flag, so its behavior is unchanged. The expectation is that the new test will run on some of the longtest builders to catch problems. Users can invoke the test manually 'go test cmd/internal/moddeps' (and it's run as part of 'go test cmd', again, only when -short flag isn't provided). On a 2017 MacBook Pro, a successful long test takes under 15 seconds, which should be within scope of all long tests that are selected by 'go test std cmd'. We may further adjust when and where the test runs by default based on our experience. Fixes #36852. Fixes #41409. Fixes #43687. Updates #43440. Change-Id: I9eb85205fec7ec62e3f867831a0a82e3c767f618 Reviewed-on: https://go-review.googlesource.com/c/go/+/283643 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Trust: Dmitri Shuralyov <dmitshur@golang.org>