mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: David Howells <dhowells@redhat.com>
Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org,
	arjanv@redhat.com, dwmw2@infradead.org, jmorris@redhat.com,
	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
Date: Sat, 7 Aug 2004 01:17:58 -0700	[thread overview]
Message-ID: <20040807011758.62831dbf.akpm@osdl.org> (raw)
In-Reply-To: <6453.1091838705@redhat.com>

David Howells <dhowells@redhat.com> wrote:
>
> I've made available a patch that does a better job of key and keyring
>  management for authentication, cryptography, etc.. I've added a good bit of
>  documentation and I've commented the code more thoroughly.

Nicely presented patch, thanks.

- Why have a separate key_user structure, rather than adding stuff to
  struct user_struct?  This appears to be feasible.

- I had a hard time working out the locking which protects key->flags. 
  It looks racy.

- Are the various system-wide locks going to end up hurting on big SMP?

- user_describe_key() appears to leak a key ref if kmalloc() fails. 
  user_describe_key() appears to leak a key ref if copy_to_user() faults. 
  The one-return-statement-per-function rule rules.

- Various people are likely to get upset about this:

  asmlinkage long sys_keyctl(int option, unsigned long arg2, unsigned long arg3,
		   unsigned long arg4, unsigned long arg5)

  I guess the pure way to do it is to add 13 new syscalls....

- I really hesitate to stick my nose into this perennial, but
  keyring_hash() is a bit lame.  I once read that

	hash = hash * 33 + *p++;

  works as well as pretty much anything else.

- All that keyring tree management (keyring_detect_cycle) looks tricky. 
  Do we really need such complexity?

- __key_link() does

	/* dispose of the old keyring list */
	if (klist)
		kfree(klist);

  but elsewhere you freely do kfree(0)

- Why does the proc code do spin_lock_irq(&key_user_lock)?  Other
  process-context code just does spin_lock().

- In key_create_or_update():

	mode = 0100;
	if (ktype == &key_type_keyring)
		mode = 0700;
	else if (ktype == &key_type_user)
		mode = 0700;
	else if (ktype->update)
		mode |= 0300;

  you've used the stat.h symbols elsewhere.

- How come install_process_keyring() and friends take task_lock() around
  the key_put()?  It's not done elsewhere.

  Please update the what-it-locks comment over task_lock()

- Documentation/CodingStyle doesn't mention

		if (clone_flags & CLONE_THREAD) {
			atomic_inc(&tsk->process_keyring->usage);
		}
		else {

- join_session_keyring() leaks the memory at `name'.  Trivial DoS hole. 
  Please audit the whole patch.

- request_key_construction() leaks `key' if __call_request_key() fails. 
  Multiple return statements again...

- request_key() appears to leak a ref to the key if key_user_lookup()
  fails.  Multiple return statements.

- In user_instantiate():

	if (!key->payload.data) {
		key_put(key->payload.data);

  the key_put() can be removed.


It's a lot of code, isn't it?

  reply	other threads:[~2004-08-07  8:19 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-07  0:31 David Howells
2004-08-07  8:17 ` Andrew Morton [this message]
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
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
     [not found] <200410191615.i9JGF8IW002712@hera.kernel.org>
2004-10-20 12:52 ` [PATCH] implement in-kernel keys & keyring management Arjan van de Ven

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=20040807011758.62831dbf.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=arjanv@redhat.com \
    --cc=chrisw@osdl.org \
    --cc=dhowells@redhat.com \
    --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

Powered by JetHome