Re: [PATCH 4/4] keys: make procfiles per-user-namespace

From: Serge E. Hallyn
Date: Thu Feb 26 2009 - 16:50:40 EST


Quoting David Howells (dhowells@xxxxxxxxxx):
> Serge E. Hallyn <serue@xxxxxxxxxx> wrote:
>
> > Restrict the /proc/keys and /proc/key-users output to keys
> > belonging to the same user namespace as the reading task.
> >
> > We may want to make this more complicated - so that any
> > keys in a user-namespace which is belongs to the reading
> > task are also shown. But let's see if anyone wants that
> > first.
>
> Hmmm... I wonder if we can do better by making the file position indicate the
> key ID rather than being a count of the number of keys read. It might make
> this cleaner.

Ok, what I came up with so far is the following. The diffstat
would be far more impressive (in terms of - vs +) if I could
use key_lookup() for proc_keys_start(), but since I need to
return the next greatest key, it seems like I need to do my
own find_ge_key() function.