]> git.ipfire.org Git - thirdparty/shadow.git/commit
libmisc: retain setfcap when mapping uid 0 334/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 6 May 2021 16:59:28 +0000 (18:59 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 6 May 2021 17:04:42 +0000 (19:04 +0200)
commit91d4ab622b8c49d639985b940964be29ab62a824
tree82651c60f3142adffde605ebc3a5d02ec784c0c8
parente6416fd81bff205f9daac3da02cb3392d3d75e58
libmisc: retain setfcap when mapping uid 0

When uid 0 maps host uid 0 into the child userns newer kernels require
CAP_SETFCAP be retained as this allows the caller to create fscaps that
are valid in the ancestor userns. This was a security issue (in very
rare circumstances). So whenever host uid 0 is mapped, retain
CAP_SETFCAP if the caller had it.
Userspace won't need to set CAP_SETFCAP on newuidmap as this is really
only a scenario that real root should be doing which always has
CAP_SETFCAP. And if they don't then they are in a locked-down userns.
(LXC sometimes maps host uid 0 during chown operations in a helper
 userns but will not rely on newuidmap for that. But we don't want to
 risk regressing callers that want to rely on this behavior.)

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
libmisc/idmapping.c