Re: [RFC PATCH v5 02/25] userns: Add userns_set_idmap() system call

From: Jarkko Sakkinen

Date: Sat Nov 21 2026 - 11:09:58 EST


On Sat, Nov 21, 2026 at 02:08:21AM +0200, Jarkko Sakkinen wrote:
> Configuring UID, GID, and project ID mappings currently requires writing
> formatted text to /proc/<pid>/{uid_map,gid_map,projid_map,setgroups},
> which depends on a live task in /proc and enforces write(2) file-opener
> CAP_SETUID/CAP_SETGID checks that prevent passing an unprivileged userns
> file descriptor over SCM_RIGHTS to a dedicated CAP_SETUID/CAP_SETGID
> mapping helper.
>
> Add userns_set_idmap() to atomically configure setgroups policy and UID,
> GID, and project ID extents directly on a CLONE_NEWUSER nsfs file
> descriptor. Require CAP_SYS_ADMIN over the target user namespace in
> either the caller's or the file opener's credentials, and check parent
> ID-range capabilities strictly against the caller's credentials.
>
> Signed-off-by: Jarkko Sakkinen <jarkko@xxxxxxxxxx>

I'll remove the flags. I forgot to remove them from final version.

Br, Jarkko