[PATCH] futex: futex_find_get_task make credentials checkconditional

From: Michal Hocko
Date: Tue Jun 29 2010 - 04:42:45 EST


On Mon 28-06-10 18:49:08, Peter Zijlstra wrote:
> On Mon, 2010-06-28 at 18:39 +0200, Michal Hocko wrote:
> > Would something like the following be acceptable (just a compile
> > tested without comments). It simply makes caller of lookup_pi_state to
> > decide whether credentials should be checked.
>
> So it was Ingo, who in c87e2837be8 (pi-futex:
> futex_lock_pi/futex_unlock_pi support) introduced the euid checks:
>
> +futex_find_get_task():
> + if ((current->euid != p->euid) && (current->euid != p->uid)) {
> + p = NULL;
> + goto out_unlock;
> + }
>
> Ingo, do you remember the rationale behind that? It seems to be causing
> grief when two different users contend on the same (shared) futex.
>
> See the below proposed solution.

Here is the patch with comments and rationale:
(reference to the original discussion: http://lkml.org/lkml/2010/6/23/52)

--