From: David Howells <dhowells@redhat.com>
To: James Morris <jmorris@redhat.com>
Cc: Andrew Morton <akpm@osdl.org>,
torvalds@osdl.org, linux-kernel@vger.kernel.org,
arjanv@redhat.com, dwmw2@infradead.org, greg@kroah.com,
chrisw@osdl.org, sfrench@samba.org, mike@halcrow.us,
trond.myklebust@fys.uio.no, mrmacman_g4@mac.com
Subject: Re: [PATCH] implement in-kernel keys & keyring management [try #2]
Date: Tue, 10 Aug 2004 19:49:32 +0100 [thread overview]
Message-ID: <7120.1092163772@redhat.com> (raw)
In-Reply-To: <Xine.LNX.4.44.0408091124460.3322-100000@dhcp83-76.boston.redhat.com>
James Morris <jmorris@redhat.com> wrote:
> You write and then read, like the transaction based IO methods in
> selinuxfs (TA_write, TA_read).
Hmmm... You need to consider the fact that you need three or four pieces of
information to create a key: type, description, payload (if there's a payload
- there may not be) and destination keyring ID; and the payload is a binary
blob of data.
I could say that you must do this as a single write of a buffer containing
three NUL terminated strings, one after the other, followed, if present, by a
binary blob...
Maybe I should say you have to use an ioctl()... :-)
> > Maintaining access controls would be fun though... How does the kernel then
> > distinguish between a read and a search?
>
> I guess you'd use normal filsystem access controls instead of storing them
> with the keys themselves. i.e. keyrings are directories, and keys are
> files (or directories with files including metadata and key data). Then
> xattrs could be used to integrate with things like SELinux. A user could
> then use chmod to specify whether a kerying can be searched, for example.
Keyring permissions don't map exactly to file or directory attributes. If
you, for instance, place the key permissions mask on the directory
representing the key/keyring, then search permission controls whether you can
access any file in that directory, which isn't practical.
I think I'd have to keep the key search mask in a separate file under that key
directory, and have you read or write to it rather than using chmod.
chmod() isn't an option, really: key permissions don't really map well to file
permissions. I suppose also key permissions really ought to have more than RWX
permission can handle:
{ read, write, search, subscribe } x { UID, GID, Other }
Currently, I permit subscription (link) to any key for which you have either
read or execute permission.
I also don't really want you to be able to _see_ any key for which you don't
have any permission, so readdir() on /keyfs/ should not report any directory
corresponding to a file you can't see. I should implement this on my
/proc/keys too.
> The main point is that a filesystem API provides several useful framework
> components by default:access control, creat/open/read/write etc. syscalls,
> hierarchical structure and xattrs. Using a filesystem API means not
> inventing yet another class of API.
I think you're wrong:
(1) Making a service like this accessible through a filesystem is as much
creating a new class of API, as is creating new prctl() functions or new
syscalls. It's just an API built on read(), write(), etc. rather than
being on the syscall interface directly.
(2) A filesystem API is _way_ less efficient, though that probably isn't too
much of a problem in this case. You have to do several VFS syscalls to
achieve many things you could just do with a single real syscall.
(3) Hierarchy? So what? You can't really represent a set of nested keyrings
as a set of nested directories since keys can have multiple
parents. Besides, keys don't make a single tree.
You'd have to represent links in a keyring as symlinks, but when creating
them, how do you interpret the argument given to symlink()?
(4) I suspect a filesystem API will be a lot heavier on code and memory.
(5) Text parsers are required in a number of cases.
(6) Using a filesystem API throws more locks into the works.
The downsides of adding a number of new syscalls are:
(1) glibc, uclibc, etc
(2) 32->64 bit syscall translation
(3) Adding the new syscalls to all archs
However, using prctl(), I just about get all three for free:-)
But are they really greater than the downsides of trying to do it through the
filesystem API to which doesn't really map, and which must be abused?
David
next prev parent reply other threads:[~2004-08-10 18:54 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-07 0:31 [PATCH] implement in-kernel keys & keyring management David Howells
2004-08-07 8:17 ` Andrew Morton
2004-08-08 2:52 ` Greg KH
2004-08-09 9:23 ` David Howells
2004-08-09 20:27 ` Greg KH
2004-08-07 8:59 ` Trond Myklebust
2004-08-07 16:33 ` [PATCH] implement in-kernel keys & keyring management [try #2] David Howells
2004-08-08 4:45 ` James Morris
2004-08-09 9:33 ` David Howells
2004-08-09 14:08 ` James Morris
2004-08-09 14:35 ` David Howells
2004-08-09 15:47 ` James Morris
2004-08-10 18:49 ` David Howells [this message]
2004-08-07 17:45 ` [PATCH] implement in-kernel keys & keyring management David Howells
2004-08-07 17:48 ` [PATCH] implement in-kernel keys & keyring management [try #3] David Howells
2004-08-08 5:14 ` [PATCH] implement in-kernel keys & keyring management James Morris
2004-08-08 5:25 ` Linus Torvalds
2004-08-09 1:14 ` James Morris
2004-08-09 4:27 ` Linus Torvalds
2004-08-09 6:32 ` bert hubert
2004-08-09 14:51 ` Alan Cox
2004-08-09 10:01 ` David Howells
2004-08-09 10:16 ` David Howells
2004-08-09 9:40 ` David Howells
2004-08-09 9:45 ` David Howells
2004-08-09 15:24 ` [PATCH] implement in-kernel keys & keyring management [try #4] David Howells
2004-08-09 21:13 ` Kyle Moffett
2004-08-10 17:59 ` [PATCH] implement in-kernel keys & keyring management [try #5] David Howells
2004-08-11 6:37 ` Chris Wright
2004-08-11 9:46 ` David Howells
2004-08-11 12:34 ` [PATCH] implement in-kernel keys & keyring management [try #6] David Howells
2004-08-11 19:10 ` [PATCH] keys & keyring management: key filesystem David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7120.1092163772@redhat.com \
--to=dhowells@redhat.com \
--cc=akpm@osdl.org \
--cc=arjanv@redhat.com \
--cc=chrisw@osdl.org \
--cc=dwmw2@infradead.org \
--cc=greg@kroah.com \
--cc=jmorris@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mike@halcrow.us \
--cc=mrmacman_g4@mac.com \
--cc=sfrench@samba.org \
--cc=torvalds@osdl.org \
--cc=trond.myklebust@fys.uio.no \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).