RandyTheSilly
52f0c297f4
Apply patch
v0.45.0
2026-05-29 17:31:12 -04:00
Yan Zhu
397d5f8092
unix: update to Linux kernel 7.0
...
Change-Id: I2e77f6fa2ac141018c4fe5cba2c8615c9e05d99c
GitHub-Last-Rev: 5d46d8f28324b6815de69e4f81b405c9911bd05a
GitHub-Pull-Request: golang/sys#274
Reviewed-on: https://go-review.googlesource.com/c/sys/+/779140
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com >
Reviewed-by: Junyang Shao <shaojunyang@google.com >
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
2026-05-21 11:00:51 -07:00
Tobias Klauser
0a387f7a07
cpu: detect zbc extension on riscv64
...
Change-Id: Icdd4c279693c67982f37c80a891ecadda8ec108a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/776280
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Keith Randall <khr@golang.org >
Reviewed-by: Keith Randall <khr@google.com >
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
2026-05-20 12:31:28 -07:00
Guoqi Chen
758f71cb83
cpu: add LLACQ_SCREL, SCQ, DBAR_HINTS detection for loong64
...
These three feature detections have been implemented in the Go mainline.
Change-Id: I9c264f7dac0630931d851c04f904d4365d70a28b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/779781
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Meidan Li <limeidan@loongson.cn >
Reviewed-by: David Chase <drchase@google.com >
Reviewed-by: Michael Pratt <mpratt@google.com >
Auto-Submit: abner chenc <chenguoqi@loongson.cn >
2026-05-20 06:06:04 -07:00
Ian Lance Taylor
99666ae32e
unix: merge Linux readv/writev implementation with Darwin/OpenBSD
...
This reduces some code duplication.
Change-Id: Ib648f90a26960d0bc25d2fe27e9b3fb1419ac02d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/777161
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
Auto-Submit: Ian Lance Taylor <iant@golang.org >
2026-05-18 07:51:52 -07:00
Alex Dubov
e4444cbaaa
windows: add NtSetEaFile, NtQueryEaFile and NtQueryInformationFile
...
unix package already provides support for working with file extended
attributes via Fsetxattr and Fgetxattr syscalls. Windows offers a similar
feature implemented by means of NtSetEaFile and NtQueryEaFile syscalls.
Those syscalls are provided by this patch.
Additionally, NtQueryInformationFile syscall is added. It is required
for correct implementation of extended attribute support in library
code, as correct invocation of NtQueryEaFile relies on file information
returned by said syscall. It also amends the previously accepted
NtSetInformationFile syscall.
Fixes golang/go#78672
Change-Id: Ia4ba037eb2777ba02a953a57ec1d365aad17cac5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/766800
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
2026-05-13 22:59:11 -07:00
Aaqa Ishtyaq
04396e85d4
unix: add Readv, Writev, Preadv, Pwritev for OpenBSD
...
Add OpenBSD libc syscall wrappers for vectored I/O, and share the
existing Darwin wrapper implementation and tests.
Fixes golang/go#78049
Change-Id: Ie2743ef36a5cb73b05cc551c9c1108503f5992b6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/771300
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
Auto-Submit: Ian Lance Taylor <iant@golang.org >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
2026-05-12 12:53:07 -07:00
Damien Neil
fb1facd76f
windows: avoid uint16 overflow in NewNTUnicodeString
...
Fixes CVE-2026-39824
Fixes #78916
Change-Id: I344518a17d59fd81c4bb39da0b3e13be6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/sys/+/770080
Reviewed-by: Neal Patel <nealpatel@google.com >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Auto-Submit: Damien Neil <dneil@google.com >
2026-04-23 08:37:02 -07:00
database64128
94ad893e1e
windows: add GetIfTable2Ex, GetIpInterface{Entry,Table}, GetUnicastIpAddressTable
...
GetIfTable2Ex retrieves the MIB-II interface table.
GetIpInterfaceEntry retrieves IP information for the specified interface.
GetIpInterfaceTable retrieves the IP interface entries.
GetUnicastIpAddressTable retrieves the unicast IP address table.
Change-Id: If9f619cb48da204da3bac8b429b3231432337b0a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/744880
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Damien Neil <dneil@google.com >
Reviewed-by: Carlos Amedee <carlos@golang.org >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
2026-04-22 23:12:39 -07:00
Alex Brainman
54fe89f841
cpu: use IsProcessorFeaturePresent to calculate ARM64 on windows
...
This CL started as revert of CL 757482.
Fixes golang/go#76791
Change-Id: Iaa78c73a6dde8d735e74e2c57c86375ccd5902c7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/758960
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Reviewed-by: David Chase <drchase@google.com >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2026-04-13 18:36:34 -07:00
Mark Ryan
df7d5d7b60
unix: automatically remove container created by mkall.sh
...
When GOOS=linux, mkall.sh creates a container to run linux/mkall.go. It does not
remove this container before exiting. Therefore each time you run mkall.sh on Linux
you end up with a new stopped container that must be manually deleted with docker rm.
This is cumbersome as it may take several runs of mkall.sh to develop and test a patch
for golang/x/sys/unix resulting in multiple containers that require manual removal.
It's also a little counterintuitive as the user doesn't invoke the docker command directly
so it's not obvious that manual cleanup is required after mkall.sh completes. The
leftover containers aren't even that useful for debugging as they have an entrypoint
set.
Change-Id: I92a94ae53078f0095d3ddf1d95c4879f1bc1cb2a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/513335
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: David Chase <drchase@google.com >
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com >
Reviewed-by: Junyang Shao <shaojunyang@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
2026-04-10 14:19:47 -07:00
Tobias Klauser
68a4a8e945
unix: avoid nil pointer dereference in Utime
...
Passing a nil buf *Utimbuf to Utime on linux/{arm,arm64,loong64,riscv64}
will cause a nil pointer dereference. Check buf explicitly to avoid this
case.
Change-Id: Ifb719f83029002f043919daa066af6b1fb4ebe03
Reviewed-on: https://go-review.googlesource.com/c/sys/+/764562
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: David Chase <drchase@google.com >
2026-04-10 02:58:23 -07:00
Kir Kolyshkin and Claude Sonnet 4.5
690c91f6ec
unix: add CPUSetDynamic for systems with more than 1024 CPUs
...
The existing CPUSet type is a fixed-size array limited to 1024 CPUs,
which makes it problematic to use for large systems (such as Google's
X4 instances with 1440 and 1920 vCPUs), see e.g.
https://github.com/opencontainers/runc/issues/5023 .
Introduce CPUSetDynamic type and NewCPUSet constructor to support large
systems. The bit-managing routines (set/clear/isset/fill/count) are
separated and reused.
Add variants of SchedGetaffinity, SchedSetaffinity and SetMemPolicy
that accept the new type.
Amend the documentation for CPUSet.
Amend the existing TestSchedSetaffinity to:
- test set.Fill;
- use t.Cleanup to restore the affinity.
Add tests for new functionality (mostly a copy of existing tests).
This is an alternative to CL 727540 / CL 727541.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
Change-Id: I51bba0305b8dfa7a88a4e7fb8758d73f798574f1
Reviewed-on: https://go-review.googlesource.com/c/sys/+/735380
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: David Chase <drchase@google.com >
Reviewed-by: Michael Pratt <mpratt@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2026-04-08 16:32:30 -07:00
qmuntal
f33a730cd0
windows: support nil security descriptor on GetNamedSecurityInfo
...
GetNamedSecurityInfoW may return a nil security descriptor when the
object exists but has no security descriptor. This change allows
GetNamedSecurityInfo to return a nil *SECURITY_DESCRIPTOR in that case,
instead of crashing when trying to copy the nil security descriptor.
Fixes golang/go#78396
Change-Id: I2f8d26a431e0a5c3de535cf8983db1465acc24fe
Reviewed-on: https://go-review.googlesource.com/c/sys/+/760160
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Damien Neil <dneil@google.com >
2026-03-27 09:08:41 -07:00
Dmitri Shuralyov
493d172598
cpu: add runtime import in cpu_darwin_arm64_other.go
...
It was missed in CL 737260.
For golang/go#43046 .
Change-Id: I05194333831ad04e43e22b7b34362fe01f50c000
Reviewed-on: https://go-review.googlesource.com/c/sys/+/759160
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Keith Randall <khr@google.com >
Reviewed-by: Egon Elbre <egonelbre@gmail.com >
Reviewed-by: Keith Randall <khr@golang.org >
2026-03-25 23:02:52 -07:00
qmuntal
2c2be756b9
windows: use syscall.SyscallN in Proc.Call
...
All the SyscallX functions are deprecated in favor of SyscallN. The
latter is easier to use, supports more arguments, and uses less stack.
Autogenerated wrappers already switch to SyscallN in https://go-review.googlesource.com/c/sys/+/691715 .
Fixes golang/go#78317
Change-Id: I7e56e713d1c20558e9932d757299796836c9c04f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/758700
Reviewed-by: Damien Neil <dneil@google.com >
Auto-Submit: Quim Muntal <quimmuntal@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
2026-03-24 10:52:03 -07:00
Dmitri Shuralyov
a76ec62d6c
cpu: roll back "use IsProcessorFeaturePresent to calculate ARM64 on windows"
...
Roll back CL 740880 (commit fc646e489f )
because it adds a golang.org/x/sys/windows import to the cpu package.
The cpu package is vendored into the main Go tree and the policy there
does not currently permit this dependency.
For golang/go#76791 .
Fixes golang/go#78259 .
Change-Id: I72860cdf98192f4cbd2b3398926203a752d8d0fe
Cq-Include-Trybots: luci.golang.try:x_sys-gotip-windows-arm64
Reviewed-on: https://go-review.googlesource.com/c/sys/+/757482
Reviewed-by: Michael Pratt <mpratt@google.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org >
2026-03-20 13:12:12 -07:00
gremat
eaaaaee1dc
windows/registry: correct KeyInfo.ModTime calculation
...
Filetime.Nanoseconds() has a major drawback: the returned int64 is too small to
represent Filetime's zero value (January 1, 1601, [1]) in terms of nanoseconds
since Epoch (00:00:00 UTC, January 1, 1970); MinInt64 [2] only dates back to
year 1677.
This has real-life implications, e.g., some Windows sub systems (Perflib, to
name one) create registry keys with the last write time property set to
zero (see note below). In this case, ModTime() reports an underflow-affected
value of 2185-07-22T00:34:33.709551+01:00.
This commit drops usage of Nanoseconds() in favor of a conversion that converts
first to seconds and nanoseconds before gauging thus is capable to cover the
full range of Filetime values.
A note on last write time values: `lastWriteTime` is not exposed in the UI
(say, `regedit`) or in PowerShell (`Get-ItemProperty`), you need to query
`RegQueryInfoKeyA` [3] explicitly in some way [4] or another [5]. The source of
the latter is offline by now but can be found elsewhere [6] and provides a
quick way to show the value.
[1] https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime
[2] https://pkg.go.dev/math#pkg-constants
[3] https://learn.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regqueryinfokeya?redirectedfrom=MSDN
[4] https://learn.microsoft.com/en-us/windows/win32/sysinfo/retrieving-the-last-write-time
[5] https://learn-powershell.net/2014/12/18/retrieving-a-registry-key-lastwritetime-using-powershell/
[6] https://github.com/wxrdnx/GetRegistryKeyLastWriteTimeAndClassName
Fixes golang/go#74335 .
Change-Id: I83dc1d6b5e0c581bfb53d58ee08a21ed9c166b0f
GitHub-Last-Rev: 0073d1d313b2c986360f3a06ffeceb6b331c0d9a
GitHub-Pull-Request: golang/sys#251
Reviewed-on: https://go-review.googlesource.com/c/sys/+/682816
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Russ Cox <rsc@golang.org >
Reviewed-by: David Chase <drchase@google.com >
2026-03-02 17:51:03 -08:00
Egon Elbre
942780bbc1
cpu: darwin/arm64 feature detection
...
The ARM64 flags were not being correctly set for Mac M series laptops.
Fixes golang/go#43046
Change-Id: I1d884dccd3f3a0a010ad7babbab26b73731ab583
Reviewed-on: https://go-review.googlesource.com/c/sys/+/737260
Auto-Submit: Keith Randall <khr@golang.org >
Reviewed-by: Keith Randall <khr@google.com >
Reviewed-by: Keith Randall <khr@golang.org >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: David Chase <drchase@google.com >
2026-03-02 13:52:18 -08:00
Skye Soss
acef38879e
unix/linux: Prefixmsg and PrefixCacheinfo structs
...
These structs and enumeration constants are used
to parse RTM_NEWPREFIX netlink messages.
Fixes golang/go#77662
Change-Id: I1e7a92e771701c0c790c15e58ad78cd8fe1e5cf5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/746420
Reviewed-by: Mark Freeman <markfreeman@google.com >
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Junyang Shao <shaojunyang@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com >
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
2026-02-18 12:31:42 -08:00
Nuno Cruces
3687fbd716
cpu: better defaults on darwin ARM64
...
This is motivated by
https://github.com/wazero/wazero/pull/2473
which needs to special case darwin for testing the availability of
HasATOMICS, although all M-series CPUs support it.
We could do sysctlbyname, like syscall_darwin_x86_gc.go, if that's
preferred:
https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics
Change-Id: I0f5ea55ef5cda4956db44b2d40f2f10044fa3321
GitHub-Last-Rev: d5d0f1e989579de2a25c97c00c7e9db5d4b0cb29
GitHub-Pull-Request: golang/sys#267
Reviewed-on: https://go-review.googlesource.com/c/sys/+/743320
Auto-Submit: Keith Randall <khr@golang.org >
Reviewed-by: Keith Randall <khr@golang.org >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Keith Randall <khr@google.com >
Reviewed-by: Junyang Shao <shaojunyang@google.com >
2026-02-12 09:29:35 -08:00
Alex Brainman
48062e9b9a
plan9: change Note to alias syscall.Note
...
This CL changes Note type from string to alias syscall.Note to make Note useful.
For golang/go#77076 .
Change-Id: Ifb0292a6867ced95bb7e6c20877564cd527c1183
Reviewed-on: https://go-review.googlesource.com/c/sys/+/736480
Reviewed-by: Austin Clements <austin@google.com >
Reviewed-by: David du Colombier <0intro@gmail.com >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
Reviewed-by: Richard Miller <millerresearch@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
2026-02-11 17:50:06 -08:00
Alex Brainman
4f23f804ed
windows: change Signal to alias syscall.Signal
...
This CL changes Signal type from int to alias syscall.Signal
to make Signal useful. In particular, you can pass windows.SIGINT
to signal.Notify to produce behaviour similar to os.Interrupt and
syscall.SIGINT.
For golang/go#77076 .
Change-Id: Ie9243c30063e777f9898eba6d649c248a7f48fc5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/735920
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
Reviewed-by: Austin Clements <austin@google.com >
2026-02-11 16:11:37 -08:00
Gopher Robot
7548802db4
all: upgrade go directive to at least 1.25.0 [generated]
...
By now Go 1.26.0 has been released, and Go 1.24 is no longer supported
per the Go Release Policy (see https://go.dev/doc/devel/release#policy ).
See go.dev/doc/godebug#go-125 for GODEBUG changes relevant to Go 1.25.
For golang/go#69095 .
[git-generate]
(cd . && go get go@1.25 .0 && go mod tidy)
Change-Id: I6f0b6206f561c77aa9579e2e39eb5a5d880f5a66
Reviewed-on: https://go-review.googlesource.com/c/sys/+/744460
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Auto-Submit: Gopher Robot <gobot@golang.org >
Reviewed-by: Junyang Shao <shaojunyang@google.com >
Reviewed-by: Michael Pratt <mpratt@google.com >
2026-02-11 11:14:51 -08:00
Alex Brainman
fc646e489f
cpu: use IsProcessorFeaturePresent to calculate ARM64 on windows
...
For golang/go#76791
Change-Id: I9500b38b17b5e3e141df8770d82c725c2ba8fd65
Cq-Include-Trybots: luci.golang.try:x_sys-gotip-windows-arm64
Reviewed-on: https://go-review.googlesource.com/c/sys/+/740880
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: Michael Pratt <mpratt@google.com >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
2026-02-07 21:32:41 -08:00
Alex Brainman
f11c7bb268
windows: add IsProcessorFeaturePresent and processor feature consts
...
For golang/go#76791
Change-Id: I1594c4868262c78d40e1ebd883a01a71236e4981
Reviewed-on: https://go-review.googlesource.com/c/sys/+/740500
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: Carlos Amedee <carlos@golang.org >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2026-01-31 15:25:24 -08:00
Tobias Klauser
d25a7aaff8
unix: add IoctlSetString on all platforms
...
Currently, only solaris provides IoctlSetString. However, it might be
useful on other platforms too, e.g. for SIOCBRADDBR on linux.
Change-Id: I19ed47a3e4ed0180ba6777bc193e32bfb61c0506
Reviewed-on: https://go-review.googlesource.com/c/sys/+/720200
Reviewed-by: Michael Pratt <mpratt@google.com >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com >
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 >
2026-01-16 14:09:47 -08:00
HuShuai
6fb913b30f
unix: return early on error in Recvmsg
...
Currently, Recvmsg may access the rsa buffer even if the underlying syscall
returns an error.
This change aligns Recvmsg with the safer logic already
used in RecvmsgBuffers, ensuring the address is only processed when
the syscall succeeds (err == nil).
Fixes golang/go#76848
Change-Id: If76477d0362b802e54ee6d27d0e8f57024a8a1dc
Reviewed-on: https://go-review.googlesource.com/c/sys/+/734740
Reviewed-by: Junyang Shao <shaojunyang@google.com >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Auto-Submit: Ian Lance Taylor <iant@golang.org >
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com >
Reviewed-by: Michael Pratt <mpratt@google.com >
2026-01-09 08:08:59 -08:00
khr@golang.org
2f44229755
sys/cpu: add symbolic constants for remaining cpuid bits
...
Change-Id: Ia6afa8f69598fc929c1ea21465e656b5a95e656e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/731322
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Keith Randall <khr@google.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
2025-12-19 08:52:28 -08:00
khr@golang.org
e5770d27b7
sys/cpu: use symbolic names for masks
...
Masks declarations are copied from internal/cpu. All the 1<<N masks
that have a corresponding named constant are swapped out.
Change-Id: I6cfb053179a16611f4404719d92c182464a67d7f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/731321
Reviewed-by: Cherry Mui <cherryyz@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Keith Randall <khr@google.com >
2025-12-19 08:52:22 -08:00
khr@golang.org
714a44c845
sys/cpu: modify x86 port to match what internal/cpu does
...
The way we call isSet is different in the two. Normalize x/sys
to match internal/cpu.
This was done using (mostly) gopls' quick fix, to ensure we
don't miss any of the transpositions.
Change-Id: I0b66152e194d46ed9299550e12641cc798f8b11b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/731320
Reviewed-by: Cherry Mui <cherryyz@google.com >
Reviewed-by: Keith Randall <khr@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2025-12-19 08:52:16 -08:00
Florian Zenker
08e54827f6
unix: fix out of bounds memory access in tests
...
sockaddrIUCVToAny used the wrong size to for copying to RawSockaddrAny.
We found this by running the test with ASAN.
Change-Id: I2a2ec28f9bd55aeba4ddcb4243ad61ec010087df
Reviewed-on: https://go-review.googlesource.com/c/sys/+/724280
Reviewed-by: Michael Stapelberg <stapelberg@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2025-11-25 07:35:26 -08:00
Cherry Mui
4f4f1c6fea
Revert "cpu: add HPDS, LOR, PAN detection for arm64"
...
This reverts CL 704075.
Reason for revert: Based on golang/go#76386 , it doesn't seem to work correctly.
Fixes golang/go#76386 .
Change-Id: I51ccbc8715c25c0d061d56dfbf0e8158f1207018
Reviewed-on: https://go-review.googlesource.com/c/sys/+/724160
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
Auto-Submit: Cherry Mui <cherryyz@google.com >
2025-11-24 15:42:25 -08:00
Tobias Klauser
ca631161e4
unix: add IOCTL_MEI_* constants
...
Change-Id: I4efea3d97ae21ea81758e492cabc980b48e5d4c2
Reviewed-on: https://go-review.googlesource.com/c/sys/+/718440
Reviewed-by: Junyang Shao <shaojunyang@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: Michael Pratt <mpratt@google.com >
2025-11-12 10:01:23 -08:00
Benny Siegert
a4199c0bfe
unix: fix definition of Statvfs_t for netbsd-arm.
...
This will fix the test failure on the netbsd-arm builder, but it is not
quite a real fix.
struct statvfs changed between NetBSD 9 and NetBSD 10, with notably the
"spare" member switching from [4]uint32 to [4]uint64. In addition, there
is a new member at the end with label information, if available. The
netbsd-arm builder runs on NetBSD 10, so it runs into an issue
casting the binary data into a Statvfs_t with the wrong padding.
I don't know why the issue does not happen on arm64.
It does not happen on 386 and amd64 because these builders are running
NetBSD 9 still.
The real fix would be to use the statvfs90 compat syscall on NetBSD 10
and up, but not on 9 and below.
Fixes golang/go#76097 .
Change-Id: I57ce6651d0ba05027a9fb29ee84c72a5225bcd67
Reviewed-on: https://go-review.googlesource.com/c/sys/+/717100
Run-TryBot: Benny Siegert <bsiegert@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2025-11-09 22:33:32 -08:00
Tobias Klauser
15129aafc3
cpu: also use MRS instruction in getmmfr1
...
Use the MRS instruction with the corresponding system register instead
of encoding the instructions using a WORD directive. This was missed in
CL 583135.
Change-Id: Ifcbbd81baa903f1da442eae2e49c06284db9c37d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/717681
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
Reviewed-by: Michael Pratt <mpratt@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2025-11-04 13:29:36 -08:00
Tobias Klauser
ed38ca2d41
unix: add SizeofNhmsg and SizeofNexthopGrp
...
These were missed in CL 227357.
For golang/go#38249
Change-Id: Iab75145ae77a027e11bc4cad75300af0a510a537
Reviewed-on: https://go-review.googlesource.com/c/sys/+/716780
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
Reviewed-by: Michael Pratt <mpratt@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com >
2025-11-04 13:29:33 -08:00
Tobias Klauser
3675c4cc48
cpu: use MRS instruction to read arm64 system registers
...
Use the MRS instruction with the corresponding system register instead
of encoding the instructions using a WORD directive.
Change-Id: I2995dfa6ad731cb03867160127db84898adfdda5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/583135
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
Reviewed-by: David Chase <drchase@google.com >
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com >
2025-10-31 12:39:58 -07:00
Florian Lehner
2a15272850
unix: add consts for ELF handling
...
This adds a few constants that help to handle ELF files and coredumps.
Change-Id: Ifd4c1bd4c8839065af4233ccbf42964a8e96fdf8
Reviewed-on: https://go-review.googlesource.com/c/sys/+/713980
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
Reviewed-by: Sean Liao <sean@liao.dev >
Auto-Submit: Sean Liao <sean@liao.dev >
Reviewed-by: David Chase <drchase@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2025-10-29 13:35:45 -07:00
Chongyi Zheng
6239615695
cpu: add HPDS, LOR, PAN detection for arm64
...
This CL gets ID_AA64MMFR1_EL1, Memory Model Feature Register 1, and
grabs HPDS, LOR, PAN features from its bits.
Fixes golang/go#75472 .
Change-Id: Ic04b109d79aceba9b3b1d3a1ea514fcf132007c5
GitHub-Last-Rev: f938ff468bca49cc7863aa26e7a880eec2823bb4
GitHub-Pull-Request: golang/sys#263
Reviewed-on: https://go-review.googlesource.com/c/sys/+/704075
Reviewed-by: Keith Randall <khr@google.com >
Auto-Submit: Keith Randall <khr@golang.org >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Keith Randall <khr@golang.org >
2025-10-28 09:43:50 -07:00
database64128
ea436ef09d
windows: add iphlpapi routing functions
...
NotifyRouteChange2 registers to be notified for changes to IP route
entries. Call GetIpForwardEntry2 on received row to retrieve complete
information.
GetIpForwardTable2 retrieves the full routing table.
FreeMibTable frees the buffer allocated by the functions that return
tables of network interfaces, addresses, and routes.
Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/695195
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
Reviewed-by: Michael Pratt <mpratt@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2025-10-21 11:10:28 -07:00
Kir Kolyshkin
28c5bda5d4
unix: add SetMemPolicy and its mode/flag values
...
This reuses CPUSet type as it fits perfectly.
No GetMemPolicy support yet.
Change-Id: I549361bc1ed95ee73fd38d00277ec0f9f348a9ba
Reviewed-on: https://go-review.googlesource.com/c/sys/+/706917
Auto-Submit: Michael Pratt <mpratt@google.com >
Reviewed-by: Antti Kervinen <antti.kervinen@gmail.com >
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Michael Pratt <mpratt@google.com >
Reviewed-by: Carlos Amedee <carlos@golang.org >
2025-10-08 14:29:03 -07:00
Kir Kolyshkin
b731f782ac
unix/linux: switch to ubuntu 25.04, Go 1.25.1
...
Ubuntu 24.10 is not supported since July 2025 (and some of its apt repos
are apparently removed), and so mkall.sh no longer works (as of today).
Fix this by switching to (currently supported) Ubuntu 25.04.
NOTE that we can't switch to
- Ubuntu 24.04 LTS release (see CL 618075);
- Ubuntu 25.10 as it lacks mips support;
- Debian Stable (13) as it also lacks mips support.
Also, bump Go to 1.25.1.
No changes in generated content after running
GOOS=linux GOARCH=amd64 ./mkall.sh
Change-Id: I58a4856cda93a85af51f4a519c6e4e25f31a39b4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/706915
Reviewed-by: Sean Liao <sean@liao.dev >
Reviewed-by: Michael Pratt <mpratt@google.com >
Reviewed-by: Carlos Amedee <carlos@golang.org >
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Auto-Submit: Michael Pratt <mpratt@google.com >
2025-10-08 14:29:00 -07:00
Kir Kolyshkin
1edeebeea0
unix: mkall.sh: fail if docker build failed
...
When docker build fails, docker run (in my case podman) tries to find
the generate:linux image from various mirrors, which is very confusing.
We should error out if docker build fails.
Change-Id: I4fd78e9fa339e03029b1bf003b3239ca23a7ed1b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/706916
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Auto-Submit: Kirill Kolyshkin <kolyshkin@gmail.com >
Reviewed-by: Junyang Shao <shaojunyang@google.com >
Reviewed-by: Sean Liao <sean@liao.dev >
Reviewed-by: Carlos Amedee <carlos@golang.org >
2025-10-02 13:28:30 -07:00
Tobias Klauser
ecada54126
unix: use slices.{Equal,Sort} in tests
...
Same as CL 587655 and CL 690475 did for package syscall tests.
Change-Id: Ie3c8726a4e2c859b5d7992ea1baec14083b9fdba
Reviewed-on: https://go-review.googlesource.com/c/sys/+/708558
Reviewed-by: Junyang Shao <shaojunyang@google.com >
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com >
Reviewed-by: Carlos Amedee <carlos@golang.org >
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Sean Liao <sean@liao.dev >
2025-10-02 11:15:31 -07:00
qmuntal
5e63aa5e0f
windows: export O_FILE_FLAG_* to be used in os.OpenFile on windows
...
These file flags are supported by os.OpenFile since CL 699415.
Closes golang/go#73676
Change-Id: Iaf846c9cb98c1458bbc30d05ad8a331ef1f332df
Reviewed-on: https://go-review.googlesource.com/c/sys/+/700975
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Damien Neil <dneil@google.com >
Reviewed-by: Junyang Shao <shaojunyang@google.com >
2025-09-26 11:36:48 -07:00
Aleksa Sarai
033906b9f0
unix: add (*CPUSet).Fill helper to enable all CPUs
...
Some programs (such as container runtimes) want to reset their CPU
affinity if they are spawned by processes with a particular CPU
affinity. Container runtimes didn't really have to deal with this issue
until Linux 6.2 when the cpuset cgroup was changed to no longer
auto-reset CPU affinity in this case.
A naive approach to resetting your CPU affinity would be to get the
number of CPUs by looking at "/proc/stat" or "/sys/devices/system/cpu"
(note that runtime.NumCPU() actually returns the CPU affinity of the
process at startup time, which isn't useful for this purpose) and then
asking for all of those CPUs.
However, sched_setaffinity(2) will silently ignore any CPU bits set in
the provided CPUSet if they do not exist or are not enabled in the
cpuset cgroup of the process. This means that you can reset your CPU
affinity by just setting every CPU bit in CPUSet and passing it to
sched_setaffinity(2).
Unfortunately, setting every CPU bit in CPUSet with (*CPUSet).Set() is
very inefficient. If it were possible to just memset(0xFF) the CPUSet
array, users would be able to reset their CPU affinity even more
cheaply. However, Go doesn't have a memset primitive that can be used in
that way.
Obvious solutions like setting the array elements of CPUSet to (^0) do
not work because CPUSet is an array of a private newtype and so the
compiler complains if you try to use a constant like (^0) without a
cast (and we cannot use a cast because the type is private):
cannot use ^0 (untyped int constant -1) as
"golang.org/x/sys/unix".cpuMask value in assignment (overflows)
The only real alternative is to do something quite hacky like:
cpuset := unix.CPUSet{}
for i := range cpuset {
cpuset[i]-- // underflow to 0xFF..FF
}
... which is the solution we use in runc.
It would be much nicer to have a helper that does this memset for us in
a less hacky way, since resetting CPU affinity seems like a fairly
common operation.
Ref: Linux kernel commit da019032819a ("sched: Enforce user requested affinity")
Fixes golang/go#75186
Change-Id: I211ddeafd54ce35079a67493123d28e1bb76966a
GitHub-Last-Rev: 71871db0f339f154dea6ac4d545237f08f70a301
GitHub-Pull-Request: golang/sys#259
Reviewed-on: https://go-review.googlesource.com/c/sys/+/698015
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Kirill Kolyshkin <kolyshkin@gmail.com >
Reviewed-by: Junyang Shao <shaojunyang@google.com >
Reviewed-by: Cherry Mui <cherryyz@google.com >
2025-09-26 10:17:15 -07:00
Ayman Bagabas
6be6c584a2
windows: add FlushConsoleInputBuffer and GetNumberOfConsoleInputEvents
...
This adds syscall wrappers for FlushConsoleInputBuffer and GetNumberOfConsoleInputEvents on Windows.
Change-Id: I2365aebc42a57f83cfc951e10520270e1f3e0606
GitHub-Last-Rev: 1f711a5f3c2b09b6bc74160f0fc7c54a0247be14
GitHub-Pull-Request: golang/sys#264
Reviewed-on: https://go-review.googlesource.com/c/sys/+/704715
Reviewed-by: Mark Freeman <markfreeman@google.com >
Auto-Submit: Sean Liao <sean@liao.dev >
Reviewed-by: Quim Muntal <quimmuntal@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
2025-09-18 15:33:41 -07:00
Kir Kolyshkin
32e203842b
unix: use Go 1.21+ clear built-in
...
Inspired by CL 698495.
Change-Id: Ic6ff68a60d41b6ffb6a28f523597c5d36c1e4d2f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/704915
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Sean Liao <sean@liao.dev >
Reviewed-by: Mark Freeman <markfreeman@google.com >
2025-09-18 13:57:09 -07:00
Thomas Klausner
137f2eda35
sys: add support for NetBSD getvfsstat
...
NetBSD replaced the getfsstat interface with getvfsstat in NetBSD 3.0.
Add a test for it.
With help from Benny Siegert and Ian Lance Taylor.
Change-Id: I115ae48c287cc32181006e9e8f7c15851e7e36c0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/550476
Reviewed-by: Cherry Mui <cherryyz@google.com >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
Reviewed-by: Benny Siegert <bsiegert@gmail.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Auto-Submit: Benny Siegert <bsiegert@gmail.com >
Auto-Submit: Ian Lance Taylor <iant@golang.org >
2025-09-17 07:50:20 -07:00