lkml.org 
[lkml]   [2015]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 5/6] kdbus: pin namespaces on HELLO
From
Hi

On Fri, Jul 3, 2015 at 11:44 PM, Sergei Zviagintsev <sergei@s15v.net> 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


\
 
 \ /
  Last update: 2015-07-05 11:21    [W:0.058 / U:2.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site