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

54139 Commits

Author SHA1 Message Date
Joel Sing
b6a6847b2f cmd/compile: avoid zero extension after properly typed atomic operation on riscv64
LoweredAtomicLoad8 is implemented using MOVBU, hence it is already zero
extended. LoweredAtomicCas32 and LoweredAtomicCas64 return a properly
typed boolean.

Change-Id: Ie0acbaa19403d59c7e5f76d060cc13ee51eb7834
Reviewed-on: https://go-review.googlesource.com/c/go/+/428214
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
2022-09-07 05:38:50 +00:00
Joel Sing
c011270fa5 cmd/compile: improve Slicemask on riscv64
Implement Slicemask the same way every other architecture does - negate
then arithmetic right shift. This sets or clears the sign bit, before
extending it to the entire register.

Removes around 2,500 instructions from the Go binary on linux/riscv64.

Change-Id: I4d675b826e7eb23fe2b1e6e46b95dcd49ab49733
Reviewed-on: https://go-review.googlesource.com/c/go/+/426354
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-07 05:37:53 +00:00
cuiweixie
ba1ef54c1e syscall: simplify code using unsafe.Slice
Updates #54854

Change-Id: Ibaf4eea14a6259cdbca79e9e95db1602966f18e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/428176
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-07 01:48:31 +00:00
cuiweixie
4fe4601d37 runtime: simplify code using unsafe.{Slice,String}
Updates #54854

Change-Id: Ie18665e93e477b6f220acf4c6c070b2af4343064
Reviewed-on: https://go-review.googlesource.com/c/go/+/428157
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-07 01:48:30 +00:00
cuiweixie
2ee075dc47 strings: simplify code using unsafe.StringData
Updates #54854

Change-Id: I93396dc92bd2decba895f2d059e1aeffcd22312c
Reviewed-on: https://go-review.googlesource.com/c/go/+/428158
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-09-07 01:33:55 +00:00
cuiweixie
92b8f4e293 internal/fuzz: simplify code using unsafe.{SliceData,Slice}
Updates #54854

Change-Id: If70b11c0fc920b7214fcff249da9e3c4ac1de991
Reviewed-on: https://go-review.googlesource.com/c/go/+/428156
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2022-09-07 01:33:53 +00:00
cuiweixie
2a627afe13 bytes: simplify code using unsafe.SliceData
Updates #54854

Change-Id: I9c14f9fa595f73eae44eb714abc5d486915893c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/428155
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-07 01:33:52 +00:00
cuiweixie
502504f433 cmd/compile/internal/ssagen: use strings.Builder
Change-Id: I840262eefff1073a452a243b9e31f61b53362fcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/428360
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-07 01:30:12 +00:00
cuiweixie
095b6f050f cmd/compile/internal/ssa: use strings.Builder
Change-Id: Ieb15b54d36f18d1fbccbafe5451a4758df797718
Reviewed-on: https://go-review.googlesource.com/c/go/+/428359
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-07 01:29:43 +00:00
cuiweixie
431446d0a0 cmd/compile/internal/pkginit: use strings.Builder
Change-Id: If675277e17b97500100e46ec6fe471260131bafc
Reviewed-on: https://go-review.googlesource.com/c/go/+/428358
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-09-07 01:29:20 +00:00
cuiweixie
1429a97520 cmd/compile/internal/ir: use strings.Builder
Change-Id: I24fb36a0591782c07f26c3289265aa41a643666d
Reviewed-on: https://go-review.googlesource.com/c/go/+/428357
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2022-09-07 01:28:55 +00:00
cuiweixie
db9e549fd2 crypto/x509/internal/macos: simplify code using unsafe.{SliceData,StringData}
Updates #54854

