mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.vnet.ibm.com>
To: linux-security-module <linux-security-module@vger.kernel.org>
Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>,
	Dmitry Kasatkin <d.kasatkin@samsung.com>,
	David Howells <dhowells@redhat.com>,
	Josh Boyer <jwboyer@redhat.com>,
	keyrings <keyrings@linux-nfs.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: [RFC PATCH v4 1/4] KEYS: special dot prefixed keyring name bug fix
Date: Wed, 28 May 2014 11:09:41 -0400	[thread overview]
Message-ID: <1401289784-31340-2-git-send-email-zohar@linux.vnet.ibm.com> (raw)
In-Reply-To: <1401289784-31340-1-git-send-email-zohar@linux.vnet.ibm.com>

Dot prefixed keyring names are supposed to be reserved for the
kernel, but add_key() calls key_get_type_from_user(), which
incorrectly verifies the 'type' field, not the 'description' field.
This patch verifies the 'description' field isn't dot prefixed,
when creating a new keyring, and removes the dot prefix test in
key_get_type_from_user().

Reported-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
---
 security/keys/keyctl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index cd5bd0c..9e9a762 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -37,8 +37,6 @@ static int key_get_type_from_user(char *type,
 		return ret;
 	if (ret == 0 || ret >= len)
 		return -EINVAL;
-	if (type[0] == '.')
-		return -EPERM;
 	type[len - 1] = '\0';
 	return 0;
 }
@@ -87,6 +85,10 @@ SYSCALL_DEFINE5(add_key, const char __user *, _type,
 			kfree(description);
 			description = NULL;
 		}
+		if (description[0] == '.') {
+			ret = -EPERM;
+			goto error2;
+		}
 	}
 
 	/* pull the payload in if one was supplied */
-- 
1.8.1.4


  reply	other threads:[~2014-05-28 15:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-28 15:09 [RFC PATCH v4 0/4] ima: extending secure boot certificate chain Mimi Zohar
2014-05-28 15:09 ` Mimi Zohar [this message]
2014-05-30 15:58   ` [RFC PATCH v4 1/4] KEYS: special dot prefixed keyring name bug fix Dmitry Kasatkin
2014-05-30 17:58     ` Mimi Zohar
     [not found]       ` <CACE9dm-n4R9CSjfzpzCaYrSWDxCOsgX7w2Cvn4gkR6-Z82Qypg@mail.gmail.com>
2014-05-30 19:12         ` Mimi Zohar
2014-05-30 20:45           ` Dmitry Kasatkin
2014-05-28 15:09 ` [RFC PATCH v4 2/4] KEYS: verify a certificate is signed by a 'trusted' key Mimi Zohar
2014-05-28 15:09 ` [RFC PATCH v4 3/4] ima: define '.ima' as a builtin 'trusted' keyring Mimi Zohar
2014-05-28 18:55   ` Dmitry Kasatkin
2014-05-28 19:26     ` Mimi Zohar
2014-05-30 16:05       ` Dmitry Kasatkin
2014-06-09 11:06         ` Mimi Zohar
2014-06-09 11:43           ` Dmitry Kasatkin
2014-05-28 15:09 ` [RFC PATCH v4 4/4] KEYS: define an owner trusted keyring Mimi Zohar
2014-05-30 22:37   ` Dmitry Kasatkin
2014-06-01  2:14     ` Mimi Zohar
2014-06-02 10:48       ` Dmitry Kasatkin
2014-06-02 11:33         ` Mimi Zohar
2014-06-02 11:40           ` Dmitry Kasatkin
2014-06-02 11:54             ` Mimi Zohar
2014-06-02 11:55             ` Josh Boyer
2014-06-03 15:02               ` Mimi Zohar

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=1401289784-31340-2-git-send-email-zohar@linux.vnet.ibm.com \
    --to=zohar@linux.vnet.ibm.com \
    --cc=d.kasatkin@samsung.com \
    --cc=dhowells@redhat.com \
    --cc=jwboyer@redhat.com \
    --cc=keyrings@linux-nfs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    /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