util-linux/sys-utils
James Bottomley 854d0fef7f nsenter: enter namespaces in two passes
We have two use cases for user namespaces, one to elevate the
privilege of an unprivileged user, in which case we have to enter the
user namespace before all other namespaces (otherwise there isn't
enough permission to enter any other namespace).  And the other one is
where we're deprivileging a user and thus have to enter the user
namespace last (because that's the point at which we lose the
privileges).  On the first pass, we start at the position one after
the user namespace clearing the file descriptors as we close them
after calling setns().  If setns() fails on the first pass, ignore the
failure assuming that it will succeed after we enter the user
namespace.

Addresses: https://github.com/karelzak/util-linux/issues/315
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-04-22 11:03:01 +02:00
..
.gitignore build-sys: support ./configure ADJTIME_PATH= 2014-06-19 10:30:56 +02:00
Makemodule.am build-sys: remove obsolete comment 2016-04-13 12:29:16 +02:00
blkdiscard.8 blkdiscard: add --zeroout (BLKZEROOUT ioctl) 2016-02-24 15:21:38 +01:00
blkdiscard.c blkdiscard: slice up the recently changed usage text 2016-03-09 12:11:18 +01:00
chcpu.8 docs: bring eight more man pages closer to standard formatting 2014-07-21 10:29:44 +02:00
chcpu.c sys-utils/disk-utils/lib: fix printf format types [cppcheck] 2015-06-25 12:08:45 +02:00
ctrlaltdel.8 ctrlaltdel: tweak the wording in the man page 2016-03-08 14:21:55 +01:00
ctrlaltdel.c ctrlaltdel: use reboot() provided by libc, assuming it is 1-adic. 2015-11-19 12:07:04 +01:00
dmesg.1 dmseg: slightly improve punctuation and formatting of the manpage 2015-11-09 10:03:58 +01:00
dmesg.c dmesg: --notime should not suppress --show-delta 2016-04-16 23:09:26 +01:00
eject.1 docs: restore minus symbols in long opts 2015-01-20 18:15:30 -05:00
eject.c eject: use parse_switch() 2015-02-24 12:08:40 +01:00
fallocate.1 docs: miscellaneous tiny tweaks of man pages 2016-03-17 12:18:54 +01:00
fallocate.c fallocate: fix error message 2015-08-25 15:34:09 +02:00
flock.1 flock: add --verbose option 2015-03-03 19:35:27 +00:00
flock.c textual: adjust grammar and punctuation of some messages 2015-08-03 11:18:56 +02:00
fsfreeze.8 docs: remove obsolete and unneeded comments from man-page files 2015-01-12 11:03:26 +01:00
fsfreeze.c textual: grammarize and harmonize the stat error message 2015-02-02 11:27:10 +01:00
fstab.5 docs: fstab(5) grammar / English fixes, and some other updates 2015-02-27 14:50:16 +01:00
fstrim.8 fstrim: a few tiny tweaks of the man page 2016-03-08 14:21:55 +01:00
fstrim.c misc: fix redundant assignment and reassignments before use [cppcheck] 2015-08-08 07:46:39 +01:00
fstrim.service.in fstrim: add systemd units 2014-04-07 12:38:18 +02:00
fstrim.timer fstrim: systemd timer units should be WantedBy=timers.target 2016-01-12 10:30:36 +01:00
hwclock-cmos.c hwclock: fix iopl implicit declaration warning on alpha 2015-08-24 10:55:44 +02:00
hwclock-rtc.c hwclock: fix format specifier [cppcheck] 2016-01-19 12:59:12 +06:00
hwclock.8.in hwclock.c, hwclock.8.in: new --show format 2016-02-16 19:37:32 -05:00
hwclock.c hwclock: use labs() for long 2016-02-19 11:38:04 +01:00
hwclock.h hwclock: remove referal to deprecated keyboard interface 2014-09-19 19:31:02 +01:00
ipcmk.1 ipcmk: support <size>{K,M,G,...} 2015-07-20 12:05:32 +02:00
ipcmk.c ipcmk: support <size>{K,M,G,...} 2015-07-20 12:05:32 +02:00
ipcrm.1 docs: restore minus symbols in long opts 2015-01-20 18:15:30 -05:00
ipcrm.c build: fix printf warnings for icc (-Wformat-security) 2015-01-21 11:15:19 +01:00
ipcs.1 docs: bring four more man pages closer to standard formatting 2014-07-17 14:01:04 +02:00
ipcs.c ipcs: consolidate output header printing 2016-03-21 21:03:42 +01:00
ipcutils.c ipcs: make static analyzer happy [clang analyze] 2016-03-29 14:02:57 +02:00
ipcutils.h ipcs: ulong -> unsigned long 2016-02-11 12:31:03 +01:00
ldattach.8 docs: restore minus symbols in long opts 2015-01-20 18:15:30 -05:00
ldattach.c ldattach: tiny coding style changes 2015-07-15 15:49:18 +02:00
losetup.8 losetup: correct some formatting in the man page 2016-03-08 14:21:55 +01:00
losetup.c losetup: fix outdated comment 2016-04-18 11:04:16 +02:00
lp.h Imported from util-linux-2.9v tarball. 2006-12-07 00:25:39 +01:00
lscpu-dmi.c lscpu: fix cppcheck warnings 2014-09-16 11:16:09 +02:00
lscpu.1 lscpu: improve spacing and spelling in the man page 2016-03-17 12:18:52 +01:00
lscpu.c lscpu: revert unnecessary path_exist() 2016-03-22 10:31:16 +01:00
lscpu.h lscpu: add s-Par support 2015-02-11 11:46:19 +01:00
lsipc.1 lsipc: tweak a few wordings on the manpage 2015-11-09 10:03:58 +01:00
lsipc.c lsipc: don't free shm data if no shm id is found 2016-03-23 10:52:41 +01:00
lsns.8 lsns: improve formatting and wording of the man page 2015-12-04 11:20:00 +01:00
lsns.c misc: fix printf i386 compiler warnings 2016-03-12 11:28:03 +01:00
mount.8 docs: miscellaneous tiny tweaks of man pages 2016-03-17 12:18:54 +01:00
mount.c mount: try to tell what mount was doing when it failed 2016-04-16 23:09:27 +01:00
mountpoint.1 docs: remove obsolete and unneeded comments from man-page files 2015-01-12 11:03:26 +01:00
mountpoint.c Revert "include sysmacros.h where used" 2016-03-08 14:26:33 +01:00
nsenter.1 Implement support for cgroup namespaces 2016-03-02 17:53:42 -08:00
nsenter.c nsenter: enter namespaces in two passes 2016-04-22 11:03:01 +02:00
pivot_root.8 docs: standardize the phrases for --help and --version in all man pages 2013-10-15 10:28:30 +02:00
pivot_root.c textual: add a docstring to most of the utilities 2015-01-06 11:27:38 +01:00
prlimit.1 docs: fix some spelling errors and typos in man pages 2015-02-27 14:48:56 +01:00
prlimit.c prlimit: cleanup output units 2015-11-05 18:59:00 +01:00
readprofile.8 docs: don't use bold or italics for "[option]" in synopsis of man pages 2014-12-19 09:57:23 +01:00
readprofile.c readprofile: add scanf field width limits [cppcheck] 2016-01-19 12:59:12 +06:00
renice.1 docs: mention nice(1) in renice(1) manual page 2015-02-02 11:27:10 +01:00
renice.c textual: add a docstring to most of the utilities 2015-01-06 11:27:38 +01:00
rtcwake.8.in rtcwake: add --list-modes 2015-06-29 13:39:37 +02:00
rtcwake.c misc: fix some includes 2016-02-29 13:04:56 +01:00
setarch.8 docs: mention that setarch may not be able to set all listed architectures 2015-01-12 11:33:47 +01:00
setarch.c setarch: add "exec" message to --verbose 2016-03-22 14:13:33 +01:00
setpriv.1 docs: restore minus symbols in long opts 2015-01-20 18:15:30 -05:00
setpriv.c textual: add a docstring to most of the utilities 2015-01-06 11:27:38 +01:00
setsid.1 docs: remove obsolete and unneeded comments from man-page files 2015-01-12 11:03:26 +01:00
setsid.c setsid: fix argument count bug 2016-03-14 13:15:13 +01:00
swapoff.8 build-sys: move swapon from mount/ to sys-utils/ 2012-01-11 12:14:29 +01:00
swapoff.c textual: add a docstring to most of the utilities 2015-01-06 11:27:38 +01:00
swapon-common.c mount, umount, swapon, fsck, lsblk, findmnt: harmonize six error messages 2016-03-16 10:39:38 +01:00
swapon-common.h swapon: split swapon-common.c 2014-09-22 13:16:25 +02:00
swapon.8 swapon: rewrite control struct usage 2016-03-18 14:28:29 +01:00
swapon.c swapon: rewrite control struct usage 2016-03-18 14:28:29 +01:00
switch_root.8 switch_root: document that maintains /run too 2015-01-26 11:45:43 +01:00
switch_root.c textual: grammarize and harmonize the stat error message 2015-02-02 11:27:10 +01:00
tunelp.8 docs: restore minus symbols in long opts 2015-01-20 18:15:30 -05:00
tunelp.c tunelp: use parse_switch() 2015-03-05 10:31:18 +01:00
umount.8 umount: add note about FS names differences to the man page 2016-04-15 10:47:12 +02:00
umount.c mount, umount, swapon, fsck, lsblk, findmnt: harmonize six error messages 2016-03-16 10:39:38 +01:00
unshare.1 Merge branch '2016-03-02/cgns' of https://github.com/hallyn/util-linux 2016-03-21 21:08:05 +01:00
unshare.c Implement support for cgroup namespaces 2016-03-02 17:53:42 -08:00
wdctl.8 docs: restore minus symbols in long opts 2015-01-20 18:15:30 -05:00
wdctl.c textual: add a docstring to most of the utilities 2015-01-06 11:27:38 +01:00
zramctl.8 zramctl: add link to kernel documentation 2015-06-29 12:05:50 +02:00
zramctl.c zramctl: fix typo 2016-01-21 11:21:27 +01:00