Change-Id: I8a64a1176cbe16489e1fd21c66a7abc7d8b8e9b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/428154
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-07 01:27:54 +00:00
Andy Pan
ccf82d5323 net: fix a typo in BenchmarkSendFile
Change-Id: Ic463bd6d52e7d1d50d2dbd2122b4d514e0b4af60
Reviewed-on: https://go-review.googlesource.com/c/go/+/428755
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-07 01:09:59 +00:00
cuiweixie
bfadd78986 net/rpc/jsonrpc: use strings.Builder
Change-Id: I251f734adbaf83aa03e3f4f37add4e116f5af093
Reviewed-on: https://go-review.googlesource.com/c/go/+/428271
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-07 01:09:53 +00:00
Kir Kolyshkin
2b8f214094 os/exec: LookPath: use eaccess for exec check on linux
Having an executable bit set for a binary is not enough for it to be
executable -- there might be more checks in the kernel. For example,
binaries on a filesystem mounted with "noexec" flag couldn't be
executed. There might be other scenarios involving ACLs, SELinux,
file capabilities, and so on.

As a result, LookPath might either find a non-executable (while going
over $PATH elements), or return a false positive that the argument
provided is an executable.

One possible fix would be to perform the check by using access(2)
syscall with X_OK flag.

Now, since access(2) uses real (rather than effective) uid and gid,
when used by a setuid or setgid binary, it checks permissions of the
(real) user who started the binary, rather than the actual effective
permissions. Therefore, using access with X_OK won't work as expected
for setuid/setgid binaries.

To fix this, modern platforms added ways to check against effective uid
and gid, with the most common being the faccessat(2) call with the
AT_EACCESS flag, as described by POSIX.1-2008 (in Linux, only
faccessat2(2) supports flags such as AT_EACCESS). Let's use it, and fall
back to checking permission bits if faccessat is not available.

Wrap the logic into unix.Eaccess, which is currently only implemented on
Linux. While many other OSes (Free/Net/OpenBSD, AIX, Solaris/Illumos, and
Darwin) do implement faccessat(2) with AT_EACCESS, it is not wired in
syscall package (except for AIX), so these platforms are left out for now.
In the future, eaccess can be implemented for these OSes, too.

Alas, a call to unix.Eaccess is not enough since we have to filter out
directories, so use both stat and Eaccess.

One minor change introduced by this commit is that LookPath and Command
now returns "is a directory" error when the argument contains a slash
and is a directory.  This is similar to what e.g. bash does on Linux:

	$ bash -c /etc
	bash: line 1: /etc: Is a directory

Add a test case, which, unfortunately, requires root, is specific to
Linux, and needs a relatively new kernel (supporting faccessat2).  Other
platforms either have different semantics for tmpfs with noexec, or have
different ways to set up a binary which has x bit set but nevertheless
could not be executed.

Change-Id: If49b6ef6bf4dd23b2c32bebec8832d83e511a4bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/414824
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-07 01:09:45 +00:00
cuiweixie
403e5f1cb1 net/http: use strings.Builder
Change-Id: I754edcf21e003a3f4037fb2c5d8d06f2cd5f2fa3
Reviewed-on: https://go-review.googlesource.com/c/go/+/428267
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: xie cui <523516579@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2022-09-07 01:07:32 +00:00
cuiweixie
8fd2073694 net: use strings.Builder
Change-Id: I3861a73d6b9d1d454c42bec50099b916bf30f1cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/428266
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2022-09-07 00:49:41 +00:00
Damien Neil
29af494fca all: update vendored golang.org/x/net
Pull in security fix:

    f3363e06e7 http2: handle server errors after sending GOAWAY

Fixes CVE-2022-27664
Fixes golang/go#54658

Change-Id: Ie1f58a8d769c7fd75c67d202c611a3abfd7dbb35
Reviewed-on: https://go-review.googlesource.com/c/go/+/428717
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
2022-09-06 23:07:55 +00:00
Michael Pratt
c83e1b6d5b cmd/link,runtime: remove unused fields from inlinedCall
The parent, file, and line fields are no longer used now that we have
parentPc to find the parent and NOPs in the parent to attach file/line
pcdata to.

