Re: [PATCH 2/2] creds: __task_cred(current) doesn't need rcu_read_lock_held()

From: David Howells
Date: Tue Sep 20 2011 - 12:51:12 EST


Oleg Nesterov <oleg@xxxxxxxxxx> wrote:

> > > - rcu_dereference_protected(current->cred, 1)
> >
> > and:
> >
> > > - rcu_dereference_check(__t->real_cred, 0); \
> >
> > you'll notice they aren't quite the same in one very fundamental way.
>
> Do you mean that this patch adds the unnecessary ACCESS_ONCE +
> smp_read_barrier_depends() to current_cred() or I missed something
> else?

Something else. The current_cred() uses ->cred:

* current_cred - Access the current task's subjective credentials

and __task_cred() uses ->real_cred:

* __task_cred - Access a task's objective credentials

Ordinarily both pointers will point to the same set of creds, but this change
will break anything that uses override_creds() + revert_creds() such as
faccessat() and fscache.

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