1
0
mirror of https://github.com/golang/go synced 2024-11-06 04:26:11 -07:00
go/src/syscall
Ronald G. Minnich d8ed449d8e os/exec: handle Unshareflags with CLONE_NEWNS
In some newer Linux distros, systemd forces
all mount namespaces to be shared, starting
at /. This disables the CLONE_NEWNS
flag in unshare(2) and clone(2).
While this problem is most commonly seen
on systems with systemd, it can happen anywhere,
due to how Linux namespaces now work.

Hence, to create a private mount namespace,
it is not sufficient to just set
CLONE_NEWS; you have to call mount(2) to change
the behavior of namespaces, i.e.
mount("none", "/", NULL, MS_REC|MS_PRIVATE, NULL)

This is tested and working and we can now correctly
start child process with private namespaces on Linux
distros that use systemd.

The new test works correctly on Ubuntu 16.04.2 LTS.
It fails if I comment out the new Mount, and
succeeds otherwise. In each case it correctly
cleans up after itself.

Fixes #19661

Change-Id: I52240b59628e3772b529d9bbef7166606b0c157d
Reviewed-on: https://go-review.googlesource.com/38471
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-23 17:53:18 +00:00
..
asm9_unix1_amd64.s all: fix assembly vet issues 2016-08-25 18:52:31 +00:00
asm9_unix2_amd64.s all: fix assembly vet issues 2016-08-25 18:52:31 +00:00
asm_darwin_386.s
asm_darwin_amd64.s
asm_darwin_arm64.s all: fix assembly vet issues 2016-08-25 18:52:31 +00:00
asm_darwin_arm.s runtime, syscall: appease vet 2016-10-25 15:11:54 +00:00
asm_freebsd_arm.s
asm_linux_386.s
asm_linux_amd64.s syscall: use CLONE_VFORK and CLONE_VM 2017-03-22 23:53:01 +00:00
asm_linux_arm64.s
asm_linux_arm.s
asm_linux_mips64x.s
asm_linux_mipsx.s syscall: fix linux/mipsx ret value FP offsets for Syscall9 2017-02-21 18:43:02 +00:00
asm_linux_ppc64x.s
asm_linux_s390x.s
asm_nacl_386.s
asm_nacl_amd64p32.s
asm_nacl_arm.s
asm_netbsd_arm.s
asm_openbsd_arm.s all: fix assembly vet issues 2016-08-25 18:52:31 +00:00
asm_plan9_386.s syscall: use name+(NN)FP on plan9/386 2016-10-25 22:13:29 +00:00
asm_plan9_amd64.s syscall: use name+(NN)FP on plan9/amd64 2016-10-25 22:13:35 +00:00
asm_plan9_arm.s
asm_solaris_amd64.s
asm_unix_386.s all: fix assembly vet issues 2016-08-25 18:52:31 +00:00
asm_unix_amd64.s all: fix assembly vet issues 2016-08-25 18:52:31 +00:00
bpf_bsd.go
const_plan9.go syscall: define bind flags on Plan 9 2016-11-15 18:19:10 +00:00
creds_test.go
dir_plan9.go all: spell "marshal" and "unmarshal" consistently 2016-11-12 00:13:35 +00:00
dirent.go syscall: validate ParseDirent inputs 2016-09-20 19:27:57 +00:00
dll_windows.go syscall: delete the "use" function and calls in non-generated files. 2017-02-13 19:58:05 +00:00
endian_big.go syscall: add support for GOARCH=mips{,le} 2016-11-03 23:02:18 +00:00
endian_little.go syscall: add support for GOARCH=mips{,le} 2016-11-03 23:02:18 +00:00
env_plan9.go
env_unix.go
env_windows.go syscall: Clearenv now unsets env vars on Windows 2016-11-14 00:04:03 +00:00
errors_plan9.go
exec_bsd.go syscall, os: use pipe2 syscall on FreeBSD instead of pipe 2017-03-21 20:01:23 +00:00
exec_freebsd.go syscall, os: fix FreeBSD 9 build 2017-03-21 22:37:27 +00:00
exec_linux_test.go os/exec: handle Unshareflags with CLONE_NEWNS 2017-03-23 17:53:18 +00:00
exec_linux.go os/exec: handle Unshareflags with CLONE_NEWNS 2017-03-23 17:53:18 +00:00
exec_plan9.go syscall: delete unreachable code 2016-08-22 19:50:49 +00:00
exec_solaris_test.go
exec_solaris.go syscall: only call setgroups if we need to 2017-02-17 14:36:27 +00:00
exec_unix_test.go
exec_unix.go syscall: only call setgroups if we need to 2017-02-17 14:36:27 +00:00
exec_windows.go syscall: delete unreachable code 2016-08-22 19:50:49 +00:00
export_test.go
export_unix_test.go
fd_nacl.go
flock_linux_32bit.go syscall: add support for GOARCH=mips{,le} 2016-11-03 23:02:18 +00:00
flock.go
forkpipe_bsd.go syscall, os: use pipe2 syscall on FreeBSD instead of pipe 2017-03-21 20:01:23 +00:00
fs_nacl.go
lsf_linux.go
mkall.sh syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
mkerrors.sh
mkpost.go syscall: export Fsid.X__val on s390x 2017-01-13 19:31:47 +00:00
mksyscall_solaris.pl syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
mksyscall_windows.go syscall: use ERROR_IO_PENDING value in errnoErr 2016-10-22 23:05:01 +00:00
mksyscall.pl syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
mksysctl_openbsd.pl
mksysnum_darwin.pl
mksysnum_dragonfly.pl
mksysnum_freebsd.pl
mksysnum_linux.pl syscall: add support for GOARCH=mips{,le} 2016-11-03 23:02:18 +00:00
mksysnum_netbsd.pl
mksysnum_openbsd.pl
mksysnum_plan9.sh
mmap_unix_test.go
msan0.go
msan.go
net_nacl.go syscall, net: make deadline changes affect blocked read/write calls on nacl 2016-10-17 05:53:00 +00:00
netlink_linux.go syscall: add bounds checking and error returns to ParseNetlinkMessage 2016-09-14 08:42:28 +00:00
pwd_plan9.go
route_bsd.go
route_darwin.go
route_dragonfly.go
route_freebsd_32bit.go
route_freebsd_64bit.go
route_freebsd.go
route_netbsd.go
route_openbsd.go
security_windows.go
setuidgid_32_linux.go syscall: use 32-bit setuid/setgid syscalls on linux/{386,arm} 2016-11-09 21:50:55 +00:00
setuidgid_linux.go syscall: use 32-bit setuid/setgid syscalls on linux/{386,arm} 2016-11-09 21:50:55 +00:00
sockcmsg_linux.go syscall: validate ParseUnixCredentials inputs 2016-08-20 21:12:07 +00:00
sockcmsg_unix.go syscall: fix Send{msg,msgN}, Recvmsg and control message handling on solaris 2016-10-03 23:53:42 +00:00
str.go
syscall_bsd_test.go syscall: use MNT_NOWAIT in TestGetfsstat 2016-09-07 00:58:19 +00:00
syscall_bsd.go
syscall_darwin_386.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
syscall_darwin_amd64.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
syscall_darwin_arm64.go syscall: update darwin/amd64 for timespec change 2016-10-12 23:51:42 +00:00
syscall_darwin_arm.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
syscall_darwin.go syscall: delete the "use" function and calls in non-generated files. 2017-02-13 19:58:05 +00:00
syscall_dragonfly_amd64.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
syscall_dragonfly.go syscall: delete the "use" function and calls in non-generated files. 2017-02-13 19:58:05 +00:00
syscall_freebsd_386.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
syscall_freebsd_amd64.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
syscall_freebsd_arm.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
syscall_freebsd.go syscall, os: fix FreeBSD 9 build 2017-03-21 22:37:27 +00:00
syscall_linux_386.go syscall: use CLONE_VFORK and CLONE_VM 2017-03-22 23:53:01 +00:00
syscall_linux_amd64.go syscall: use CLONE_VFORK and CLONE_VM 2017-03-22 23:53:01 +00:00
syscall_linux_arm64.go syscall: use CLONE_VFORK and CLONE_VM 2017-03-22 23:53:01 +00:00
syscall_linux_arm.go syscall: use CLONE_VFORK and CLONE_VM 2017-03-22 23:53:01 +00:00
syscall_linux_mips64x.go syscall: use CLONE_VFORK and CLONE_VM 2017-03-22 23:53:01 +00:00
syscall_linux_mipsx.go syscall: use CLONE_VFORK and CLONE_VM 2017-03-22 23:53:01 +00:00
syscall_linux_ppc64x.go syscall: use CLONE_VFORK and CLONE_VM 2017-03-22 23:53:01 +00:00
syscall_linux_s390x.go syscall: use CLONE_VFORK and CLONE_VM 2017-03-22 23:53:01 +00:00
syscall_linux_test.go syscall: add bounds checking and error returns to ParseNetlinkMessage 2016-09-14 08:42:28 +00:00
syscall_linux.go syscall: delete the "use" function and calls in non-generated files. 2017-02-13 19:58:05 +00:00
syscall_nacl_386.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
syscall_nacl_amd64p32.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
syscall_nacl_arm.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
syscall_nacl.go net: add Buffers type, do writev on unix 2016-09-29 20:33:45 +00:00
syscall_netbsd_386.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
syscall_netbsd_amd64.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
syscall_netbsd_arm.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
syscall_netbsd.go syscall: validate ParseDirent inputs 2016-09-20 19:27:57 +00:00
syscall_no_getwd.go
syscall_openbsd_386.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
syscall_openbsd_amd64.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
syscall_openbsd_arm.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
syscall_openbsd.go syscall: validate ParseDirent inputs 2016-09-20 19:27:57 +00:00
syscall_plan9.go syscall: delete the "use" function and calls in non-generated files. 2017-02-13 19:58:05 +00:00
syscall_solaris_amd64.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
syscall_solaris.go syscall: add Getexecname on Solaris for os.Executable 2016-11-07 20:18:29 +00:00
syscall_test.go syscall: test Gettimeofday everywhere, not just on Darwin 2016-08-16 00:17:21 +00:00
syscall_unix_test.go syscall: fix Send{msg,msgN}, Recvmsg and control message handling on solaris 2016-10-03 23:53:42 +00:00
syscall_unix.go syscall: fix Send{msg,msgN}, Recvmsg and control message handling on solaris 2016-10-03 23:53:42 +00:00
syscall_windows_386.go
syscall_windows_amd64.go
syscall_windows_test.go
syscall_windows.go os, syscall: fix incorrect offset calculation in Readlink on windows 2016-10-19 01:25:18 +00:00
syscall.go syscall: delete the "use" function and calls in non-generated files. 2017-02-13 19:58:05 +00:00
tables_nacl.go
time_nacl_386.s
time_nacl_amd64p32.s
time_nacl_arm.s
timestruct.go syscall: unify NsecToTime{spec,val}, fix for times < 1970 2016-10-12 13:10:54 +00:00
types_darwin.go
types_dragonfly.go
types_freebsd.go
types_linux.go syscall: add support for GOARCH=mips{,le} 2016-11-03 23:02:18 +00:00
types_netbsd.go
types_openbsd.go
types_solaris.go
unzip_nacl.go
zerrors_darwin_386.go
zerrors_darwin_amd64.go
zerrors_darwin_arm64.go
zerrors_darwin_arm.go
zerrors_dragonfly_amd64.go
zerrors_freebsd_386.go
zerrors_freebsd_amd64.go
zerrors_freebsd_arm.go
zerrors_linux_386.go
zerrors_linux_amd64.go
zerrors_linux_arm64.go
zerrors_linux_arm.go
zerrors_linux_mips64.go
zerrors_linux_mips64le.go
zerrors_linux_mips.go syscall: add support for GOARCH=mips{,le} 2016-11-03 23:02:18 +00:00
zerrors_linux_mipsle.go syscall: add support for GOARCH=mips{,le} 2016-11-03 23:02:18 +00:00
zerrors_linux_ppc64.go
zerrors_linux_ppc64le.go
zerrors_linux_s390x.go
zerrors_netbsd_386.go
zerrors_netbsd_amd64.go
zerrors_netbsd_arm.go
zerrors_openbsd_386.go
zerrors_openbsd_amd64.go
zerrors_openbsd_arm.go
zerrors_solaris_amd64.go
zerrors_windows_386.go
zerrors_windows_amd64.go
zerrors_windows.go
zsyscall_darwin_386.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_darwin_amd64.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_darwin_arm64.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_darwin_arm.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_dragonfly_amd64.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_freebsd_386.go syscall, os: fix FreeBSD 9 build 2017-03-21 22:37:27 +00:00
zsyscall_freebsd_amd64.go syscall, os: fix FreeBSD 9 build 2017-03-21 22:37:27 +00:00
zsyscall_freebsd_arm.go syscall, os: fix FreeBSD 9 build 2017-03-21 22:37:27 +00:00
zsyscall_linux_386.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_linux_amd64.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_linux_arm64.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_linux_arm.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_linux_mips64.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_linux_mips64le.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_linux_mips.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_linux_mipsle.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_linux_ppc64.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_linux_ppc64le.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_linux_s390x.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_nacl_386.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_nacl_amd64p32.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_nacl_arm.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_netbsd_386.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_netbsd_amd64.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_netbsd_arm.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_openbsd_386.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_openbsd_amd64.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_openbsd_arm.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_plan9_386.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_plan9_amd64.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_plan9_arm.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_solaris_amd64.go syscall: remove "use" function and calls from generated code. 2017-02-09 18:30:49 +00:00
zsyscall_windows.go syscall: use ERROR_IO_PENDING value in errnoErr 2016-10-22 23:05:01 +00:00
zsysctl_openbsd.go
zsysnum_darwin_386.go
zsysnum_darwin_amd64.go
zsysnum_darwin_arm64.go
zsysnum_darwin_arm.go
zsysnum_dragonfly_amd64.go
zsysnum_freebsd_386.go
zsysnum_freebsd_amd64.go
zsysnum_freebsd_arm.go
zsysnum_linux_386.go
zsysnum_linux_amd64.go
zsysnum_linux_arm64.go
zsysnum_linux_arm.go
zsysnum_linux_mips64.go
zsysnum_linux_mips64le.go
zsysnum_linux_mips.go syscall: add support for GOARCH=mips{,le} 2016-11-03 23:02:18 +00:00
zsysnum_linux_mipsle.go syscall: add support for GOARCH=mips{,le} 2016-11-03 23:02:18 +00:00
zsysnum_linux_ppc64.go
zsysnum_linux_ppc64le.go
zsysnum_linux_s390x.go
zsysnum_netbsd_386.go
zsysnum_netbsd_amd64.go
zsysnum_netbsd_arm.go
zsysnum_openbsd_386.go runtime, syscall: update openbsd for changes to syskill 2016-12-12 01:30:39 +00:00
zsysnum_openbsd_amd64.go runtime, syscall: update openbsd for changes to syskill 2016-12-12 01:30:39 +00:00
zsysnum_openbsd_arm.go runtime, syscall: update openbsd for changes to syskill 2016-12-12 01:30:39 +00:00
zsysnum_plan9.go
zsysnum_solaris_amd64.go
zsysnum_windows_386.go
zsysnum_windows_amd64.go
ztypes_darwin_386.go
ztypes_darwin_amd64.go
ztypes_darwin_arm64.go
ztypes_darwin_arm.go
ztypes_dragonfly_amd64.go
ztypes_freebsd_386.go
ztypes_freebsd_amd64.go
ztypes_freebsd_arm.go
ztypes_linux_386.go syscall: remove X__cmsg_data from Cmsghdr 2016-10-30 19:04:09 +00:00
ztypes_linux_amd64.go syscall: remove X__cmsg_data from Cmsghdr 2016-10-30 19:04:09 +00:00
ztypes_linux_arm64.go syscall: remove X__cmsg_data from Cmsghdr 2016-10-30 19:04:09 +00:00
ztypes_linux_arm.go syscall: remove X__cmsg_data from Cmsghdr 2016-10-30 19:04:09 +00:00
ztypes_linux_mips64.go syscall: remove X__cmsg_data from Cmsghdr 2016-10-30 19:04:09 +00:00
ztypes_linux_mips64le.go syscall: remove X__cmsg_data from Cmsghdr 2016-10-30 19:04:09 +00:00
ztypes_linux_mips.go syscall: add support for GOARCH=mips{,le} 2016-11-03 23:02:18 +00:00
ztypes_linux_mipsle.go syscall: add support for GOARCH=mips{,le} 2016-11-03 23:02:18 +00:00
ztypes_linux_ppc64.go syscall: remove X__cmsg_data from Cmsghdr 2016-10-30 19:04:09 +00:00
ztypes_linux_ppc64le.go syscall: remove X__cmsg_data from Cmsghdr 2016-10-30 19:04:09 +00:00
ztypes_linux_s390x.go syscall: export Fsid.X__val on s390x 2017-01-13 19:31:47 +00:00
ztypes_netbsd_386.go
ztypes_netbsd_amd64.go
ztypes_netbsd_arm.go
ztypes_openbsd_386.go
ztypes_openbsd_amd64.go
ztypes_openbsd_arm.go
ztypes_solaris_amd64.go
ztypes_windows_386.go
ztypes_windows_amd64.go
ztypes_windows.go os, syscall: fix incorrect offset calculation in Readlink on windows 2016-10-19 01:25:18 +00:00