From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman) Subject: Re: [PATCH 24/43] userns: Convert ptrace, kill, set_priority permission checks to work with kuids and kgids Date: Fri, 20 Apr 2012 16:51:00 -0700 Message-ID: References: <1333862139-31737-24-git-send-email-ebiederm@xmission.com> <20120418185610.GA5186@mail.hallyn.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20120418185610.GA5186-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org> (Serge E. Hallyn's message of "Wed, 18 Apr 2012 18:56:10 +0000") 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 To: "Serge E. Hallyn" 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 List-Id: containers.vger.kernel.org "Serge E. Hallyn" writes: > Quoting Eric W. Beiderman (ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org): >> From: Eric W. Biederman >> >> Update the permission checks to use the new uid_eq and gid_eq helpers >> and remove the now unnecessary user_ns equality comparison. >> >> Signed-off-by: Eric W. Biederman >> --- >> @@ -1389,10 +1388,8 @@ static int kill_as_cred_perm(const struct cred *cred, >> struct task_struct *target) >> { >> const struct cred *pcred = __task_cred(target); >> - if (cred->user_ns != pcred->user_ns) >> - return 0; >> - if (cred->euid != pcred->suid && cred->euid != pcred->uid && >> - cred->uid != pcred->suid && cred->uid != pcred->uid) >> + if (uid_eq(cred->euid, pcred->suid) && uid_eq(cred->euid, pcred->uid) && > > These should be !uid_eq() right? >> + uid_eq(cred->uid, pcred->suid) && uid_eq(cred->uid, >pcred->uid)) Yes. Thank you for catching this. This kind of mistake is unfortunately much to easy to make. Eric