Re: [PATCH 10/11] selinux: Implement the watch_key security hook [ver #6]
From: David Howells
Date: Thu Aug 29 2019 - 15:12:03 EST
Stephen Smalley <sds@xxxxxxxxxxxxx> wrote:
> Can watch->cred ever differ from current's cred here? If not, why can't we
> just use current_sid() here
Um. Not currently. I'm not sure whether its ever likely to be otherwise.
Probably we could just use that and fix it up later if we do find otherwise.
> and why do we need the watch object at all?
It carries more than just the creds for the caller of keyctl_watch_key(), it
also carries information about the queue to which notifications will be
written, including the creds that were active when that was set up.
Note that there's no requirement that the process that opened /dev/watch_queue
be the one that sets the watch. In the keyutils testsuite, I 'leak' a file
descriptor from the session wrangler into the program that it runs so that
tests running inside the test script can add watches to it.
David