[OpenAFS-devel] keyring/pag support for linux

David Howells dhowells@redhat.com
Tue, 18 Jul 2006 14:53:12 +0100


chas williams <chas@cmf.nrl.navy.mil> wrote:

> but we cant get access to these routines from a kernel module

It might be possible if you'll tell me what you want.

The problem I've got is that I discussed this with another kernel engineer who,
when I mentioned this was for OpenAFS, promised that he'd get Linus to revert
any patch I put any specifically for OpenAFS.  As far as he's concerned, it's
illegal to load OpenAFS into the kernel because you violate the licence:-(

Also, if you're referring to the user-defined key routines, you can't call them
any more from a non-GPL module because they now use RCU, and you can't use RCU
in OpenAFS because it's not GPL.  I can give you a copy of the old user-defined
routines under the IPL, which you can then include in OpenAFS if you want,
though really, if you're only holding a PAG ID, then you can store a 32-bit
number in the key struct directly rather than having an auxiliary payload -
which is what I see you're doing in your patch.

Btw, I would make your key use 0 as the data length for quota purposes since
you have no data allocated beyond the core stuff, ad that's accounted
separately.

> the drawback to this, is that you need the keyutils library (and any
> program using setpag() will need to link with the keyutils as well).

That can be worked around; you can invoke the system call directly with
syscall().  The main reason for requiring libkeyutils is that the keyctl
syscalls aren't in glibc:

	#include <sys/syscall.h>
	#include <unistd.h>

	...
	 syscall(SYS_add_key, "afspag", desc, (void *) &pag,
	 	sizeof(afs_uint32), KEY_SPEC_SESSION_KEYRING);		
	...

David