From: jannh@google.com (Jann Horn)
To: linux-security-module@vger.kernel.org
Subject: [PATCH 6/5] capability: Repair sidechannel test in ptrace
Date: Thu, 27 Sep 2018 21:49:10 +0200 [thread overview]
Message-ID: <CAG48ez1qZQqffLfB_JV=UB12QjFWmfHm2=PH2eiF+Z_yn9RhpA@mail.gmail.com> (raw)
In-Reply-To: <20180927191720.9480-1-casey.schaufler@intel.com>
On Thu, Sep 27, 2018 at 9:17 PM Casey Schaufler
<casey.schaufler@intel.com> wrote:
>
> 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>
Reviewed-by: Jann Horn <jannh@google.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
>
prev parent reply other threads:[~2018-09-27 19:49 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 ` [PATCH 6/5] capability: Repair sidechannel test in ptrace Casey Schaufler
2018-09-27 19:49 ` Jann Horn [this message]
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='CAG48ez1qZQqffLfB_JV=UB12QjFWmfHm2=PH2eiF+Z_yn9RhpA@mail.gmail.com' \
--to=jannh@google.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).