On Tue, Jun 4, 2019 at 9:35 AM David Howells <dhowells@xxxxxxxxxx> 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