summaryrefslogtreecommitdiff
path: root/src/syscall
Commit message (Collapse)AuthorAgeFilesLines
* [release-branch.go1.6] syscall: disable TestGetfsstat failure on buildersRuss Cox2016-12-011-1/+6
| | | | | | | | | | | | The underlying bug is fixed on master. We don't need to (nor want to) port the fix back, but we do want to be able to run all.bash for minor releases. Change-Id: Ib612fc84fd8cd1f57456dd300855318badf97cf7 Reviewed-on: https://go-review.googlesource.com/33850 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* syscall: fix epoll_event struct for ppc64le/ppc64Lynn Boger2016-04-193-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | The existing epoll_event structure used by many of the epoll_* syscalls was defined incorrectly for use with ppc64le & ppc64 in the syscall directory. This resulted in the caller getting incorrect information on return from these syscalls. This caused failures in fsnotify as well as builds with upstream Docker. The structure is defined correctly in gccgo. This adds a pad field that is expected for these syscalls on ppc64le, ppc64. Fixes #15135 Fixes #15288 Change-Id: If7e8ea9eb1d1ca5182c8dc0f935b334127341ffd Reviewed-on: https://go-review.googlesource.com/21582 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/22207 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* runtime, syscall: switch linux/386 to use int 0x80Shenghou Ma2016-04-141-11/+2
| | | | | | | | | | | | | | | | | | | Like bionic, musl also doesn't provide vsyscall helper in %gs:0x10, and as int $0x80 is as fast as calling %gs:0x10, just use int $0x80 always. Because we're no longer using vsyscall in VDSO, get rid of VDSO code for linux/386 too. Fixes #14476. Change-Id: I00ec8652060700e0a3c9b524bfe3c16a810263f6 Reviewed-on: https://go-review.googlesource.com/19833 Run-TryBot: Minux Ma <minux@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-on: https://go-review.googlesource.com/22038 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* syscall: point to x/sys in DLL loading docs, update syscall generatorBrad Fitzpatrick2016-04-082-2/+15
| | | | | | | | | | | | Updates the syscall generator for patchset 4 of https://golang.org/cl/21388. Updates #14959 Change-Id: Icbd6df489887d3dcc076dfc73d4feb1376abaf8b Reviewed-on: https://go-review.googlesource.com/21428 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-on: https://go-review.googlesource.com/21697 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* runtime, syscall: only search for Windows DLLs in the System32 directoryBrad Fitzpatrick2016-04-084-21/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure that for any DLL that Go uses itself, we only look for the DLL in the Windows System32 directory, guarding against DLL preloading attacks. (Unless the Windows version is ancient and LoadLibraryEx is unavailable, in which case the user probably has bigger security problems anyway.) This does not change the behavior of syscall.LoadLibrary or NewLazyDLL if the DLL name is something unused by Go itself. This change also intentionally does not add any new API surface. Instead, x/sys is updated with a LoadLibraryEx function and LazyDLL.Flags in: https://golang.org/cl/21388 Updates #14959 Change-Id: I8d29200559cc19edf8dcf41dbdd39a389cd6aeb9 Reviewed-on: https://go-review.googlesource.com/21140 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-on: https://go-review.googlesource.com/21696 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/compile: recognize Syscall-like functions for liveness analysisRuss Cox2016-01-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider this code: func f(*int) func g() { p := new(int) f(p) } where f is an assembly function. In general liveness analysis assumes that during the call to f, p is dead in this frame. If f has retained p, p will be found alive in f's frame and keep the new(int) from being garbage collected. This is all correct and works. We use the Go func declaration for f to give the assembly function liveness information (the arguments are assumed live for the entire call). Now consider this code: func h1() { p := new(int) syscall.Syscall(1, 2, 3, uintptr(unsafe.Pointer(p))) } Here syscall.Syscall is taking the place of f, but because its arguments are uintptr, the liveness analysis and the garbage collector ignore them. Since p is no longer live in h once the call starts, if the garbage collector scans the stack while the system call is blocked, it will find no reference to the new(int) and reclaim it. If the kernel is going to write to *p once the call finishes, reclaiming the memory is a mistake. We can't change the arguments or the liveness information for syscall.Syscall itself, both for compatibility and because sometimes the arguments really are integers, and the garbage collector will get quite upset if it finds an integer where it expects a pointer. The problem is that these arguments are fundamentally untyped. The solution we have taken in the syscall package's wrappers in past releases is to insert a call to a dummy function named "use", to make it look like the argument is live during the call to syscall.Syscall: func h2() { p := new(int) syscall.Syscall(1, 2, 3, uintptr(unsafe.Pointer(p))) use(unsafe.Pointer(p)) } Keeping p alive during the call means that if the garbage collector scans the stack during the system call now, it will find the reference to p. Unfortunately, this approach is not available to users outside syscall, because 'use' is unexported, and people also have to realize they need to use it and do so. There is much existing code using syscall.Syscall without a 'use'-like function. That code will fail very occasionally in mysterious ways (see #13372). This CL fixes all that existing code by making the compiler do the right thing automatically, without any code modifications. That is, it takes h1 above, which is incorrect code today, and makes it correct code. Specifically, if the compiler sees a foreign func definition (one without a body) that has uintptr arguments, it marks those arguments as "unsafe uintptrs". If it later sees the function being called with uintptr(unsafe.Pointer(x)) as an argument, it arranges to mark x as having escaped, and it makes sure to hold x in a live temporary variable until the call returns, so that the garbage collector cannot reclaim whatever heap memory x points to. For now I am leaving the explicit calls to use in package syscall, but they can be removed early in a future cycle (likely Go 1.7). The rule has no effect on escape analysis, only on liveness analysis. Fixes #13372. Change-Id: I2addb83f70d08db08c64d394f9d06ff0a063c500 Reviewed-on: https://go-review.googlesource.com/18584 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: fix duplicated copyright header in mksysnum_plan9.shBrad Fitzpatrick2015-12-101-2/+0
| | | | | | | | Fixes #13569 Change-Id: I04c9a44437414177e2fee260518cfe53a67e6364 Reviewed-on: https://go-review.googlesource.com/17684 Reviewed-by: Rob Pike <r@golang.org>
* go/doc, syscall: change 'more then' to 'more than'andrey mirtchovski2015-12-071-2/+2
| | | | | | | | | This change modifies comments to use the more gramatically correct "more than" instead of "more then". Change-Id: Ie3bddcf25eb6b243a21da934f2f3c76a750c083a Reviewed-on: https://go-review.googlesource.com/17488 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* Revert "syscall: route_freebsd switch routing socket sysctl to use ↵Yuval Pavel Zholkover2015-12-0510-524/+196
| | | | | | | | | | | | | | | NET_RT_IFLISTL" This reverts commit f25f6eab0cb732d24759b2e166a9a644ae96dffe. Sorry, this was not meant to go in without the ztypes_freebsd_arm.go and the copyFromV9 function. Change-Id: I4ac2a8a23809ec1b1b9e42992cd0f3c349848f06 Reviewed-on: https://go-review.googlesource.com/17472 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* syscall: route_freebsd switch routing socket sysctl to use NET_RT_IFLISTLYuval Pavel Zholkover2015-12-0510-196/+524
| | | | | | | | | | | | | Switch IfMsghdr and IfaMsghdr to their 'l' variants, make the IfData layout to be based on FreeBSD-11.0 (freebsdVersion >= 1100011). Using freebsdVersion, detect the appropriate layout at runtime and decode routing socket messages into the new IfData layout. Fixes #11641 Change-Id: Ic7ec550f00c0d15f46a36f560d835e4f138f61e1 Reviewed-on: https://go-review.googlesource.com/14757 Reviewed-by: Russ Cox <rsc@golang.org>
* syscall: fix ParseRoutingSockaddr name in docsYann Kerhervé2015-12-051-1/+1
| | | | | | Change-Id: I3870150fc8e713f6164371299c029b31f18f250a Reviewed-on: https://go-review.googlesource.com/17426 Reviewed-by: Minux Ma <minux@golang.org>
* internal/race: add packageDmitry Vyukov2015-11-264-71/+18
| | | | | | | | | | | | | Factor out duplicated race thunks from sync, syscall net and fmt packages into a separate package and use it. Fixes #8593 Change-Id: I156869c50946277809f6b509463752e7f7d28cdb Reviewed-on: https://go-review.googlesource.com/14870 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Dmitry Vyukov <dvyukov@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* syscall: skip tests that create a user namespace when chrootedMichael Hudson-Doyle2015-11-251-0/+17
| | | | | | | | | The kernel rejects attempts to create user namespaces when in a chroot. Change-Id: I6548302732c8f5be52f4167cd7233aea16839ad8 Reviewed-on: https://go-review.googlesource.com/17214 Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* syscall: don't check result of close(fd) in forkAndExecInChild on Plan9David du Colombier2015-11-241-4/+1
| | | | | | | | | | | | | | | | On multiprocessor machines, a file descriptor could be closed twice in forkAndExecInChild. Consequently, the close syscall returns the "fd out of range or not open" error and forkAndExecInChild fails. This changes forkAndExecInChild to ignore the error returned by close(fd), as on other operating systems. Fixes #12851. Change-Id: I96a8463ce6599bfd1362353283e0329a00f738da Reviewed-on: https://go-review.googlesource.com/17188 Reviewed-by: Rob Pike <r@golang.org>
* runtime, syscall: use int $0x80 to invoke syscalls on android/386Michael Hudson-Doyle2015-11-171-7/+20
| | | | | | | | | | | | | | | golang.org/cl/16796 broke android/386 by assuming behaviour specific to glibc's dynamic linker. Copy bionic by using int $0x80 to invoke syscalls on android/386 as the old alternative (CALL *runtime_vdso(SB)) cannot be compiled without text relocations, which we want to get rid of on android. Also remove "CALL *runtime_vdso(SB)" variant from the syscall package. Change-Id: I6c01849f8dcbd073d000ddc8f13948a836b8b261 Reviewed-on: https://go-review.googlesource.com/16996 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
* syscall: added support for linux/mips64{,le}Yao Zhang2015-11-1215-12/+343
| | | | | | | | | | | Syscall getdents64 is relatively new in linux/mips64, only since kernel version 3.10. To support older kernel, syscall getdents is used for mips64. Change-Id: I892b05dff7d93e7ddb0d700abd6a5e6d4084ab4c Reviewed-on: https://go-review.googlesource.com/14449 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Minux Ma <minux@golang.org>
* syscall: added machine-generated code for linux/mips64{,le}Yao Zhang2015-11-128-0/+9014
| | | | | | | Change-Id: I574a2b702bb3db596f890ae7b18fb4bc1fd358d5 Reviewed-on: https://go-review.googlesource.com/14448 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Minux Ma <minux@golang.org>
* syscall: allow nacl's fake network code to Listen twice on the same addressBrad Fitzpatrick2015-11-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Noticed from nacl trybot failures on new tests in https://golang.org/cl/16630 Related earlier fix of mine to nacl's listen code: syscall: fix nacl listener to not accept connections once closed https://go-review.googlesource.com/15940 Perhaps a better fix (in the future?) would be to remove the listener from the map at close, but that didn't seem entirely straightforward last time I looked into it. It's not my code, but it seems that the map entry continues to have a purpose even after Listener close. (?) But given that this code is only really used for running tests and the playground, this seems fine. Change-Id: I43bfedc57c07f215f4d79c18f588d3650687a48f Reviewed-on: https://go-review.googlesource.com/16650 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: correct parameter name of Setgid on linuxMarvin Stenger2015-10-301-1/+1
| | | | | | | | | Change parameter name from uid to gid, to fix an obvious copy-paste error. Change-Id: Iba13a45c87fde9625b82976a7d7901af4b705230 Reviewed-on: https://go-review.googlesource.com/16474 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* syscall: define common notes on Plan 9David du Colombier2015-10-261-0/+10
| | | | | | | | | | | | | | | There is no signal list on Plan 9, since notes are strings. However, some programs expect signals to be defined in the syscall package. Hence, we define a list of the most common notes. Updates #11975. Change-Id: I852e14fd98777c9595a406e04125be1cbebed0fb Reviewed-on: https://go-review.googlesource.com/16301 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: David du Colombier <0intro@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* runtime, syscall: add calls to msan functionsIan Lance Taylor2015-10-214-0/+53
| | | | | | | | | | | Add explicit memory sanitizer instrumentation to the runtime and syscall packages. The compiler does not instrument the runtime package. It does instrument the syscall package, but we need to add a couple of cases that it can't see. Change-Id: I2d66073f713fe67e33a6720460d2bb8f72f31394 Reviewed-on: https://go-review.googlesource.com/16164 Reviewed-by: David Crawshaw <crawshaw@golang.org>
* cmd/compile, syscall: use go:norace comment for forkAndExecInChildIan Lance Taylor2015-10-204-0/+4
| | | | | | | | | Use a go:norace comment rather than having the compiler know the special name syscall.forkAndExecInChild. Change-Id: I69bc6aa6fc40feb2148d23f269ff32453696fb28 Reviewed-on: https://go-review.googlesource.com/16097 Reviewed-by: Minux Ma <minux@golang.org>
* syscall: fix nacl listener to not accept connections once closedBrad Fitzpatrick2015-10-161-1/+7
| | | | | | | | | Change-Id: I3ba6e97089ef6e69ba31dfb632df465859906a74 Reviewed-on: https://go-review.googlesource.com/15940 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Minux Ma <minux@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: fix vet warning in UnixRightsMatthew Dempsky2015-10-081-3/+3
| | | | | | | | Change-Id: Ic19c94fe0af55e17f6c2fcfd36085ccb1584da6f Reviewed-on: https://go-review.googlesource.com/15608 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* syscall: skip a couple tests when running under KubernetesBrad Fitzpatrick2015-10-021-0/+7
| | | | | | | | | | Update #12815 Change-Id: I3bf6de74bc8ab07000fe9a4308299839ef20632f Reviewed-on: https://go-review.googlesource.com/15283 Reviewed-by: Evan Brown <evanbrown@google.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: fix alignment check for link-layer information on BSD variantsMikio Hara2015-09-252-3/+41
| | | | | | | | | | | | When link-layer information is wrapped with sockaddr_dl, we need to follow the len field of sockaddr_dl. When link-layer information is naked, we need to use the length of whole link-layer information. Fixes #12641. Change-Id: I4d377f64cbab1760b993fc55c719288616042bbb Reviewed-on: https://go-review.googlesource.com/14939 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: implement getwd on SolarisShawn Walker-Salas2015-09-096-18/+68
| | | | | | | | | | | | In support of the changes required for #8609, it was suggested that syscall.getwd() be updated to work on Solaris first since the runtime uses it and today it's unimplemented. Fixes #12507 Change-Id: Ifb58ac9db8540936d5685c2c58bdc465dbc836cb Reviewed-on: https://go-review.googlesource.com/14420 Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
* syscall: fix formatting calls in testsAlexander Morozov2015-09-031-3/+3
| | | | | | | | Change-Id: I39a2c4101e6c59f4cd693cb0368f3567ea37ca5b Reviewed-on: https://go-review.googlesource.com/14255 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* syscall: remove unused kernelVersion function from testsAlexander Morozov2015-08-311-18/+0
| | | | | | | | Change-Id: If0d00999c58f7421e4da06e1822ba5abccf72cac Reviewed-on: https://go-review.googlesource.com/14111 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* syscall: move check of unprivileged_userns_clone to whoamiCmdAlexander Morozov2015-08-311-8/+7
| | | | | | | | | | | | This is basic validation and should be performed early Fixes #12412 Change-Id: I903f7eeafdc22376704985a53d649698cf9d8ef4 Reviewed-on: https://go-review.googlesource.com/14110 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* syscall: remove nacl srpc helperDave Cheney2015-08-281-822/+0
| | | | | | | | | | | | | | | | | | Fixes #11961 Minux removed the use of SRPC in 003dccfa, but the SRPC name service code was left in the tree. SRPC was removed in pepper_42 making the code, which ran on startup, fail, even though it was not used. Removing srpc_nacl.go for a total diff of -822 lines has got to count as one of the easiest nacl fixes we've had to date. Change-Id: Ic4e348146bfe47450bbb9cabb91699ba153e6bf0 Reviewed-on: https://go-review.googlesource.com/13958 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Minux Ma <minux@golang.org> Run-TryBot: Minux Ma <minux@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* syscall: don't call Setgroups if Credential.Groups is emptyAlexander Morozov2015-08-272-6/+13
| | | | | | | | | | | | | Setgroups with zero-length groups is no-op for changing groups and supposed to be used only for determining curent groups length. Also because we deny setgroups by default if use GidMappings we have unnecessary error from that no-op syscall. Change-Id: I8f74fbca9190a3dcbbef1d886c518e01fa05eb62 Reviewed-on: https://go-review.googlesource.com/13938 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* runtime, syscall: remove unused bits from Solaris implementationShawn Walker-Salas2015-08-211-9/+0
| | | | | | | | | | | | CL 9184 changed the runtime and syscall packages to link Solaris binaries directly instead of using dlopen/dlsym but did not remove the unused (and now broken) references to dlopen, dlclose, and dlsym. Fixes #11923 Change-Id: I36345ce5e7b371bd601b7d48af000f4ccacd62c0 Reviewed-on: https://go-review.googlesource.com/13410 Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
* syscall: use fchownat(2) in place of lchown(2) for linux/arm64Dave Cheney2015-07-302-17/+4
| | | | | | | | | | | | | | | | Fixes #11918 Replace calls to lchown(2) with fchownat(2) for linux/arm64 as the former is not suppored. This change has also landed on the x/sys repo as CL 12837. Change-Id: I58d4b144e051e36dd650ec9b7f3a02610ea943e5 Reviewed-on: https://go-review.googlesource.com/12833 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dave Cheney <dave@cheney.net> Run-TryBot: Dave Cheney <dave@cheney.net> Reviewed-by: Russ Cox <rsc@golang.org>
* syscall: warn not to use FormatMessageAlex Brainman2015-07-212-4/+12
| | | | | | | | Fixes #11147 Change-Id: Ib31160946a53f6f9b11daea211ff04d186b51b3f Reviewed-on: https://go-review.googlesource.com/12067 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* all: link to https instead of httpBrad Fitzpatrick2015-07-111-1/+1
| | | | | | | | | | | | | The one in misc/makerelease/makerelease.go is particularly bad and probably warrants rotating our keys. I didn't update old weekly notes, and reverted some changes involving test code for now, since we're late in the Go 1.5 freeze. Otherwise, the rest are all auto-generated changes, and all manually reviewed. Change-Id: Ia2753576ab5d64826a167d259f48a2f50508792d Reviewed-on: https://go-review.googlesource.com/12048 Reviewed-by: Rob Pike <r@golang.org>
* syscall: return error instead of panicking in windows StartProcessAlex Brainman2015-06-291-0/+3
| | | | | | | | Fixes #11417 Change-Id: Iacea829a48b39df0a4f751b06b19e918fbb713d0 Reviewed-on: https://go-review.googlesource.com/11604 Reviewed-by: Rob Pike <r@golang.org>
* syscall: skip non-root user namespace test if kernel forbidsIan Lance Taylor2015-06-201-1/+9
| | | | | | | | | | | | Some Linux kernels apparently have a sysctl that prohibits nonprivileged processes from creating user namespaces. If we see a failure for that reason, skip the test. Fixes #11261. Change-Id: I82dfcaf475eea4eaa387941373ce7165df4848ad Reviewed-on: https://go-review.googlesource.com/11269 Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
* all: switch to the new deprecation conventionShenghou Ma2015-06-184-16/+29
| | | | | | | | | While we're at it, move some misplaced comment blocks around. Change-Id: I1847d7f1ca1dbb8e5de737203c4ed6c66e112508 Reviewed-on: https://go-review.googlesource.com/10188 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
* all: extract "can I exec?" check from tests into internal/testenvRuss Cox2015-06-162-9/+7
| | | | | | | | Change-Id: I7b54be9d8b50b39e01c6be21f310ae9a10404e9d Reviewed-on: https://go-review.googlesource.com/10753 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: fix TestCloneNEWUSERAndRemapNoRootDisableSetgroups the right wayIan Lance Taylor2015-06-151-15/+8
| | | | | | | | | | | | | The problem was not the kernel version as I thought before, it was that the test used the same number for both the UID and the GID. Thanks to Chris Siebenmann for debugging this. Fixes #11220. Change-Id: Ib5077e182497155e84044683209590ee0f7c9dde Reviewed-on: https://go-review.googlesource.com/11124 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Austin Clements <austin@google.com>
* syscall: correct comment on where compileCallback is definedIan Lance Taylor2015-06-151-1/+1
| | | | | | | | Fixes #11216. Change-Id: Iad1f4894c2258909484eaf975b08e0f47a82788e Reviewed-on: https://go-review.googlesource.com/11098 Reviewed-by: Andrew Gerrand <adg@golang.org>
* syscall: skip TestCloneNEWUSERAndRemapNoRootDisableSetgroups before 3.19Ian Lance Taylor2015-06-141-0/+26
| | | | | | | | | The test fails on Ubuntu Trusty for some reason, probably because of some set of kernel patches. Change-Id: I52f7ca50b96fea5725817c9e9198860d419f9313 Reviewed-on: https://go-review.googlesource.com/11055 Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
* syscall: add GidMappingsEnableSetgroups to Linux SysProcAttrAlexander Morozov2015-06-122-0/+119
| | | | | | | | | | | | | | | | | | Linux 3.19 made a change in the handling of setgroups and the 'gid_map' file to address a security issue. The upshot of the 3.19 changes is that in order to update the 'gid_maps' file, use of the setgroups() system call in this user namespace must first be disabled by writing "deny" to one of the /proc/PID/setgroups files for this namespace. Also added tests for remapping uid_map and gid_map inside new user namespace. Fixes #10626 Change-Id: I4d2539acbab741a37092d277e10f31fc39a8feb7 Reviewed-on: https://go-review.googlesource.com/10670 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* all: fix misprints in commentsAinar Garipov2015-06-113-3/+3
| | | | | | | | | | These were found by grepping the comments from the go code and feeding the output to aspell. Change-Id: Id734d6c8d1938ec3c36bd94a4dbbad577e3ad395 Reviewed-on: https://go-review.googlesource.com/10941 Reviewed-by: Aamir Khan <syst3m.w0rm@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* all: use RET instead of RETURN on ppc64Austin Clements2015-06-062-15/+8
| | | | | | | | | | | | | | | | | | | | | All of the architectures except ppc64 have only "RET" for the return mnemonic. ppc64 used to have only "RETURN", but commit cf06ea6 introduced RET as a synonym for RETURN to make ppc64 consistent with the other architectures. However, that commit was never followed up to make the code itself consistent by eliminating uses of RETURN. This commit replaces all uses of RETURN in the ppc64 assembly with RET. This was done with sed -i 's/\<RETURN\>/RET/' **/*_ppc64x.s plus one manual change to syscall/asm.s. Change-Id: I3f6c8d2be157df8841d48de988ee43f3e3087995 Reviewed-on: https://go-review.googlesource.com/10672 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Minux Ma <minux@golang.org>
* syscall: don't run fcntl child process test on iOSBrad Fitzpatrick2015-05-151-0/+3
| | | | | | | | | | Fixes darwin-arm{,64} builds. Child processes aren't allowed on iOS. Change-Id: I9258ed4df757ec394ef6327dbda96f5b9705bcdd Reviewed-on: https://go-review.googlesource.com/10142 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
* syscall: add test for Flock_t roundtripShenghou Ma2015-05-151-12/+47
| | | | | | | | | See CL 9962 for the rationale. Change-Id: I73c714fce258430eea1e61d3835f5c8e9014ca1f Signed-off-by: Shenghou Ma <minux@golang.org> Reviewed-on: https://go-review.googlesource.com/9925 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: add explicit build tagsShenghou Ma2015-05-1589-0/+178
| | | | | | | | | | | | | | | | | Auto-generated using the following bash script: for i in z*_*_*.go; do goosgoarch=`basename ${i/${i/_*/}_/} .go` goos=${goosgoarch/_*/} goarch=${goosgoarch/*_/} echo $i $goos $goarch [ "$goos" = "windows" ] && continue sed -i -e "/^package /i\/\/ +build $goarch,$goos\n" "$i" done Change-Id: I756fee551d1698080e4591fed8f058ae0450aaa5 Signed-off-by: Shenghou Ma <minux@golang.org> Reviewed-on: https://go-review.googlesource.com/10113 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: fix F_SETLK{,W} on linux/ppc64Shenghou Ma2015-05-152-3/+3
| | | | | | Change-Id: Ia81675b0f01ceafada32bdd2bc59088016a7421e Reviewed-on: https://go-review.googlesource.com/10043 Reviewed-by: Ian Lance Taylor <iant@golang.org>