6974df39a7
Closes #635 newuidmap and newgidmap currently take an integner pid as the first argument, determining the process id on which to act. Accept also "fd:N", where N must be an open file descriptor to the /proc/pid directory for the process to act upon. This way, if you exec 10</proc/99 newuidmap fd:10 100000 0 65536 and pid 99 dies and a new process happens to take pid 99 before newuidmap happens to do its work, then since newuidmap will use openat() using fd 10, it won't change the mapping for the new process. Example: // terminal 1: serge@jerom ~/src/nsexec$ ./nsexec -W -s 0 -S 0 -U about to unshare with 10000000 Press any key to exec (I am 129176) // terminal 2: serge@jerom ~/src/shadow$ exec 10</proc/129176 serge@jerom ~/src/shadow$ sudo chown root src/newuidmap src/newgidmap serge@jerom ~/src/shadow$ sudo chmod u+s src/newuidmap serge@jerom ~/src/shadow$ sudo chmod u+s src/newgidmap serge@jerom ~/src/shadow$ ./src/newuidmap fd:10 0 100000 10 serge@jerom ~/src/shadow$ ./src/newgidmap fd:10 0 100000 10 // Terminal 1: uid=0(root) gid=0(root) groups=0(root) Signed-off-by: Serge Hallyn <serge@hallyn.com> |
||
---|---|---|
.. | ||
.gitignore | ||
.indent.pro | ||
chage.c | ||
check_subid_range.c | ||
chfn.c | ||
chgpasswd.c | ||
chpasswd.c | ||
chsh.c | ||
expiry.c | ||
faillog.c | ||
free_subid_range.c | ||
get_subid_owners.c | ||
getsubids.c | ||
gpasswd.c | ||
groupadd.c | ||
groupdel.c | ||
groupmems.c | ||
groupmod.c | ||
groups.c | ||
grpck.c | ||
grpconv.c | ||
grpunconv.c | ||
id.c | ||
lastlog.c | ||
login_nopam.c | ||
login.c | ||
logoutd.c | ||
Makefile.am | ||
new_subid_range.c | ||
newgidmap.c | ||
newgrp.c | ||
newuidmap.c | ||
newusers.c | ||
nologin.c | ||
passwd.c | ||
pwck.c | ||
pwconv.c | ||
pwunconv.c | ||
su.c | ||
suauth.c | ||
sulogin.c | ||
useradd.c | ||
userdel.c | ||
usermod.c | ||
vipw.c |