Removing these fields reduces the binary size of cmd/go on linux-amd64
by 1.1%.

Fixes #54849.

Change-Id: If58f08622736b2b322288608776f8bedf0c3fd17
Reviewed-on: https://go-review.googlesource.com/c/go/+/427960
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-06 22:23:43 +00:00
Cuong Manh Le
c82304b712 cmd/compile: do not devirtualize defer/go calls
For defer/go calls, the function/method value are evaluated immediately.
So after devirtualizing, it may trigger a panic when implicitly deref
a nil pointer receiver, causing the program behaves unexpectedly.

It's safer to not devirtualizing defer/go calls at all.

Fixes #52072

Change-Id: I562c2860e3e577b36387dc0a12ae5077bc0766bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/428495
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-09-06 22:14:56 +00:00
zhangyunhao
812fd2fe70 cmd/compile: gofmt comments
Change-Id: I79634efbd8d0189afdfe22e147d63c889e8047ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/427964
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-09-06 22:14:14 +00:00
Sean Liao
90f04dd461 net/http: clarify proxy selection from environment
For #40909
Fixes #54890

Change-Id: I00218bc1606eedb6194a3a7b81fd4d3f75325280
Reviewed-on: https://go-review.googlesource.com/c/go/+/428775
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Damien Neil <dneil@google.com>
2022-09-06 22:13:54 +00:00
cuiweixie
86f8b8d3f2 cmd/compile/internal/syntax: use strings.Builder
Change-Id: Ic18d12b3d1c2f4819f2656371537df797e9970ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/428361
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-09-06 21:53:23 +00:00
cuiweixie
50bb42a46f net/http: using strings.Builder
Change-Id: I5d4c89a8d87a8697d038bf91b17d7ffc847a49c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/428137
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-06 21:52:12 +00:00
cuiweixie
11c5bf521e go/doc: using strings.Builder
Change-Id: I9658c37a548a386c57d83dc13d5e9925a9c13211
Reviewed-on: https://go-review.googlesource.com/c/go/+/428140
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-06 21:50:52 +00:00
cuiweixie
a8237ba61a go/ast: using strings.Builder
Change-Id: I05ebaf4e11b5b6ca7d9bbb0b2241def7773b11cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/428138
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: xie cui <523516579@qq.com>
2022-09-06 21:50:49 +00:00
Cuong Manh Le
ef69718dd7 all: make sure *Pointer[T]'s methods are inlined as intended
Updates #50860

Change-Id: I65bced707e50364b16edf4b087c541cf19bb1778
Reviewed-on: https://go-review.googlesource.com/c/go/+/428362
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-09-06 18:16:03 +00:00
Tobias Klauser
00234b052e internal/poll, internal/syscall/unix, net: enable writev on solaris
The writev syscall is available since at least Solaris 11.3.

Reuse the existing illumos writev wrapper on solaris to implement
internal/poll.writev for net.(*netFD).writeBuffers.

