aboutsummaryrefslogtreecommitdiff
path: root/src/syscall
AgeCommit message (Collapse)Author
2 dayssyscall: rm go:linkname from origRlimitNofileKir Kolyshkin
Since CL 588076 runc can do fine without the kludge. The code accessing the symbol is now guarded with `go:build !go1.23` in all supported runc branches (main: [1], release-1.1: [2]). This reverts part of CL 587219. Updates #67401. For #66797. [1]: https://github.com/opencontainers/runc/pull/4290 [2]: https://github.com/opencontainers/runc/pull/4299 Change-Id: I204843a93c36857e21ab9b43bd7aaf046e8b9787 Reviewed-on: https://go-review.googlesource.com/c/go/+/587918 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
11 daysall: document legacy //go:linkname for final round of modulesRuss Cox
Add linknames for most modules with ≥50 dependents. Add linknames for a few other modules that we know are important but are below 50. Remove linknames from badlinkname.go that do not merit inclusion (very small number of dependents). We can add them back later if the need arises. Fixes #67401. (For now.) Change-Id: I1e49fec0292265256044d64b1841d366c4106002 Reviewed-on: https://go-review.googlesource.com/c/go/+/587756 Auto-Submit: Russ Cox <rsc@golang.org> TryBot-Bypass: Russ Cox <rsc@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
11 daysos: RemoveAll: fix symlink race for unixKir Kolyshkin
Since all the platforms now support O_DIRECTORY flag for open, it can be used to (together with O_NOFOLLOW) to ensure we open a directory, thus eliminating the need to call stat before open. This fixes the symlink race, when a directory is replaced by a symlink in between stat and open calls. While at it, rename openFdAt to openDirAt, because this function is (and was) meant for directories only. NOTE Solaris supports O_DIRECTORY since before Solaris 11 (which is the only version Go supports since supported version now), and Illumos always had it. The only missing piece was O_DIRECTORY flag value, which is taken from golang.org/x/sys/unix. Updates #52745. Change-Id: Ic1111d688eebc8804a87d39d3261c2a6eb33f176 Reviewed-on: https://go-review.googlesource.com/c/go/+/588495 Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Aleksa Sarai <cyphar@cyphar.com> Reviewed-by: Than McIntosh <thanm@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
11 dayssyscall: add Setuid for aixMauri de Souza Meneguzzo
Fixes #67651 Change-Id: I8128433ddd040c8b91d7b6264200e19433d7a7dc GitHub-Last-Rev: 7557a88cf5a52a99e7689b604964cd4ec8e6bfec GitHub-Pull-Request: golang/go#67656 Reviewed-on: https://go-review.googlesource.com/c/go/+/588119 Reviewed-by: Than McIntosh <thanm@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Run-TryBot: Mauri de Souza Meneguzzo <mauri870@gmail.com> TryBot-Bypass: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-24syscall: Setrlimit: always clean rlimitNofileCacheKir Kolyshkin
Since the introduction of origRlimitNofileCache in CL 476097 the only way to disable restoring RLIMIT_NOFILE before calling execve syscall (os.StartProcess etc) is this: var r syscall.Rlimit syscall.Getrlimit(syscall.RLIMIT_NOFILE, &r) syscall.Setrlimit(syscall.RLIMIT_NOFILE, &r) The problem is, this only works when setrlimit syscall succeeds, which is not possible in some scenarios. Let's assume that if a user calls syscall.Setrlimit, they unconditionally want to disable restoring the original rlimit. For #66797. Change-Id: I20d0365df4bd6a5c3cc8c22b0c0db87a25b52746 Reviewed-on: https://go-review.googlesource.com/c/go/+/588076 Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Bypass: Ian Lance Taylor <iant@golang.org>
2024-05-24syscall: prevent redundant newline from empty $extraimportsAndy Pan
Currently mksyscall script produces one redundant newline when $extraimports is empty, leading to a gofmt warning reported by "git codereview change". Change-Id: I57b0fa040347375698973e777285deded16ab62e Reviewed-on: https://go-review.googlesource.com/c/go/+/587877 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-23all: document legacy //go:linkname for modules with ≥1,000 dependentsRuss Cox
For #67401. Change-Id: If23a2c07e3dd042a3c439da7088437a330b9caa4 Reviewed-on: https://go-review.googlesource.com/c/go/+/587222 Auto-Submit: Russ Cox <rsc@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-23all: document legacy //go:linkname for modules with ≥5,000 dependentsRuss Cox
For #67401. Change-Id: Ifea84af92017b405466937f50fb8f28e6893c8cb Reviewed-on: https://go-review.googlesource.com/c/go/+/587220 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Russ Cox <rsc@golang.org>
2024-05-23all: change from sort functions to slices functions where feasibleIan Lance Taylor
Doing this because the slices functions are slightly faster and slightly easier to use. It also removes one dependency layer. This CL does not change packages that are used during bootstrap, as the bootstrap compiler does not have the required slices functions. It does not change the go/scanner package because the ErrorList Len, Swap, and Less methods are part of the Go 1 API. Change-Id: If52899be791c829198e11d2408727720b91ebe8a Reviewed-on: https://go-review.googlesource.com/c/go/+/587655 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Commit-Queue: Ian Lance Taylor <iant@google.com> Reviewed-by: Damien Neil <dneil@google.com>
2024-05-23all: document legacy //go:linkname for modules with ≥10,000 dependentsRuss Cox
For #67401. Change-Id: I9216f01ac4dc9d239f3f20a633fd0d5072cf0a0f Reviewed-on: https://go-review.googlesource.com/c/go/+/587219 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-22all: document legacy //go:linkname for modules with ≥100,000 dependentsRuss Cox
For #67401. Change-Id: I51f5b561ee11eb242e3b1585d591281d0df4fc24 Reviewed-on: https://go-review.googlesource.com/c/go/+/587215 Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-20syscall: use internal/byteorder in plan9 directory marshaling helpersTobias Klauser
Change-Id: I277565ddb348e6a7cca18015d3d80abf0575b5a5 Reviewed-on: https://go-review.googlesource.com/c/go/+/585716 Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-17all: add push linknames to allow legacy pull linknamesCherry Mui
CL 585358 adds restrictions to disallow pull-only linknames (currently off by default). Currently, there are quite some pull- only linknames in user code in the wild. In order not to break those, we add push linknames to allow them to be pulled. This CL includes linknames found in a large code corpus (thanks Matthew Dempsky and Michael Pratt for the analysis!), that are not currently linknamed. Updates #67401. Change-Id: I32f5fc0c7a6abbd7a11359a025cfa2bf458fe767 Reviewed-on: https://go-review.googlesource.com/c/go/+/586137 Reviewed-by: Russ Cox <rsc@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-15cmd/link: disallow pull-only linknamesCherry Mui
As mentioned in CL 584598, linkname is a mechanism that, when abused, can break API integrity and even safety of Go programs. CL 584598 is a first step to restrict the use of linknames, by implementing a blocklist. This CL takes a step further, tightening up the restriction by allowing linkname references ("pull") only when the definition side explicitly opts into it, by having a linkname on the definition (possibly to itself). This way, it is at least clear on the definition side that the symbol, despite being unexported, is accessed outside of the package. Unexported symbols without linkname can now be actually private. This is similar to the symbol visibility rule used by gccgo for years (which defines unexported non-linknamed symbols as C static symbols). As there can be pull-only linknames in the wild that may be broken by this change, we currently only enforce this rule for symbols defined in the standard library. Push linknames are added in the standard library to allow things build. Linkname references to external (non-Go) symbols are still allowed, as their visibility is controlled by the C symbol visibility rules and enforced by the C (static or dynamic) linker. Assembly symbols are treated similar to linknamed symbols. This is controlled by -checklinkname linker flag, currently not enabled by default. A follow-up CL will enable it by default. Change-Id: I07344f5c7a02124dbbef0fbc8fec3b666a4b2b0e Reviewed-on: https://go-review.googlesource.com/c/go/+/585358 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Russ Cox <rsc@golang.org>
2024-05-15syscall: skip TestAmbientCapsUserns when restricted, documentMichael Stapelberg
fixes golang/go#67088 Change-Id: I42e7a8d02b161187772f147e3e136ab6e0f71d7f Reviewed-on: https://go-review.googlesource.com/c/go/+/585059 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-14syscall: use internal/byteorderTobias Klauser
Change-Id: I798729a6095494e9d0bd18d6b7d4372910056218 Reviewed-on: https://go-review.googlesource.com/c/go/+/585117 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-13syscall: don't change local limit if prlimit used for another processlifubang
Fixes: #67184 Change-Id: Ibdf3810cbba30ae29f466f7f95f357e8512f228b GitHub-Last-Rev: 5eabc760be6b89ae85629627da37b517e8ec356f GitHub-Pull-Request: golang/go#67185 Reviewed-on: https://go-review.googlesource.com/c/go/+/583299 Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-05-04syscall: remove references to SYS_syscall on openbsdJoel Sing
OpenBSD 7.5 no longer has a syscall symbol in libc. This will typically result in external linking failures since the syscall package still has a reference to an undefined `syscall' symbol. Remove these references and return ENOSYS if syscall.Syscall* or syscall.RawSyscall* are used for a system call number that does not currently have an internal remapping. Fixes #63900 Change-Id: Ic757bf8872ad98a92dd5b34cf58312c32fbc9a96 Reviewed-on: https://go-review.googlesource.com/c/go/+/582257 Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2024-05-04syscall: reroute SYS_IOCTL and SYS_SYSCTL on openbsdJoel Sing
OpenBSD 7.5 no longer supports indirect syscalls. A number of Go packages make use of syscall.Syscall with SYS_IOCTL or SYS_SYSCTL, since neither is well supported by golang.org/x/sys/unix. Reroute calls with either of these system call numbers to the respective libc stub so that they continue to work. Updates #63900 Change-Id: I3323a3fa311ee9227e6220417834253763866881 Reviewed-on: https://go-review.googlesource.com/c/go/+/582256 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-04-30syscall: use stringslite.Has{Prefix,Suffix}Tobias Klauser
Change-Id: I393191b95eeb8e17345ce28cfa1fb54a3ef13951 Reviewed-on: https://go-review.googlesource.com/c/go/+/582237 Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2024-04-19syscall/js: allocate arg slices on stack for small numbers of argsJacob
The existing implementation causes unnecessary heap allocations for javascript syscalls: Call, Invoke, and New. The new change seeks to hint the Go compiler to allocate arg slices with length <=16 to the stack. Original Work: CL 367045 - Calling a JavaScript function with 16 arguments or fewer will not induce two additional heap allocations, at least with the current Go compiler. - Using syscall/js features with slices and strings of statically-known length will not cause them to be escaped to the heap, at least with the current Go compiler. - The reduction in allocations has the additional benefit that the garbage collector runs less often, blocking WebAssembly's one and only thread less often. Fixes #39740 Change-Id: I815047e1d4f8ada796318e2064d38d3e63f73098 GitHub-Last-Rev: 36df1b33a4506e216767d8a73395f2fafdd80eba GitHub-Pull-Request: golang/go#66684 Reviewed-on: https://go-review.googlesource.com/c/go/+/576575 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-03-22syscall: export Tc{get,set}pgrp for testingJoel Sing
Provide appropriate implementations of Tc{get,set}pgrp and export these for use in the TestForeground* tests in exec_unix_test.go. This avoids calling ioctl via syscall.Syscall on BSDs. Fixes #59667 Updates #63900 Change-Id: Ice4dcedae1f0931c026bddf33043d3864a52d44e Reviewed-on: https://go-review.googlesource.com/c/go/+/572155 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Joel Sing <joel@sing.id.au>
2024-03-21cmd/internal/osinfo,runtime,syscall: use RtlGetVersion instead of ↵qmuntal
RtlGetNtVersionNumbers The RtlGetNtVersionNumbers function is not documented by Microsoft. Use RtlGetVersion instead, which is documented and available on all supported versions of Windows. Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-arm64 Change-Id: Ibaf0e2c28e673951476c5d863a829fd166705aea Reviewed-on: https://go-review.googlesource.com/c/go/+/571015 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2024-03-19internal/asan: match runtime.asan{read,write} len parameter typeTobias Klauser
The len parameter runtime.asan{read,write} is of type uintptr. Match its type in Read and Write. For #64611 Change-Id: I0be278c38a357e600521ced87c0e23038a11e8a2 Reviewed-on: https://go-review.googlesource.com/c/go/+/572755 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-03-17syscall: use internal/asan and internal/msanMauri de Souza Meneguzzo
Now with internal/asan and internal/msan available we can cleanup syscall's duplicated definitions. For #64611 Change-Id: If714d04ed2d32a4ed27305b3e3dc64ba8cdd1b61 GitHub-Last-Rev: e52fff1513bf74305d7abd142f71a60215bb93fc GitHub-Pull-Request: golang/go#65935 Reviewed-on: https://go-review.googlesource.com/c/go/+/566755 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: qiulaidongfeng <2645477756@qq.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-03-08syscall: use goarch.BigEndianTobias Klauser
Change-Id: I99e5f6fab900b0bf301f78460c618c01b231f62b Reviewed-on: https://go-review.googlesource.com/c/go/+/568956 Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-03-07net: support TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT on newer WindowsAndy Pan
Follows up CL 542275 Fixes #65817 Change-Id: I0b77c23f15d595d58492dfa20839a08e8670448b Reviewed-on: https://go-review.googlesource.com/c/go/+/565495 Reviewed-by: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
2024-03-04syscall: call internal/runtime/syscall.Syscall6 in RawSyscall6Andy Pan
For #65355 Change-Id: I9168d9a767e3b2ece65ac6dcab6827ab6f6b11bb Reviewed-on: https://go-review.googlesource.com/c/go/+/560136 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org>
2024-02-27syscall: fix typo in commentguoguangwu
Change-Id: I1804315fd3ec50ab1e3f480efd92c59e36fd47d0 GitHub-Last-Rev: 07d969ab71eabfe7034b62f45a1f4058b66ee014 GitHub-Pull-Request: golang/go#65921 Reviewed-on: https://go-review.googlesource.com/c/go/+/566615 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2024-02-26syscall: add available godoc linkcui fliter
Change-Id: I0fcb79f471cdb8b464924d9b04c675f120861f67 Reviewed-on: https://go-review.googlesource.com/c/go/+/539835 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: shuang cui <imcusg@gmail.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-21runtime: migrate internal/syscall to internal/runtimeAndy Pan
For #65355 Change-Id: I5fefe30dcb520159de565e61dafc74a740fc8730 Reviewed-on: https://go-review.googlesource.com/c/go/+/559715 Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-02-20net: add KeepAliveConfig and implement SetKeepAliveConfigAndy Pan
Fixes #62254 Fixes #48622 Change-Id: Ida598e7fa914c8737fdbc1c813bcd68adb5119c3 Reviewed-on: https://go-review.googlesource.com/c/go/+/542275 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Run-TryBot: Andy Pan <panjf2000@gmail.com> Auto-Submit: Ian Lance Taylor <iant@golang.org>
2024-02-15syscall: rm obsoleted commentKir Kolyshkin
The comment being removed is no longer true as of CL 494916. Change-Id: I4975866c58efb5c9c41db3640564ac7233f5840f Reviewed-on: https://go-review.googlesource.com/c/go/+/542415 Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2024-01-30all: fix typosJes Cok
Found by codespell. Change-Id: I2ebefbbbc8eacf9bc83051407519fa8fd5e4495f GitHub-Last-Rev: 9cc550f3dbd7c85194a58fd6858507db3e2962a9 GitHub-Pull-Request: golang/go#65346 Reviewed-on: https://go-review.googlesource.com/c/go/+/559095 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-11-27syscall: remove ptrace1 on darwinCherry Mui
On Darwin, the ptrace syscall is called in ptrace1, which then be called in ptrace. This allows ptrace1 be disabled on iOS (by implementing ptrace differently). But we can also achieve this by adding a conditional directly in ptrace. This reduces stack usage with -N -l, while keeping ptrace disabled on iOS. For #64113. Change-Id: I89d8e317e77352fffdbb5a25ba21ee9cdf2e1e20 Reviewed-on: https://go-review.googlesource.com/c/go/+/545276 Reviewed-by: Michael Knyszek <mknyszek@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-11-21internal/syscall/unix: add PidFDSendSignal for LinuxKir Kolyshkin
CL 520266 added pidfd_send_signal linux syscall numbers to the syscall package for the sake of a unit test. As pidfd_send_signal will be used from the os package, let's revert the changes to syscall package, add the pidfd_send_signal syscall numbers and the implementation to internal/syscall/unix, and change the above test to use it. Updates #51246. For #62654. Change-Id: I862174c3c1a64baf1080792bdb3a1c1d1b417bb4 Reviewed-on: https://go-review.googlesource.com/c/go/+/528436 Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com>
2023-11-21syscall: check SyscallIsNotSupported in TestPidFDWithUserNSMichael Pratt
For #51246. Change-Id: Ief2e2e14f039123a6580cb60be7ee74f4a20a649 Reviewed-on: https://go-review.googlesource.com/c/go/+/544318 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-11-21syscall: fix getting pidfd when using CLONE_NEWUSERKir Kolyshkin
While working on CL 528798, I found out that sys.PidFD field (added in CL 520266) is not filled in when CLONE_NEWUSER is used. This happens because the code assumed that the parent and the child run in the same memory space. This assumption is right only when CLONE_VM is used for clone syscall, and the code only sets CLONE_VM when CLONE_NEWUSER is not used. Fix this, and add a test case (which fails before the fix). Updates #51246. Change-Id: I805203c1369cadd63d769568b132a9ffd92cc184 Reviewed-on: https://go-review.googlesource.com/c/go/+/542698 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Michael Pratt <mpratt@google.com>
2023-11-20syscall: support O_SYNC flag for os.OpenFile on windowsJes Cok
os.OpenFile on windows did not use the O_SYNC flag. This meant that even if the user set O_SYNC, os.OpenFile would ignore it. This change adds a new flag FILE_FLAG_WRITE_THROUGH, which is the equivalent of O_SYNC flag on Linux and is documented in https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea Fixes #35358 Change-Id: Ib338caed5bb2f215723bfe30a2551a83998d92c9 GitHub-Last-Rev: 82c6275cb49602d7903b2bff7d60b7c772a5d91a GitHub-Pull-Request: golang/go#64027 Reviewed-on: https://go-review.googlesource.com/c/go/+/541015 Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Run-TryBot: Jes Cok <xigua67damn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
2023-11-10syscall: regen zsyscall_{aix_ppc64,solaris_amd64}.goTobias Klauser
This renames libc_Setrlimit to libc_setrlimit after CL 476097. Change-Id: I217043a5086cb40d050373eaee3f897173dd678b Reviewed-on: https://go-review.googlesource.com/c/go/+/538936 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
2023-11-08syscall: use fchmodat2 in FchmodatTobias Klauser
The fchmodat2 syscall was added in Linux kernel 6.6. Mirror the implementation in golang.org/x/sys/unix.Fchmodat (CL 539635) and use fchmodat2 in Fchmodat if flags are given. It will return ENOSYS on older kernels (or EINVAL or any other bogus error in some container implementations). Also update ztypes_linux_$GOARCH.go for all linux platforms to add _AT_EMPTY_PATH. It was added to linux/types in CL 407694 but was only updated for linux/loong64 at that time. Updates #61636 Change-Id: I863d06e35cd366f1cf99052e9f77c22ab8168b3f Reviewed-on: https://go-review.googlesource.com/c/go/+/540435 Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
2023-11-07syscall: provide and use ioctlPtr for all BSD platformsJoel Sing
Provide ioctlPtr for all BSD platforms, then use this for BPF. This reduces darwin specific code, as well as avoiding the use of an indirect system call on OpenBSD. Updates #63900 Change-Id: I81f3e74a3149150abe972f106903310e3cf26929 Reviewed-on: https://go-review.googlesource.com/c/go/+/540019 Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Josh Rickmar <jrick@zettaport.com>
2023-11-07syscall: provide and use fcntlPtr for all BSD platformsJoel Sing
Provide fcntlPtr for all BSD platforms, then use this for FcntlFlock. This reduces darwin and openbsd specific code, as well as avoiding the use of an indirect system call on OpenBSD. Updates #63900 Change-Id: I5c701f0d8413fab5477b9e21381395621d1fb6d0 Reviewed-on: https://go-review.googlesource.com/c/go/+/540018 Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Josh Rickmar <jrick@zettaport.com>
2023-11-06syscall: fix syntax error in mkall.shTobias Klauser
Fix the following error introduced by CL 518627: ./mkall.sh: line 370: syntax error near unexpected token `)' ./mkall.sh: line 370: `openbsd_riscv64)' Change-Id: I044563759bf07c94840f2024734d32a0ad663aab Reviewed-on: https://go-review.googlesource.com/c/go/+/538935 Reviewed-by: Joel Sing <joel@sing.id.au> Reviewed-by: Heschi Kreinick <heschi@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-11-02syscall: copy rlimit.go's build constraint to rlimit_test.goDmitri Shuralyov
Tests in rlimit_test.go exist to test the behavior of automatically bumping RLIMIT_NOFILE on Unix implemented in rlimit.go (issue #46279), with darwin-specific behavior split out into rlimit_darwin.go and the rest left empty in rlimit_stub.go. Since the behavior happens only on Unix, it doesn't make sense to test it on other platforms. Copy rlimit.go's 'unix' build constraint to rlimit_test.go to accomplish that. Also simplify the build constraint in rlimit_stub.go while here, so that its maintenance is easier and it starts to match all non-darwin Unix GOOS values (previously, 'hurd' happened to be missed). In particular, this fixes a problem where TestOpenFileLimit was failing in some environments when testing the wasip1/wasm port. The RLIMIT_NOFILE bumping behavior isn't implemented there, so the test was testing the environment and not the Go project. Updates #46279. For #61116. Change-Id: Ic993f9cfc021d4cda4fe3d7fed8e2e180f78a2ca Reviewed-on: https://go-review.googlesource.com/c/go/+/539435 Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2023-11-02syscall: call getfsstat via libc on openbsdJoel Sing
On openbsd, call getfsstat directly via libc, instead of calling it via syscall.Syscall. Updates #63900 Change-Id: Ib4c581160b170e6cc6017c42e959e647d97ac993 Reviewed-on: https://go-review.googlesource.com/c/go/+/538736 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Josh Rickmar <jrick@zettaport.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Joel Sing <joel@sing.id.au>
2023-11-01syscall: regen zsyscall for openbsd/riscv64Joel Sing
This removes the unused writelen function, which was cleaned up for other platforms in CL#529035. Change-Id: I1999dc81276763bdc73d8590c16729447c4e8538 Reviewed-on: https://go-review.googlesource.com/c/go/+/538119 Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Joel Sing <joel@sing.id.au>
2023-11-01syscall: regenerate zsyscall for dragonfly/freebsd/netbsdJoel Sing
The sysctl declaration was moved in CL 141639, however the files were presumably not regenerated. There is no functional change, however regenerating avoids unrelated noise in future diffs. Change-Id: Ifb840b5853f3f1c3c88a3f94df21b6f6d3c635d4 Reviewed-on: https://go-review.googlesource.com/c/go/+/538118 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-10-20syscall: stop counting trailing NUL for abstract addresses starting with NULF Y
Changes trailing-NUL-counting behavior for abstract addresses starting with the NUL character to be the same as abstract addresses starting with the @ character. For #63579. Change-Id: I206e4d0d808396998cb7d92a9e26dda854cb1248 GitHub-Last-Rev: 0ff0a9c938a4b57cdc30b1c4f0c058108a241df8 GitHub-Pull-Request: golang/go#63580 Reviewed-on: https://go-review.googlesource.com/c/go/+/535776 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-10-04syscall: add syscall support for openbsd/riscv64 portJoel Sing
Updates #55999 Change-Id: I5b8452207e951e543b9be42ebcb7d62c0c023f08 Reviewed-on: https://go-review.googlesource.com/c/go/+/518627 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Aaron Bieber <deftly@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>