1
0
mirror of https://github.com/golang/go synced 2024-10-05 09:21:22 -06:00
Commit Graph

165 Commits

Author SHA1 Message Date
Richard Miller
87103a1ab7 syscall: add NO_LOCAL_POINTERS to syscall.exit in plan9_arm
This prevents a fatal "missing stackmap" error if garbage collection
occurs during exit.

Also annotate argument sizes for "go vet".

Change-Id: I2473e0ef6aef8f26d0bbeaee9bd8f8a52eaaf941
Reviewed-on: https://go-review.googlesource.com/20476
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-09 16:32:02 +00:00
Brad Fitzpatrick
40e60e7c13 os, syscall: skip tests when environment doesn't permit testing
Fixes #14693

Change-Id: Id0a6a80b4c37c0b0f1c2755667b7233ed8964e40
Reviewed-on: https://go-review.googlesource.com/20342
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-07 22:40:50 +00:00
Brad Fitzpatrick
5fea2ccc77 all: single space after period.
The tree's pretty inconsistent about single space vs double space
after a period in documentation. Make it consistently a single space,
per earlier decisions. This means contributors won't be confused by
misleading precedence.

This CL doesn't use go/doc to parse. It only addresses // comments.
It was generated with:

$ perl -i -npe 's,^(\s*// .+[a-z]\.)  +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.)  +([A-Z])')
$ go test go/doc -update

Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7
Reviewed-on: https://go-review.googlesource.com/20022
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dave Day <djd@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-02 00:13:47 +00:00
Brad Fitzpatrick
519474451a all: make copyright headers consistent with one space after period
This is a subset of https://golang.org/cl/20022 with only the copyright
header lines, so the next CL will be smaller and more reviewable.

Go policy has been single space after periods in comments for some time.

The copyright header template at:

    https://golang.org/doc/contribute.html#copyright

also uses a single space.

