linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Casey Schaufler <casey@schaufler-ca.com>
To: Stephen Smalley <sds@tycho.nsa.gov>,
	James Morris <jmorris@namei.org>,
	James Morris <james.l.morris@oracle.com>,
	LSM <linux-security-module@vger.kernel.org>,
	LKLM <linux-kernel@vger.kernel.org>
Cc: Paul Moore <pmoore@redhat.com>,
	John Johansen <john.johansen@canonical.com>,
	Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	Eric Paris <eparis@redhat.com>, Kees Cook <keescook@chromium.org>,
	Casey Schaufler <casey@schaufler-ca.com>
Subject: [PATCH 8/7 v21] LSM: Fixes for issues found in review
Date: Wed, 11 Mar 2015 15:42:30 -0700	[thread overview]
Message-ID: <5500C4D6.7070302@schaufler-ca.com> (raw)
In-Reply-To: <5500967A.3040203@tycho.nsa.gov>

Subject: [PATCH 8/7 v21] LSM: Fixes for issues found in review

Correct capability hook uses that hadn't been done properly in the 6/7 patch. 

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Reported-by: Stephen Smalley <sds@tycho.nsa.gov>

---

 security/apparmor/domain.c |  8 +++-----
 security/selinux/hooks.c   | 15 +--------------
 2 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
index b09fff7..dc0027b 100644
--- a/security/apparmor/domain.c
+++ b/security/apparmor/domain.c
@@ -529,15 +529,13 @@ cleanup:
  */
 int apparmor_bprm_secureexec(struct linux_binprm *bprm)
 {
-	int ret = cap_bprm_secureexec(bprm);
-
 	/* the decision to use secure exec is computed in set_creds
 	 * and stored in bprm->unsafe.
 	 */
-	if (!ret && (bprm->unsafe & AA_SECURE_X_NEEDED))
-		ret = 1;
+	if (bprm->unsafe & AA_SECURE_X_NEEDED)
+		return 1;
 
-	return ret;
+	return 0;
 }
 
 /**
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 3fd8610..e71c797 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2008,7 +2008,7 @@ static int selinux_ptrace_traceme(struct task_struct *parent)
 static int selinux_capget(struct task_struct *target, kernel_cap_t *effective,
 			  kernel_cap_t *inheritable, kernel_cap_t *permitted)
 {
-	return cap_capget(target, effective, inheritable, permitted);
+	return current_has_perm(target, PROCESS__GETCAP);
 }
 
 static int selinux_capset(struct cred *new, const struct cred *old,
@@ -2016,13 +2016,6 @@ static int selinux_capset(struct cred *new, const struct cred *old,
 			  const kernel_cap_t *inheritable,
 			  const kernel_cap_t *permitted)
 {
-	int error;
-
-	error = cap_capset(new, old,
-				      effective, inheritable, permitted);
-	if (error)
-		return error;
-
 	return cred_has_perm(old, new, PROCESS__SETCAP);
 }
 
@@ -2039,12 +2032,6 @@ static int selinux_capset(struct cred *new, const struct cred *old,
 static int selinux_capable(const struct cred *cred, struct user_namespace *ns,
 			   int cap, int audit)
 {
-	int rc;
-
-	rc = cap_capable(cred, ns, cap, audit);
-	if (rc)
-		return rc;
-
 	return cred_has_capability(cred, cap, audit);
 }
 


  reply	other threads:[~2015-03-11 22:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10  1:13 [PATCH 0/7 v21] LSM: Multiple concurrent LSMs Casey Schaufler
2015-03-10  1:20 ` [PATCH 1/7 v21] LSM: Split security.h Casey Schaufler
2015-03-10  1:20 ` [PATCH 2/7 v21] LSM: Add the comment to lsm_hooks.h Casey Schaufler
2015-03-10  1:20 ` [PATCH 3/7 v21] LSM: Remove a comment from security.h Casey Schaufler
2015-03-10  1:20 ` [PATCH 4/7 v21] LSM: Introduce security hook calling Macros Casey Schaufler
2015-03-10  1:20 ` [PATCH 5/7 v21] LSM: Add security module hook list heads Casey Schaufler
2015-03-10  1:20 ` [PATCH 6/7 v21] LSM: Switch to lists of hooks Casey Schaufler
2015-03-11 16:42   ` Stephen Smalley
2015-03-11 18:47     ` Casey Schaufler
2015-03-11 19:24       ` Stephen Smalley
2015-03-11 22:42         ` Casey Schaufler [this message]
2015-03-12 13:24           ` [PATCH 8/7 v21] LSM: Fixes for issues found in review Stephen Smalley
2015-03-10  1:20 ` [PATCH 7/7 v21] LSM: Remove unused capability.c Casey Schaufler
2015-03-10 18:58 ` [PATCH 0/7 v21] LSM: Multiple concurrent LSMs Kees Cook
2015-03-11 16:25 ` Stephen Smalley
2015-03-11 16:35   ` Stephen Smalley
2015-03-12  0:42 ` Casey Schaufler
2015-03-12 14:32 ` Tetsuo Handa
2015-04-10 11:24 ` Tetsuo Handa
2015-04-10 18:22   ` John Johansen
2015-04-10 18:27   ` Casey Schaufler
2015-04-11 10:47   ` John Johansen
2015-04-20 16:24   ` Casey Schaufler

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=5500C4D6.7070302@schaufler-ca.com \
    --to=casey@schaufler-ca.com \
    --cc=eparis@redhat.com \
    --cc=james.l.morris@oracle.com \
    --cc=jmorris@namei.org \
    --cc=john.johansen@canonical.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=pmoore@redhat.com \
    --cc=sds@tycho.nsa.gov \
    /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;
as well as URLs for NNTP newsgroup(s).