Change-Id: I23adc3bb4637740c72bfb61bfa9697b432dfe3db
Reviewed-on: https://go-review.googlesource.com/c/go/+/427714
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-09-06 18:06:02 +00:00
cuiweixie
e0e0c8fe98 mime: use strings.Builder
Change-Id: I2756fab046154a2df49435ba1978a32176de830a
Reviewed-on: https://go-review.googlesource.com/c/go/+/428265
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-09-06 17:36:47 +00:00
cuiweixie
3b044e9c7e net/http/cgi: use strings.Builder
Change-Id: Ie5a8ae104970237e6e33e75cae807c436bcd08e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/428268
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-06 17:34:50 +00:00
cuiweixie
8f14a4602d net/http/httptrace: use strings.Builder
Change-Id: I407d11b43349cd78b709deb7b0e774bd93922caa
Reviewed-on: https://go-review.googlesource.com/c/go/+/428269
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-06 17:34:30 +00:00
cuiweixie
ce8dcd9879 net/http/httputil: use strings.Builder
Change-Id: Ifb51413894791154489bd1d4f529088958212c62
Reviewed-on: https://go-review.googlesource.com/c/go/+/428270
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-06 17:34:07 +00:00
cuiweixie
1207ee896c cmd/doc: use strings.Builder
Change-Id: Ib33d1f1c2e9aed0cb9e00bd699c4ae4a2df5dfca
Reviewed-on: https://go-review.googlesource.com/c/go/+/428288
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Auto-Submit: Rob Pike <r@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-06 17:12:04 +00:00
Daniel Martí
fbf452a89f runtime: remove unused parameter on runOpenDeferFrame
Found via unparam.

Change-Id: I21126405beaf0be84e14ac165ecb68aeb0c9c823
Reviewed-on: https://go-review.googlesource.com/c/go/+/427014
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: hopehook <hopehook@golangcn.org>
2022-09-06 17:05:15 +00:00
Damien Neil
dc629ec939 net/http: make triv.go example less insecure
The triv.go example serves the entire contents of $HOME by default.
That seems bad, let's not do that.

Also change it to listen on localhost only.

Change-Id: I8f1b7bd6b7d737852273e2ba82deabc4a2d11f6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/428237
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Tatiana Bradley <tatiana@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-06 17:03:18 +00:00
Tobias Klauser
e1e88d636b net: mark withTCPConnPair as test helper
Noticed while analyzing test failures on go.dev/cl/427714 that were
pointing to withTCPConnPair instead of the failing tests.

Change-Id: Ie2366962c2253e0c2a6546d3b7f43a96390bc7bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/428456
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
2022-09-06 16:59:58 +00:00
Sasha Melentyev
b71ca76065 debug/buildinfo: remove redundant type conversion
Change-Id: Ia8ffc9a17646ad2c74f633610aaf34fef006c023
GitHub-Last-Rev: 6ab0d10739
GitHub-Pull-Request: golang/go#54856
Reviewed-on: https://go-review.googlesource.com/c/go/+/428235
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-09-06 16:59:51 +00:00
Andy Pan
efa357ce3c net: add benchmark test for SendFile
BenchmarkSendFile/1024-4                  716760              1582 ns/op         647.31 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/2048-4                  624632              2057 ns/op         995.55 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/4096-4                  429459              2665 ns/op        1537.06 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/8192-4                  275941              4996 ns/op        1639.56 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/16384-4                 149577              8522 ns/op        1922.58 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/32768-4                  75427             14791 ns/op        2215.47 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/65536-4                  43912             28402 ns/op        2307.41 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/131072-4                 23509             48657 ns/op        2693.82 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/262144-4                 12512             91791 ns/op        2855.87 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/524288-4                  5760            579891 ns/op         904.12 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/1048576-4                 3020            344129 ns/op        3047.05 MB/s           0 B/op          0 allocs/op

Change-Id: Iaf75e19c9ae8d77b89b3eabb2e9142f59c124536
Reviewed-on: https://go-review.googlesource.com/c/go/+/425878
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-06 16:58:27 +00:00
Andy Pan
979956a732 os: delete unused errClosed
errClosed was introduced by CL 163058 and was supposed to be removed by CL 243906,
but somehow it was left out, now we should get it deleted.

Change-Id: I74c4b36b8bbc4844e1860acb022a16b0aa3272b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/427035
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-06 16:57:58 +00:00
Tobias Klauser
dc029f286e runtime: add missing copyright header to signal_windows_test.go
The file was added in CL 181839 which was submitted in 2019.

Also delete the superfluous //go:build windows build constraint which is
already part of the file name.

