Re: [PATCH 5/6] kdbus: pin namespaces on HELLO

From: David Herrmann
Date: Sun Jul 05 2015 - 05:07:38 EST


Hi

On Fri, Jul 3, 2015 at 11:44 PM, Sergei Zviagintsev <sergei@xxxxxxxx> wrote:
> On Thu, Jul 02, 2015 at 10:28:33AM +0200, David Herrmann wrote:
>> /*
>> - * This translates the effective capabilities of 'cred' into the current
>> - * user-namespace. If the current user-namespace is a child-namespace of
>> + * This translates the effective capabilities of 'cred' into the given
>> + * user-namespace. If the given user-namespace is a child-namespace of
>> * the user-namespace of 'cred', the mask can be copied verbatim. If
>> * not, the mask is cleared.
>> * There's one exception: If 'cred' is the owner of any user-namespace
>> - * in the path between the current user-namespace and the user-namespace
>> + * in the path between the given user-namespace and the user-namespace
>> * of 'cred', then it has all effective capabilities set. This means,
>> * the user who created a user-namespace always has all effective
>> * capabilities in any child namespaces. Note that this is based on the
>> * uid of the namespace creator, not the task hierarchy.
>> */
>> - for (iter = current_user_ns(); iter; iter = iter->parent) {
>> + for (iter = user_ns; iter; iter = iter->parent) {
>
> Is check `iter' for being not NULL is needed here? I mean, `iter' takes
> range from `user_ns' (which is cred->user_ns) to &init_user_ns.

This patch does not change the logic of this lookup, but only the
source of the user-namespace. Hence, a change of this loop-head would
be inappropriate.
Nevertheless, I prefer being rather safe than sorry here, so I don't
mind the current code.

Thanks
David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/