[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <17443.1445250818@warthog.procyon.org.uk>
Date: Mon, 19 Oct 2015 11:33:38 +0100
From: David Howells <dhowells@...hat.com>
To: Dmitry Vyukov <dvyukov@...gle.com>
Cc: dhowells@...hat.com, james.l.morris@...cle.com, serge@...lyn.com,
keyrings@...r.kernel.org, linux-security-module@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>, syzkaller@...glegroups.com,
Kostya Serebryany <kcc@...gle.com>,
Alexander Potapenko <glider@...gle.com>,
Andrey Konovalov <andreyknvl@...gle.com>,
Sasha Levin <sasha.levin@...cle.com>,
Julien Tinnes <jln@...gle.com>, Kees Cook <keescook@...gle.com>
Subject: Re: GPF in keyring_destroy
Dmitry Vyukov <dvyukov@...gle.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@...hat.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@...hat.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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists