[PATCH 1/8] security: Override creds in __fput() with last fputter's creds [ver #2]

Andy Lutomirski luto at kernel.org
Tue Jun 4 18:15:14 UTC 2019


On Tue, Jun 4, 2019 at 9:35 AM David Howells <dhowells at redhat.com> wrote:
>
> So that the LSM can see the credentials of the last process to do an fput()
> on a file object when the file object is being dismantled, do the following
> steps:
>
>  (1) Cache the current credentials in file->f_fput_cred at the point the
>      file object's reference count reaches zero.

I don't think it's valid to capture credentials in close().  This
sounds very easy to spoof, especially when you consider that you can
stick an fd in unix socket and aim it at a service that's just going
to ignore it and close it.

IOW I think this is at least as invalid as looking at current_cred()
in write(), which is a classic bug that gets repeated regularly.

--Andy



More information about the Linux-security-module-archive mailing list