From: "Serge E. Hallyn" <serue@us.ibm.com>
To: "Andrew G. Morgan" <morgan@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Howells <dhowells@redhat.com>,
"Serge E. Hallyn" <serue@us.ibm.com>,
Linux Security Modules List
<linux-security-module@vger.kernel.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/4] security: filesystem capabilities bugfix2
Date: Fri, 27 Jun 2008 15:59:05 -0500 [thread overview]
Message-ID: <20080627205905.GB17415@us.ibm.com> (raw)
In-Reply-To: <486357EC.5060205@kernel.org>
Quoting Andrew G. Morgan (morgan@kernel.org):
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Bugfix for strace, and CAP_SETPCAP, in the case that filesystem
> capabilities are supported.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.6 (GNU/Linux)
>
> iD8DBQFIY1fr+bHCR3gb8jsRAph7AKDOlmeveIpQs1jhIs0TJxjCdMAS5ACgsml6
> 7UYR+FZpW2XdmG8PkiZzemU=
> =+Ko+
> -----END PGP SIGNATURE-----
> From f4419c78fff77c4fa3cdfa6b0a78edae92ddf467 Mon Sep 17 00:00:00 2001
> From: Andrew G. Morgan <morgan@kernel.org>
> Date: Wed, 25 Jun 2008 23:24:10 -0700
> Subject: [PATCH] Blunt CAP_SETPCAP on strace with filesystem capability support
>
> The filesystem capability support meaning for CAP_SETPCAP is less
> powerful than the non-filesystem capability support. As such, when
> filesystem capabilities are configured, we should not permit
> CAP_SETPCAP to 'enhance' the current process through strace
> manipulation of a child process.
>
> Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
If I understand this right, then LSM_UNSAFE_PTRACE_CAP will only be set
if the tracer didn't have CAP_SYS_PTRACE. So this seems sane to me.
Acked-by: Serge Hallyn <serue@us.ibm.com>
> ---
> security/commoncap.c | 13 ++++++++++---
> 1 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/security/commoncap.c b/security/commoncap.c
> index 5edabc7..a9ea921 100644
> --- a/security/commoncap.c
> +++ b/security/commoncap.c
> @@ -103,10 +103,16 @@ static inline int cap_inh_is_capped(void)
> return (cap_capable(current, CAP_SETPCAP) != 0);
> }
>
> +static inline int cap_limit_straced_target(void) { return 1; }
> +
> #else /* ie., ndef CONFIG_SECURITY_FILE_CAPABILITIES */
>
> static inline int cap_block_setpcap(struct task_struct *t) { return 0; }
> static inline int cap_inh_is_capped(void) { return 1; }
> +static inline int cap_limit_straced_target(void)
> +{
> + return !capable(CAP_SETPCAP);
> +}
>
> #endif /* def CONFIG_SECURITY_FILE_CAPABILITIES */
>
> @@ -342,9 +348,10 @@ void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
> bprm->e_uid = current->uid;
> bprm->e_gid = current->gid;
> }
> - if (!capable (CAP_SETPCAP)) {
> - new_permitted = cap_intersect (new_permitted,
> - current->cap_permitted);
> + if (cap_limit_straced_target()) {
> + new_permitted =
> + cap_intersect(new_permitted,
> + current->cap_permitted);
> }
> }
> }
> --
> 1.5.3.7
>
next prev parent reply other threads:[~2008-06-27 20:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-26 8:48 Andrew G. Morgan
2008-06-27 20:59 ` Serge E. Hallyn [this message]
2008-06-27 23:04 ` David Howells
2008-06-30 5:41 ` Andrew G. Morgan
2008-06-30 9:45 ` David Howells
2008-06-30 14:53 ` David Howells
2008-06-30 18:53 ` Serge E. Hallyn
2008-06-30 19:10 ` David Howells
2008-06-30 19:49 ` 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=20080627205905.GB17415@us.ibm.com \
--to=serue@us.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=morgan@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
all inboxes | Powered by JetHome®