Commit Graph

680 Commits

Author SHA1 Message Date
Brad Fitzpatrick
953cdadca8 unix: add unexported name_to_handle_at and open_by_handle_at types & wrappers
No usable change for users in this CL; just auto-generated syscall
wrapper funcs & types.

The next CL will have hand-written code adding the nice Go API around
these unexported symbols. (as outlined in the comment at
https://golang.org/issue/30537#issuecomment-470284573)

Updates golang/go#30537

Change-Id: I5e34df517efcf509fff97f670425500cc6608d59
Reviewed-on: https://go-review.googlesource.com/c/sys/+/172584
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-04-22 16:51:55 +00:00
Clément Chigot
e8e3143a4f unix: add Unmount syscall for AIX
Change-Id: I86f33df28b844746617a47b01fb888f4b434564a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/172897
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-19 15:35:24 +00:00
Clément Chigot
f0ce4c0180 unix: add Select syscall on AIX
As select is a keyword of Go, C.select cannot be used on gccgo files.
Therefore, select call is transformed into c_select.

Change-Id: Ic68a7ffa03dc5a5d70514876b5f6afb565691a4a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/172739
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-18 15:33:12 +00:00
chigotc
d20716ef9d unix: use nsendmsg and nrecvmsg on AIX
This is the x/sys/unix patch of CL 170537.

This patches has regenerated some files which have been therefore
updated. That's why Getsystemcfg is also added in zsyscall_aix_ppc.go

Change-Id: I4aade3e0e2e29cef13b1c8018a57100712eabb50
Reviewed-on: https://go-review.googlesource.com/c/sys/+/172259
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-18 15:05:32 +00:00
Tobias Klauser
12500544f8 unix: fix cmsg alignment on aix
This was missing from CL 171941.

Change-Id: I14f16355b2fe18103d2713faf2bebf004248fc0c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/172257
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-16 15:28:02 +00:00
chigotc
ebb4019f01 unix: move helper handler before AIX handler in TestPassFD
The AIX special handler which skips this test if unix network isn't
supported, doesn't need to be called inside the helper process.

Change-Id: I102d0f180a4f0204f107db900f2134c5af1d52c3
Reviewed-on: https://go-review.googlesource.com/c/sys/+/172258
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-16 12:42:37 +00:00
Tobias Klauser
3fd5a3612c unix: enable TestPassFD on AIX 7.2 TL >= 2
Follow CL 171339 and enable TestPassFD for AIX 7.2 TL >= 2

Change-Id: Icf781798a6f9fe99a57c23bc7f7e7c1361bdcec2
Reviewed-on: https://go-review.googlesource.com/c/sys/+/171941
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-15 14:56:33 +00:00
James Nugent
16da32be82 windows: add GetFileInformationByHandleEx function
Change-Id: I950762ef59c665d027641b4410ac30697edad22d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/171939
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-15 08:10:28 +00:00
Jason A. Donenfeld
9773273309 windows: add missing error constants
While the types_windows file previously had a small handful of types,
this forced application code to have an awkward mixture of artisanal
error constants and factory-ready ones. This commit adds the missing
ones and separates them into a new file, since they are quite numerous.

These also preserve the order of winerr.h, which should make it somewhat
easier to import new ones in the future.

Fixes golang/go#31360

Change-Id: If2abc507a8884ec1641f0b17fe0c612a950d3644
Reviewed-on: https://go-review.googlesource.com/c/sys/+/170918
Reviewed-by: Jason Donenfeld <Jason@zx2c4.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Jason Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-12 21:31:03 +00:00
Matt Layher
b44545bcd3 unix: add missing rtnetlink IFLA_* constants on Linux
A number of IFLA_* constants have been added since the last time this
list was generated. In addition, IFLA_INFO_* is a different enum, so
we'll add the missing values for there as well.

Change-Id: Ie20b1f49a95cbc10daf0be2e5b5d719782eda68f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/171698
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-11 18:56:58 +00:00
Jeroen Simonetti
0ad05ae300 unix: add missing rtnetlink neighbor constants on Linux
Change-Id: Ie261a6f149b7bc531f80726c016bf8f63c9210a7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/171537
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-10 23:58:45 +00:00
Matt Layher
cc4d4f5062 unix: add missing rtnetlink IFA_* constants on Linux
A few additional constants are now available since the last time
this list was updated.

Change-Id: I81cd07f8c6e7acb03ef67764ab783cea89ba3868
Reviewed-on: https://go-review.googlesource.com/c/sys/+/171318
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-10 17:00:21 +00:00
Tobias Klauser
4b34438f7a unix: allow empty string argument to SetsockoptString
Don't panic with "index out of range" on empty string argument.

Follows CL 170937 which did the sane for package syscall.

Updates golang/go#31277

Change-Id: I4feb796d0d58d3637428ae69997cfa3ec28a6b01
Reviewed-on: https://go-review.googlesource.com/c/sys/+/170957
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-05 15:42:28 +00:00
Tobias Klauser
81d4e9dc47 unix: don't generate raw syscall wrapper for ClockGettime on darwin
Follow-up for CL 170299

CL 170297 erroneously introduced a raw syscall wrapper for ClockGettime
on darwin. Make sure it isn't generated by mistake again.

Change-Id: Ie9ecdc950e5ab6cc85937008cd140847cffac42f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/170301
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-03 15:24:47 +00:00
Tobias Klauser
baf5eb976a unix: remove ClockGettime for darwin/amd64 on Go 1.11
This was erroneously introduced by CL 170297

SYS_CLOCK_GETTIME is not defined on darwin.

Fixes golang/go#31203

Change-Id: I39b1f19c4c9d7e9cb67569c4cb2764d64f158c0f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/170299
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-02 14:25:45 +00:00
Tobias Klauser
e4093980e8 unix: add SysctlClockinfo on darwin
Add type Clockinfo and the SysctlClockinfo function to query clock rate
information from the kernel.

Change-Id: Ic29edcacee3b3f6125bb218b82c2a2496c39213a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/170297
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-02 05:46:13 +00:00
Matt Layher
9eb1bfa1ce unix: add GetsockoptUint64 and SetsockoptUint64
The AF_VSOCK address family on Linux uses unsigned long long (uint64
in Go) values for getting and setting some socket options.

Change-Id: If28f6a5d04c0c988b7cbcaf2bf8d184a69329882
Reviewed-on: https://go-review.googlesource.com/c/sys/+/169959
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-03-29 04:47:33 +00:00
Jason A. Donenfeld
f49334f85d windows: add GetOverlappedResult function for async I/O
We already have all the structs and constants for async I/O, and the
various functions of x/sys/windows take the right parameters. But we're
missing the final step of any ordinary async I/O routine: getting the
result of overlapped I/O. Without this, the rest of the plumbing
supported by this module isn't actually so useful. So add this small
oversight.

Change-Id: I0ce1a71bce06bc81a83f3b0ca10ad9c4b67af726
Reviewed-on: https://go-review.googlesource.com/c/sys/+/168521
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-22 08:03:09 +00:00
Jason A. Donenfeld
f7bb7a8bee windows: add missing file flags to types
The previous selection was a bit haphazard, and defining random
constants in an application and combining those with existing constants
in this library looks kind of weird. So instead let's add the actual set
of flags, instead of the strange prior assortment.

Change-Id: I6ca266cd80aa7a43e93e969e1dbb09c8c7bf12c7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/168520
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-21 05:22:20 +00:00
Tobias Klauser
6c81ef8f67 unix: add SysctlClockinfo on OpenBSD
OpenBSD (like NetBSD) uses sysctl with struct clockinfo to get clock
rate information from the kernel. Add type Clockinfo and the
SysctlClockinfo function to query this information.

Change-Id: I35070a82b8de23dcd7592e8654dcc5eeee143b5b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/168057
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2019-03-18 19:57:19 +00:00
Jason A. Donenfeld
a2f829d7f3 windows: add support for creating well known SIDs
The security API is already quite extensive, but for some strange
reason, this essential and useful function was left out of the initial
port. So, we add it here, along with the relevant constants and a test
case.

Change-Id: I99568703565addf15603480f11b0edafdfc1718f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/167378
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-16 08:23:40 +00:00
Tobias Klauser
fead790013 cpu: use unix.Getsystemcfg to detect POWER8/POWER9 on aix/ppc64
Tested on an aix-ppc64 gomote builder.

Fixes golang/go#30732

Change-Id: I8e74dcde8bd4ded0f425c90eefe799970ebd325c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/166466
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-03-12 06:12:37 +00:00
Tobias Klauser
c8c8c57fd1 unix: run mkasm independent of mktypes in mkall.sh
Move the $mkasm invocation out of the if [ -n "$mktypes" ]

Change-Id: I6fd34703e2f438b23adceada3161fc4b40ba4fce
Reviewed-on: https://go-review.googlesource.com/c/sys/+/166467
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-11 15:21:10 +00:00
Tobias Klauser
7c207b7624 unix: add Getsystemcfg on aix
This will be used to detect POWER8/POWER9 support in x/sys/cpu

Updates golang/go#30732

Change-Id: I10ad6e440920c34c378bf6783417bc09421ff500
Reviewed-on: https://go-review.googlesource.com/c/sys/+/166465
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Clément Chigot <clement.chigot@atos.net>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-11 15:20:45 +00:00
Jason A. Donenfeld
10058d7d4f windows: use proper system directory path in fallback loader
The %WINDIR% variable is an odd choice and not even entirely reliable.
Since Windows 2000, there has been a specific function for determining
this information, so let's use it. It's also a useful function in its
own right for folks who want to launch system tools in a somewhat safe
way, like netsh.exe.

Updates golang/go#14959
Updates golang/go#30642

Change-Id: Ic24baf37d14f2daced0c1db2771b5a673d2c8852
Reviewed-on: https://go-review.googlesource.com/c/sys/+/165759
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-03-10 05:46:46 +00:00
Andrei Tudor Călin
980fc434d2 unix, unix/linux: add additional Linux perf API bits
Add sample_max_stack field to struct perf_event_attr.

Add the missing PERF_FLAG_FD_CLOEXEC flag, the missing
PERF_COUNT_SW_BPF_OUTPUT constant, missing PERF_RECORD_*
constants, and missing PERF_SAMPLE_BRANCH_* constants.

Change-Id: I44c5e37ff36420b35e56c97e7fc190cd0af95e21
Reviewed-on: https://go-review.googlesource.com/c/sys/+/166457
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-03-09 12:25:39 +00:00
Ian Lance Taylor
584f3b12f4 cpu: add build tag to cpu_wasm.go
Fixes the build for Go versions before 1.11.

Fixes golang/go#30668

Change-Id: I0dfb2eafcbcbe7e466a3b0b5d20656be3e6f4982
Reviewed-on: https://go-review.googlesource.com/c/sys/+/166137
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-08 02:30:53 +00:00
Tobias Klauser
572b51eaf7 unix: add SetsockoptPacketMreq on Linux
Add SetsockoptPacketMreq to set packet socket options used to
configure physical-layer multi‐casting and promiscuous mode
(PACKET_ADD_MEMBERSHIP, PACKET_DROP_MEMBERSHIP).

Change-Id: I0f292315ad1c57e6a3d1dd12f5f29be70d8bfd54
Reviewed-on: https://go-review.googlesource.com/c/sys/+/165977
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-07 16:26:37 +00:00
Bryan C. Mills
b294cbcfc5 all: add go directive to go.mod
Go 1.12 adds this line automatically, so let's just go with it.

Change-Id: I0ac156a58f0f107e019a8c06ebf189b819a3651d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/165751
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-06 22:07:23 +00:00
Bryan C. Mills
b354f8bf4d cpu: define cacheLineSize and doinit for WASM
This fixes a build break when compiling this package with
GOOS=js / GOARCH=wasm.

Updates golang/go#30241

Change-Id: I0b35aa50a69370ed0d83c522e12ce7613c4c3ec4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/165749
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-06 22:02:34 +00:00
Jason A. Donenfeld
70f5298506 windows/svc: safely load system DLLs
These DLLs, well advapi32.dll in particular, are vulnerable to classic
DLL directory injection attacks. The rest of x/sys/windows moved over to
the safe system loader, but apparently the svc package was forgotten.
This tidies up that oversight.

Change-Id: I330fa752cf2d49ccc5cf1bd60fb4bd612bd2b6b0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/165758
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-06 17:15:55 +00:00
Tobias Klauser
3e9a981b8d unix: add functions to get/set tpacket socket options
Add GetsockoptTpacketStats and GetsockoptTpacketStatsV3 to get tpacket
statistics (for TPACKET_V2 and TPACKET_V3).

Add SetsockoptTpacketReq and SetsockoptTpacketReq3 to set up tpacket
v2/v3 ring buffers.

Change-Id: Ic2870be22be7d74141f682e515a682df28e1c814
Reviewed-on: https://go-review.googlesource.com/c/sys/+/165558
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-03-06 15:53:19 +00:00
Tobias Klauser
a98ae47d97 unix: on ARM GNU/Linux let Pipe fall back to pipe
Follow CL 165217 which did this for package syscall.

Android O seems to require Pipe to call the pipe2 system call.
But kernel version 2.6.23 only supports pipe, not pipe2.
So try pipe2 first, then fall back to pipe.

Updates golang/go#30549

Change-Id: Icf21433fa046ff137c0265fa96410229def482f7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/165297
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-06 07:15:16 +00:00
Tobias Klauser
30e92a19ae unix: add Lutimes
Add Lutimes wrapping UtimesNanoAt.

Updates golang/go#30487

Change-Id: Ic5bb3b4d88be5806522eaef9bd9b8b0f5c1c8f42
Reviewed-on: https://go-review.googlesource.com/c/sys/+/164662
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-03-05 06:45:18 +00:00
Tobias Klauser
e844e0132e unix: update Dockerfile to Go 1.12 and Linux 5.0
Also enable KexecFileLoad on linux/{arm64,riscv64} now that they have
SYS_KEXEC_FILE_LOAD.

Change-Id: I1c52d09a1a617794f2df697e4966c4c24a166611
Reviewed-on: https://go-review.googlesource.com/c/sys/+/164997
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-04 15:46:30 +00:00
Dominik Honnef
c2f5717e61 unix: add fanotify API on Linux
This teaches unix/mksyscall.go about mapping uint64 to syscall
arguments, similar to existing handling of int64.

Change-Id: I536b4b09bbf6a8e3016565a4a04d2b9d32cbc624
Reviewed-on: https://go-review.googlesource.com/c/164664
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-03-03 19:25:50 +00:00
Shengjing Zhu
d455e41777 unix: add SignalNum to convert signal name to a number
Fixes golang/go#28027

Change-Id: Idf8b554e0fd102fd8b2f2f2ea0fa47bf139303da
Reviewed-on: https://go-review.googlesource.com/c/164778
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-03-03 12:26:42 +00:00
Alex Brainman
b6889370fb windows/svc: align ctlHandler parameters
ctlHandler is passed to RegisterServiceCtrlHandlerEx as a callback
function. But all ctlHandler parameters have to be uintptr aligned
regardless of their type.

Adjust ctlHandler parameters, so they are aligned accordingly.

Also uncomment part of TestExample that verifies passing of
ChangeRequest.Context.

Fixes golang/go#25660

Change-Id: Ie96fa5c78b911ad9df6775f5c49e7f6d56464f6b
Reviewed-on: https://go-review.googlesource.com/c/158698
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-02 02:57:03 +00:00
Alex Brainman
12036c158a windows/svc: add Context to ChangeRequest
New Context field will be used in the following CL to test
ctlHandler parameter alignments.

Also adjust TestExample to pass hard coded Context value of 123456
to test service, and verify that correct value is logged. Final
part of the test is commented out, and will be adjusted in the next
CL.

Updates golang/go#25660

Change-Id: Iad2896ae497ee1edc0d62655eaf08671ec2651c5
Reviewed-on: https://go-review.googlesource.com/c/158697
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-02 02:54:30 +00:00
Benny Siegert
a34e9553db unix: use 64-bit alignment on netbsd-arm
This is the same change as CL 164458.
netbsd-arm needs the same override to the alignment function as
openbsd-arm. This fixes the TestPassFD failure.

Update golang/go#24771

Change-Id: I9c6451feb11ec9810de9273b1324b0c23d7e6d11
Reviewed-on: https://go-review.googlesource.com/c/164497
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-02-28 12:41:57 +00:00
Michael Munday
6c9a33b5f7 cpu: add CPU features for s390x
Add basic support for IBM Z (s390x) CPU feature (known as
'facilities') detection.

Note that some of these features are mandatory when using the Go
compiler (for example, ldisp and eimm) but aren't mandatory when
using gccgo.

Cryptographic function detection is not yet implemented for
gccgo.

Change-Id: Ic6494d0df0bc1c1ad1713c9ff11ae23fba03d215
Reviewed-on: https://go-review.googlesource.com/c/163003
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-28 11:51:10 +00:00
Tobias Klauser
92a0ff1e1e cpu: don't panic on error reading /proc/self/auxv
On Android /proc/self/auxv is not readable, leading to a panic in init.
Instead of panic'ing in this case, introduce the Initialized global bool
to report whether the CPU features were initialized i.e. /proc/self/auxv
was successfullly read.

Fixes golang/go#30413

Change-Id: Ib520f202990614a76bceb0bf9d19a88eadd13e10
Reviewed-on: https://go-review.googlesource.com/c/164057
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-02-28 07:16:10 +00:00
Michael Matloob
775f8194d0 all: add a go.mod file
This change adds a go.mod file to this repo, following the
requirements stated in bcmills's comment here:
https://golang.org/issue/28136#issuecomment-462971974. It's
important to note that we will not be
adding versions to the repo for now.

This change does not add a go.sum because this repo has no dependencies.

The change was generated by running "go mod init" and "go mod tidy" using Go
1.11.5 in the top-level directory of the repository.

Updates golang/go#28136

Change-Id: If6945f4bb17f7c84b53445054140ce9389767d89
Reviewed-on: https://go-review.googlesource.com/c/162977
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-02-26 21:58:55 +00:00
Elias Naur
cc5685c2db unix: don't overwrite unrelated file descriptors in TestDup
TestDup used a file descriptor without ensuring it was free,
leading to rare crashes in the runtime netpoller when the victim fd
was the polling descriptor.

Updates golang/go#29423

Change-Id: Idc8b6b47f7e966e045f57f2028e7b6b79e0fb3f3
Reviewed-on: https://go-review.googlesource.com/c/163638
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-02-25 06:59:34 +00:00
Tobias Klauser
cd391775e7 unix: add type NdUseroptmsg on Linux
Change-Id: I06997987f2d54a1fbca098878a3bac473ec1bfc0
Reviewed-on: https://go-review.googlesource.com/c/163379
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-22 17:13:17 +00:00
Tobias Klauser
a9d3bda3a2 unix: add SetsockoptCanRawFilter for linux
Add the SetsockoptCanRawFilter func and CanFilter type to allow kernel
message filtering on AF_CAN sockets.

Fixes golang/go#29638

Change-Id: I4042825527ba2bc9aeb8dbe70d1960a06b15c29e
Reviewed-on: https://go-review.googlesource.com/c/163318
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-22 07:27:16 +00:00
Matt Layher
ec7b60b042 unix: add SetsockoptSockFprog on Linux for attaching BPF filters
Adding this helper enables me to eliminate some nasty code which
invokes unix.Syscall6 directly, and which has 32-bit shims for
invoking setsockopt properly on 32-bit Linux.

Change-Id: I53ef411e4c96cef557999261760cddc00df58d8a
Reviewed-on: https://go-review.googlesource.com/c/163303
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-02-21 22:21:58 +00:00
Tobias Klauser
b4e8571b14 cpu: fix build for GOARCH=ppc64{,le} on GOOS!=linux
The current implementation for ppc64{,le} only supports linux (through
HWCaps read from /proc/self/auxv) and fails to build e.g. on
aix/ppc64.

Change-Id: I5e1efe75c781fd08bc7bbe797df88295726ba62b
Reviewed-on: https://go-review.googlesource.com/c/162798
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-02-21 07:52:27 +00:00
Bryan C. Mills
629670e5ac windows: gofmt -w windows/security_windows.go
x/sys/unix is vendored into the standard library, and the commit hook
for the standard library requires files to be gofmt-clean.

Updates golang/go#26924

Change-Id: I22a994062bcdbebe8a1fe1ae0ed4606837f03079
Reviewed-on: https://go-review.googlesource.com/c/162990
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-20 15:41:26 +00:00
Bryan C. Mills
90b0e4468f unix: do not invoke Mkfifo with a relative path in a read-only directory
Updates golang/go#28387

Change-Id: Ibcdc3f9cb3dc43b86b7e7d3539ed592219e54aba
Reviewed-on: https://go-review.googlesource.com/c/162987
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-19 20:33:50 +00:00