[OpenAFS-devel] keyring/pag support for linux
David Howells
dhowells@redhat.com
Wed, 02 Aug 2006 15:09:42 +0100
chas williams - CONTRACTOR <chas@cmf.nrl.navy.mil> wrote:
> and yet another version. this time, you dont (or shouldnt) need changes
> to your local kernel tree. we have our own version of join_session_keyring()
> which uses the public bits of the keyring api and a bit of information from
> task 1 to allocate and link a new session keyring.
I like your ingenuity:-)
> what we really need from the linux kernel: the keyring key_type exported,
Whilst I could do that, I'm not sure it'd help you as you'd need to use the
RCU interface to access keyrings directly.
> the keyring primitives exported,
That should be possible for the most part. Which ones were you thinking of?
> or join_session_keyring() exported.
That should be possible.
You could also use something like:
#include <asm/unistd.h>
static inline _syscall2(long, keyctl, int, option, void*, arg2)
long serial = keyctl(KEYCTL_JOIN_SESSION_KEYRING, NULL);
Which isn't very nice, but which ought to work.
> the first time might suffer a bit when it comes to safely inserting the
> session_key into the user task since the rcu primitives are not available to
> openafs, so the third option is preferred.
The first is a definite no-go if you can't use RCU - you could cause other
parts of the kernel to oops.
Another alternative might be to try putting the PAG stuff in the main kernel,
and add a keyctl function to set or get a pag.
The main thing I'm not sure about how to do is to change the PAG to which a
process's parent subscribes. It is possible, but the locking is interesting.
David