]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/start.c
start: fix execute and improve setgroups() calls
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 2 Jan 2017 14:14:22 +0000 (15:14 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sat, 7 Jan 2017 10:18:22 +0000 (11:18 +0100)
commitd08f8d2f74c7407c40fc80e3878d631bd8f50214
treec48928dc421f1b3d9636e19e8c1e4ab1e309d621
parentdbaf55a35377e1aa497ffc22de528e76c237b0fd
start: fix execute and improve setgroups() calls

lxc_execute() and lxc-execute where broken when a user tried to switch to a
non-root uid/gid. This prevented necessary setup operations like mounting the
rootfs which require root in the user namespace. This commit separates
switching to root in the user namespace from switching to the requested uid/gid
by lxc_execute().
This should be safe: Once we switched to root in the user namespace via
setuid() and then switch to a non-root uid/gid in the user namespace for
lxc_execute() via setuid() we cannot regain root privileges again. So we can
only make us safer (Unless I forget about some very intricate user namespace
nonsense; which is not as unlikely as I try to make it sound.).

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/start.c