Re: [PATCH] cred - synchronize rcu before releasing cred

From: Linus Torvalds
Date: Tue Jul 27 2010 - 12:16:48 EST


On Tue, Jul 27, 2010 at 8:50 AM, Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
>
> got no objections on linux-security-module and acked by David.
> Noone pick it, so got advice to send this directly to you.

The patch seems fundamentally buggy.

The whole patch seems to be based on "nobody can ever use
get_cred/put_cred, because concurrent use will then trigger the
BUG_ON() in __put_cred()".

But that's a bug in general, not in this particular usage that isn't
all that different from other uses. So rather than just remove the
code that uses the refcounting, we should either:

- FIX the damn ref-counting so that it works without bugging out

or

- remove the broken functions entirely.

In other words - why are we working around what looks like a bug,
rather than fixing the bug itself?

In particular, the code you remove seems to be basically _identical_
to get_task_cred(). So if the code you remove is buggy, then so is any
use of get_task_cred() - no?

So please explain why get_task_cred() is ok, but the particular use of
get_cred/put_cred that you removed is not.

Hmm? What am I missing?

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