Re: [PATCH 24/43] userns: Convert ptrace, kill, set_priority permission checks to work with kuids and kgids

From: Eric W. Biederman
Date: Fri Apr 20 2012 - 19:47:00 EST


"Serge E. Hallyn" <serge@xxxxxxxxxx> writes:

> Quoting Eric W. Beiderman (ebiederm@xxxxxxxxxxxx):
>> From: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>
>>
>> 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 <ebiederm@xxxxxxxxxxxx>
>> ---

>> @@ -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
--
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/