Re: [RFC] call_with_creds()

From: Linus Torvalds
Date: Wed Jul 18 2018 - 15:54:03 EST


On Wed, Jul 18, 2018 at 12:46 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> Huh? Nevermind ->write(), what about open()?

What about open?

At open time, file->f_cred is the same as current_cred().

So yes, open uses current cred. What's the problem?

Now, if you then use a tasklet or some other thread to do the open,
then obviously that is no longer true. But then the problem is that
you're doing the open() itself in the wrong context, and that has
nothing to do with any general issue, and everything to do with "you
changed to another context without pulling all the context data with
you - you're buggy". Doing some kind of "call_with_creds()" isn't the
solultion - it's just part of the whole thing (what about user
accounting etc? If you switch to another thread to do the work, you
have way more issues than just creds).

Linus