Re: [RFC] call_with_creds()
From: Linus Torvalds
Date: Wed Jul 18 2018 - 19:13:59 EST
On Wed, Jul 18, 2018 at 2:28 PM David Howells <dhowells@xxxxxxxxxx> wrote:
>
> Are network filesystems allowed to use f_cred at I/O time to determine the
> authentication/encryption parameters to commune with the server?
Absolutely. file->f_cred is very much "what was my ID at open time".
Of course, you may well have reasons why you actually want to cache
the key itself (and hide it in private_data or similar rather than
look it up, but if looking it up by uid is ok, then file->f_cred is
ok.
And if you check permissions at IO time (again using file->f_cred),
that's ok from a kernel perspective, but it's not really
POSIX-compliant. But obviously a lot of netrwork filesystems aren't
posix-compliant anyway.
Linus