Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1250550

Re: GPF in keyring_destroy

From David Howells <dhowells@redhat.com>
Newsgroups linux.kernel
Subject Re: GPF in keyring_destroy
Date 2015-10-19 12:40 +0200
Message-ID <qlg1b-1Jm-5@gated-at.bofh.it> (permalink)
References <qldZn-7fM-5@gated-at.bofh.it> <qiGXT-28r-7@gated-at.bofh.it> <qjWnU-7zG-21@gated-at.bofh.it> <qldZn-7fM-5@gated-at.bofh.it>
Organization Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903

Show all headers | View raw


Dmitry Vyukov <dvyukov@google.com> wrote:

> > Does the attached patch fix it for you?
> 
> Yes, it fixes the crash for me.

I have an additional patch to prevent keyrings from being constructed by
request_key() at all (though it can still search for them).  Could you give
this a spin in addition to the previous one also?

Thanks,
David
---
commit 27874345bb8d2c39f3d493607a86ecbfcb100405
Author: David Howells <dhowells@redhat.com>
Date:   Mon Oct 19 11:20:28 2015 +0100

    KEYS: Don't permit request_key() to construct a new keyring
    
    If request_key() is used to find a keyring, only do the search part - don't
    do the construction part if the keyring was not found by the search.  We
    don't really want keyrings in the negative instantiated state since the
    rejected/negative instantiation error value in the payload is unioned with
    keyring metadata.
    
    Signed-off-by: David Howells <dhowells@redhat.com>

diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index 486ef6fa393b..0d6253124278 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -440,6 +440,9 @@ static struct key *construct_key_and_link(struct keyring_search_context *ctx,
 
 	kenter("");
 
+	if (ctx->index_key.type == &key_type_keyring)
+		return ERR_PTR(-EPERM);
+	
 	user = key_user_lookup(current_fsuid());
 	if (!user)
 		return ERR_PTR(-ENOMEM);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: GPF in keyring_destroy Dmitry Vyukov <dvyukov@google.com> - 2015-10-19 10:30 +0200
  Re: GPF in keyring_destroy David Howells <dhowells@redhat.com> - 2015-10-19 11:40 +0200
    Re: GPF in keyring_destroy Dmitry Vyukov <dvyukov@google.com> - 2015-10-19 11:40 +0200
      Re: GPF in keyring_destroy David Howells <dhowells@redhat.com> - 2015-10-19 12:30 +0200
  Re: GPF in keyring_destroy David Howells <dhowells@redhat.com> - 2015-10-19 12:40 +0200
    Re: GPF in keyring_destroy Dmitry Vyukov <dvyukov@google.com> - 2015-10-19 12:50 +0200
      Re: GPF in keyring_destroy David Howells <dhowells@redhat.com> - 2015-10-19 13:00 +0200

csiph-web