Re: [PATCH v3 19/25] commoncap: handle fsid mappings with vfs caps

From: Jann Horn
Date: Wed Feb 19 2020 - 10:54:18 EST


On Tue, Feb 18, 2020 at 3:35 PM Christian Brauner
<christian.brauner@xxxxxxxxxx> wrote:
> Switch vfs cap helpers to lookup fsids in the fsid mappings. If no fsid
> mappings are setup the behavior is unchanged, i.e. fsids are looked up in the
> id mappings.
[...]
> diff --git a/security/commoncap.c b/security/commoncap.c
[...]
> @@ -328,7 +328,7 @@ static bool rootid_owns_currentns(kuid_t kroot)
> return false;
>
> for (ns = current_user_ns(); ; ns = ns->parent) {
> - if (from_kuid(ns, kroot) == 0)
> + if (from_kfsuid(ns, kroot) == 0)
> return true;
> if (ns == &init_user_ns)
> break;

Nit: Maybe change the name of this function to something that makes it
clear that this operates in the fsuid mapping domain.