From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Serge E. Hallyn" Subject: Re: [PATCH 21/43] userns: Convert sched_set_affinity and sched_set_scheduler's permission checks Date: Wed, 18 Apr 2012 18:50:07 +0000 Message-ID: <20120418185006.GF4984__18816.4748986766$1334775042$gmane$org@mail.hallyn.com> References: <1333862139-31737-21-git-send-email-ebiederm@xmission.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1333862139-31737-21-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 To: "Eric W. Beiderman" Cc: Linux Containers , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Cyrill Gorcunov , linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Al Viro , linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Andrew Morton , Linus Torvalds List-Id: containers.vger.kernel.org Quoting Eric W. Beiderman (ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org): > From: Eric W. Biederman > > - Compare kuids with uid_eq > - kuid are uniuqe across all user namespaces so there is no longer the > need for a user_namespace comparison. > > Signed-off-by: Eric W. Biederman Acked-by: Serge Hallyn > --- > kernel/sched/core.c | 7 ++----- > 1 files changed, 2 insertions(+), 5 deletions(-) > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 96bff85..b189fec 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -4042,11 +4042,8 @@ static bool check_same_owner(struct task_struct *p) > > rcu_read_lock(); > pcred = __task_cred(p); > - if (cred->user_ns == pcred->user_ns) > - match = (cred->euid == pcred->euid || > - cred->euid == pcred->uid); > - else > - match = false; > + match = (uid_eq(cred->euid, pcred->euid) || > + uid_eq(cred->euid, pcred->uid)); > rcu_read_unlock(); > return match; > } > -- > 1.7.2.5 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/