Change-Id: Iecdf3d75848a7b8e2a76cd18c9fff4fb90acdac2
Reviewed-on: https://go-review.googlesource.com/c/go/+/427854
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-09-06 16:53:53 +00:00
cuiweixie
1110222bee sync: convert Once.done to atomic type
Change-Id: I49f8c764d49cabaad4d6859c219ba7220a389c1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/427140
Run-TryBot: xie cui <523516579@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-09-06 16:53:51 +00:00
Alok Menghrajani
9363f356bd math/big: replace dead link in a comment with link to an archive.org copy
Happy to use another service if web.archive.org isn't suitable.

Note: the original page redirects and then links to some nsfw content.

Change-Id: Ie93ca0c6aad871881f35b7e5609b96da5c14cfc0
GitHub-Last-Rev: ced5a97eb5
GitHub-Pull-Request: golang/go#54857
Reviewed-on: https://go-review.googlesource.com/c/go/+/428236
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2022-09-06 16:37:29 +00:00
Austin Clements
60ef4b2c1e runtime: in traceback, only jump stack if M doesn't change
CL 424257 modified gentraceback to switch gp when jumping from a
system stack to a user stack to simplify reasoning through the rest of
the function. This has the unintended side-effect of also switching
all references to gp.m. The vast majority of the time, g0.m and curg.m
are the same across a stack switch, making this a no-op, but there's
at least one case where this isn't true: if a profiling signal happens
in execute between setting mp.curg and setting gp.m. In this case,
mp.curg.m is briefly nil, which can cause gentraceback to crash with a
nil pointer dereference. We see this failure (surprisingly
frequently!) in profiling tests in the morestack=mayMoreStackPreempt
testing mode (#48297).

Fix this by making only jumping stacks if doing so will not switch Ms.
This restores the original property that gp.m doesn't change across
the stack jump, and makes gentraceback a little more conservative
about jumping stacks.

Fixes #54885.

Change-Id: Ib1524c41c748eeff35896e0f3abf9a7efbe5969f
Reviewed-on: https://go-review.googlesource.com/c/go/+/428656
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Austin Clements <austin@google.com>
2022-09-06 16:04:07 +00:00
cuiweixie
e3885c4ee5 log: use strings.Builder
Change-Id: I02c4664f1ba72623a5470e92bbebabb2f4862428
Reviewed-on: https://go-review.googlesource.com/c/go/+/428264
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-06 15:49:33 +00:00
cuiweixie
7c47c9773c io: use strings.Builder
Change-Id: Ibab20627ccd1f79e77e3972e2bc6ca42c2c7de13
Reviewed-on: https://go-review.googlesource.com/c/go/+/428263
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-06 15:49:32 +00:00
cuiweixie
c35bc69c97 image/jpeg: use strings.Builder
Change-Id: I0a51aa9e7800689c123ce3eaf74742a4641b7681
Reviewed-on: https://go-review.googlesource.com/c/go/+/428261
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-06 15:49:30 +00:00
cuiweixie
07b19bf5ab html/template: use strings.Builder
Change-Id: Iab6ef8c6c74c09e8358f7d7088a82089725479ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/428260
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-06 15:48:16 +00:00
cuiweixie
91a1b55489 flag: use strings.Builder
Change-Id: Iee846c4ac0f111ff97aa618dd42f6b2d14aa4342
Reviewed-on: https://go-review.googlesource.com/c/go/+/428259
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-06 15:47:09 +00:00
cuiweixie
ab87db8b46 encoding: use strings.Builder
Change-Id: Ib07699df8ea41fd8d1bca8ad050859fac24623de
Reviewed-on: https://go-review.googlesource.com/c/go/+/428258
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-06 15:46:20 +00:00
cuiweixie
a89c3d76ba debug: use strings.Builder
Change-Id: I59db11212758b478248f34c031501a167335348c
Reviewed-on: https://go-review.googlesource.com/c/go/+/428257
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-06 15:44:55 +00:00