From: "Serge E. Hallyn" <serue@us.ibm.com>
To: James Morris <jmorris@namei.org>,
David Howells <dhowells@redhat.com>,
"Eric W. Biederman" <ebiederm@xmission.com>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/4] keys: consider user namespace in key_permission
Date: Thu, 26 Feb 2009 18:27:47 -0600 [thread overview]
Message-ID: <20090227002747.GB31098@us.ibm.com> (raw)
In-Reply-To: <20090227002709.GA31049@us.ibm.com>
If a key is owned by another user namespace, then treat the
key as though it is owned by both another uid and gid.
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Acked-by: David Howells <dhowells@redhat.com>
---
security/keys/permission.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/security/keys/permission.c b/security/keys/permission.c
index 5d9fc7b..0ed802c 100644
--- a/security/keys/permission.c
+++ b/security/keys/permission.c
@@ -35,6 +35,9 @@ int key_task_permission(const key_ref_t key_ref, const struct cred *cred,
key = key_ref_to_ptr(key_ref);
+ if (key->user->user_ns != cred->user->user_ns)
+ goto use_other_perms;
+
/* use the second 8-bits of permissions for keys the caller owns */
if (key->uid == cred->fsuid) {
kperm = key->perm >> 16;
@@ -56,6 +59,8 @@ int key_task_permission(const key_ref_t key_ref, const struct cred *cred,
}
}
+use_other_perms:
+
/* otherwise use the least-significant 8-bits */
kperm = key->perm;
--
1.5.4.3
next prev parent reply other threads:[~2009-02-27 0:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-27 0:27 [PATCH 0/4] keys: work correctly with user namespaces Serge E. Hallyn
2009-02-27 0:27 ` [PATCH 1/4] keys: distinguish per-uid keys in different namespaces Serge E. Hallyn
2009-02-27 0:27 ` Serge E. Hallyn [this message]
2009-02-27 0:27 ` [PATCH 3/4] keys: skip keys from another user namespace Serge E. Hallyn
2009-02-27 0:28 ` [PATCH 4/4] keys: make procfiles per-user-namespace Serge E. Hallyn
2009-02-27 0:30 ` [PATCH 0/4] keys: work correctly with user namespaces James Morris
2009-02-27 1:36 ` James Morris
2009-02-27 1:39 ` Serge E. Hallyn
-- strict thread matches above, loose matches on Subject: below --
2009-01-09 22:52 [PATCH 1/4] keys: distinguish per-uid keys in different namespaces Serge E. Hallyn
2009-01-09 22:52 ` [PATCH 2/4] keys: consider user namespace in key_permission Serge E. Hallyn
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=20090227002747.GB31098@us.ibm.com \
--to=serue@us.ibm.com \
--cc=dhowells@redhat.com \
--cc=ebiederm@xmission.com \
--cc=jmorris@namei.org \
--cc=linux-kernel@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