Make them all consistent.

Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0
Reviewed-on: https://go-review.googlesource.com/20111
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-01 23:34:33 +00:00
Benoit Sigoure
21f2cb60ea syscall: Fix generator for Linux syscalls.
In golang.org/cl/14449 the `getdents' system call got changed to use
_SYS_getdents as a layer of indirection instead of SYS_GETDENTS64 for
compatibility with mips64, but this broke mksyscall.pl, which then
died with with:
  syscall_linux.go:840: malformed //sys declaration

Change-Id: Icb61965d8730f6e81f9fb0fa28c7bab635470f09
Reviewed-on: https://go-review.googlesource.com/20051
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-02-29 17:28:00 +00:00
Richard Miller
763e8fcc89 syscall: new files for plan_arm support
Implementation closely follows plan9_386 version.

Change-Id: Ifb76e001fb5664e6a23541cf4768d7f11b2be68b
Reviewed-on: https://go-review.googlesource.com/18967
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-02-26 20:03:16 +00:00
Martin Möhrmann
fdd0179bb1 all: fix typos and spelling
Change-Id: Icd06d99c42b8299fd931c7da821e1f418684d913
Reviewed-on: https://go-review.googlesource.com/19829
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-02-24 18:42:29 +00:00
Shenghou Ma
1439158120 runtime, syscall: switch linux/386 to use int 0x80
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>
2016-02-24 02:07:17 +00:00
Russ Cox
1ac637c766 cmd/compile: recognize Syscall-like functions for liveness analysis
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>
2016-01-14 01:16:45 +00:00
Brad Fitzpatrick
251e50065b syscall: fix duplicated copyright header in mksysnum_plan9.sh
Fixes #13569

Change-Id: I04c9a44437414177e2fee260518cfe53a67e6364
Reviewed-on: https://go-review.googlesource.com/17684
Reviewed-by: Rob Pike <r@golang.org>
2015-12-10 20:45:18 +00:00
andrey mirtchovski
84a875caa6 go/doc, syscall: change 'more then' to 'more than'
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>
2015-12-07 05:34:33 +00:00
Yuval Pavel Zholkover
4a2915052b Revert "syscall: route_freebsd switch routing socket sysctl to use NET_RT_IFLISTL"
This reverts commit f25f6eab0c.

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>
2015-12-05 07:45:01 +00:00
Yuval Pavel Zholkover
f25f6eab0c syscall: route_freebsd switch routing socket sysctl to use NET_RT_IFLISTL
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>
2015-12-05 04:55:02 +00:00
Yann Kerhervé
5c24832293 syscall: fix ParseRoutingSockaddr name in docs
Change-Id: I3870150fc8e713f6164371299c029b31f18f250a
Reviewed-on: https://go-review.googlesource.com/17426
Reviewed-by: Minux Ma <minux@golang.org>
2015-12-05 00:10:40 +00:00
Dmitry Vyukov
7b767f4e52 internal/race: add package
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>
2015-11-26 16:50:31 +00:00
Michael Hudson-Doyle
21efa7b2bc syscall: skip tests that create a user namespace when chrooted
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>
2015-11-25 23:31:47 +00:00
David du Colombier
1d3e77607d syscall: don't check result of close(fd) in forkAndExecInChild on Plan9
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>
2015-11-24 18:57:44 +00:00
Michael Hudson-Doyle
90e26f52c6 runtime, syscall: use int $0x80 to invoke syscalls on android/386
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>
2015-11-17 20:22:47 +00:00
Yao Zhang
4f19cb7011 syscall: added support for linux/mips64{,le}
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>
2015-11-12 04:49:34 +00:00
Yao Zhang
1dba497aca syscall: added machine-generated code for linux/mips64{,le}
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>
2015-11-12 04:49:19 +00:00
Brad Fitzpatrick
8ee90fad12 syscall: allow nacl's fake network code to Listen twice on the same address
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>
2015-11-04 16:03:21 +00:00
Marvin Stenger
b41a920792 syscall: correct parameter name of Setgid on linux
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>
2015-10-30 17:23:46 +00:00
David du Colombier
8993f79eac syscall: define common notes on Plan 9
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>
2015-10-26 22:12:46 +00:00
Ian Lance Taylor
73f329f472 runtime, syscall: add calls to msan functions
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>
2015-10-21 19:17:46 +00:00
Ian Lance Taylor
77b1fef27e cmd/compile, syscall: use go:norace comment for forkAndExecInChild
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>
2015-10-20 14:10:24 +00:00
Brad Fitzpatrick
19aa4209ae syscall: fix nacl listener to not accept connections once closed
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>
2015-10-16 14:43:17 +00:00
Matthew Dempsky
3c2febb748 syscall: fix vet warning in UnixRights
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>
2015-10-08 20:10:16 +00:00
Brad Fitzpatrick
f35310edff syscall: skip a couple tests when running under Kubernetes
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>
2015-10-02 19:31:09 +00:00
Mikio Hara
707b619c3a syscall: fix alignment check for link-layer information on BSD variants
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>
2015-09-25 22:00:27 +00:00
Shawn Walker-Salas
af7c9a42c1 syscall: implement getwd on Solaris
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>
2015-09-09 19:58:33 +00:00
Alexander Morozov
d5e32ebf54 syscall: fix formatting calls in tests
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>
2015-09-03 21:08:04 +00:00
Alexander Morozov
5483761c13 syscall: remove unused kernelVersion function from tests
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>
2015-08-31 17:07:16 +00:00
Alexander Morozov
ae82315b82 syscall: move check of unprivileged_userns_clone to whoamiCmd
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>
2015-08-31 16:34:31 +00:00
Dave Cheney
de786965e6 syscall: remove nacl srpc helper
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>
2015-08-28 04:44:44 +00:00
Alexander Morozov
8261c887aa syscall: don't call Setgroups if Credential.Groups is empty
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>
2015-08-27 16:08:01 +00:00
Shawn Walker-Salas
d9e3d16796 runtime, syscall: remove unused bits from Solaris implementation
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>
2015-08-21 11:39:24 +00:00
Dave Cheney
4e15092006 syscall: use fchownat(2) in place of lchown(2) for linux/arm64
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>
2015-07-30 20:30:26 +00:00
Alex Brainman
7ebcf5eac7 syscall: warn not to use FormatMessage
Fixes #11147

Change-Id: Ib31160946a53f6f9b11daea211ff04d186b51b3f
Reviewed-on: https://go-review.googlesource.com/12067
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-21 02:26:27 +00:00
Brad Fitzpatrick
2ae77376f7 all: link to https instead of http
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>
2015-07-11 14:36:33 +00:00
Alex Brainman
0bafe0e5b2 syscall: return error instead of panicking in windows StartProcess
Fixes #11417

Change-Id: Iacea829a48b39df0a4f751b06b19e918fbb713d0
Reviewed-on: https://go-review.googlesource.com/11604
Reviewed-by: Rob Pike <r@golang.org>
2015-06-29 03:54:33 +00:00
Ian Lance Taylor
79d4d6eca4 syscall: skip non-root user namespace test if kernel forbids
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>
2015-06-20 00:52:38 +00:00
Shenghou Ma
3925a7c5db all: switch to the new deprecation convention
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>
2015-06-18 19:16:23 +00:00
Russ Cox
7bc3e58806 all: extract "can I exec?" check from tests into internal/testenv
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>
2015-06-16 18:07:36 +00:00
Ian Lance Taylor
6f0e427298 syscall: fix TestCloneNEWUSERAndRemapNoRootDisableSetgroups the right way
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>
2015-06-15 19:55:22 +00:00
Ian Lance Taylor
0ee92cf9c5 syscall: correct comment on where compileCallback is defined
Fixes #11216.

Change-Id: Iad1f4894c2258909484eaf975b08e0f47a82788e
Reviewed-on: https://go-review.googlesource.com/11098
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-15 03:10:52 +00:00
Ian Lance Taylor
6b24da6ae8 syscall: skip TestCloneNEWUSERAndRemapNoRootDisableSetgroups before 3.19
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>
2015-06-14 01:52:54 +00:00
Alexander Morozov
f5c60ff2da syscall: add GidMappingsEnableSetgroups to Linux SysProcAttr
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>
2015-06-12 23:38:59 +00:00
Ainar Garipov
7f9f70e5b6 all: fix misprints in comments
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>
2015-06-11 14:18:57 +00:00
Austin Clements
2774b37306 all: use RET instead of RETURN on ppc64
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>
2015-06-06 00:07:23 +00:00
Brad Fitzpatrick
d4ed30612c syscall: don't run fcntl child process test on iOS
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>
2015-05-15 16:41:12 +00:00