linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: casey.schaufler@intel.com (Casey Schaufler)
To: linux-security-module@vger.kernel.org
Subject: [PATCH 6/5] capability: Repair sidechannel test in ptrace
Date: Thu, 27 Sep 2018 12:17:20 -0700	[thread overview]
Message-ID: <20180927191720.9480-1-casey.schaufler@intel.com> (raw)
In-Reply-To: <20180824224117.3356-1-casey.schaufler@intel.com>

From: Casey Schaufler <casey@schaufler-ca.com>

The PTRACE_MODE_SCHED check erroniously returns 0 in
all cases. It should be returning -EPERM. This fixes
the logic to correct that error.

Signed-off-by: Casey Schaufler <casey.schaufler@intel.com>
---
 security/commoncap.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/security/commoncap.c b/security/commoncap.c
index e77457110d05..70a7e3d19c16 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -152,9 +152,8 @@ int cap_ptrace_access_check(struct task_struct *child, unsigned int mode)
 	if (cred->user_ns == child_cred->user_ns &&
 	    cap_issubset(child_cred->cap_permitted, *caller_caps))
 		goto out;
-	if (mode & PTRACE_MODE_SCHED)
-		goto out;
-	if (ns_capable(child_cred->user_ns, CAP_SYS_PTRACE))
+	if (!(mode & PTRACE_MODE_SCHED) &&
+	    ns_capable(child_cred->user_ns, CAP_SYS_PTRACE))
 		goto out;
 	ret = -EPERM;
 out:
-- 
2.17.1

  parent reply	other threads:[~2018-09-27 19:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-24 22:41 [PATCH v4 0/5] LSM: Add and use a hook for side-channel safety checks Casey Schaufler
2018-08-24 22:41 ` [PATCH v4 1/5] LSM: Introduce a hook for side-channel danger Casey Schaufler
2018-08-24 22:41 ` [PATCH v4 2/5] X86: Support LSM determination of side-channel Casey Schaufler
2018-08-24 22:41 ` [PATCH v4 3/5] LSM: Security module checking for side-channel dangers Casey Schaufler
2018-08-24 23:17   ` Jann Horn
2018-08-24 22:41 ` [PATCH v4 4/5] Smack: Support determination of side-channel Casey Schaufler
2018-08-24 22:41 ` [PATCH v4 5/5] SELinux: Support SELinux " Casey Schaufler
2018-09-27 19:17 ` Casey Schaufler [this message]
2018-09-27 19:49   ` [PATCH 6/5] capability: Repair sidechannel test in ptrace Jann Horn

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=20180927191720.9480-1-casey.schaufler@intel.com \
    --to=casey.schaufler@intel.com \
    --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;
as well as URLs for NNTP newsgroup(s).