From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Serge E. Hallyn" Subject: Re: [PATCH 31/43] userns: Teach inode_capable to understand inodes whose uids map to other namespaces. Date: Wed, 18 Apr 2012 19:06:40 +0000 Message-ID: <20120418190640.GI5186@mail.hallyn.com> References: <1333862139-31737-31-git-send-email-ebiederm@xmission.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Linux Containers , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Al Viro , Cyrill Gorcunov , Andrew Morton , Linus Torvalds To: "Eric W. Beiderman" Return-path: Content-Disposition: inline In-Reply-To: <1333862139-31737-31-git-send-email-ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org List-Id: linux-fsdevel.vger.kernel.org Quoting Eric W. Beiderman (ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org): > From: Eric W. Biederman > > Signed-off-by: Eric W. Biederman Acked-by: Serge Hallyn > --- > kernel/capability.c | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/kernel/capability.c b/kernel/capability.c > index cc5f071..493d972 100644 > --- a/kernel/capability.c > +++ b/kernel/capability.c > @@ -429,12 +429,14 @@ bool nsown_capable(int cap) > * targeted at it's own user namespace and that the given inode is owned > * by the current user namespace or a child namespace. > * > - * Currently inodes can only be owned by the initial user namespace. > + * Currently we check to see if an inode is owned by the current > + * user namespace by seeing if the inode's owner maps into the > + * current user namespace. > * > */ > bool inode_capable(const struct inode *inode, int cap) > { > struct user_namespace *ns = current_user_ns(); > > - return ns_capable(ns, cap) && (ns == &init_user_ns); > + return ns_capable(ns, cap) && kuid_has_mapping(ns, inode->i_uid); > } > -- > 1.7.2.5 > > _______________________________________________ > Containers mailing list > Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org > https://lists.linuxfoundation.org/mailman/listinfo/containers