From: Stephen Smalley <sds@tycho.nsa.gov>
To: Paul Moore <pmoore@redhat.com>, selinux@tycho.nsa.gov
Cc: luto@amacapital.net
Subject: Re: [RFC PATCH] selinux: prevent setting a security label on MNT_NOSUID applications
Date: Wed, 14 May 2014 12:28:24 -0400 [thread overview]
Message-ID: <537399A8.2000405@tycho.nsa.gov> (raw)
In-Reply-To: <20140514155807.32072.32113.stgit@localhost>
On 05/14/2014 11:58 AM, Paul Moore wrote:
> We presently prevent processes from explicitly setting an arbitrary
> security label on new processes when NO_NEW_PRIVS is enabled; in an
> attempt for more consistency, this patch extends this to prevent
> setting an arbitrary label when the new application lives on a
> filesystem mounted with MNT_NOSUID.
It is never arbitrary (the new value is always controlled by policy),
and it isn't set on "new processes" per se but rather transitioned to
upon an exec. Anyway, the point of the change is to return an error
rather than silently ignore any /proc/self/attr/exec value when
executing from a nosuid mount.
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
>
> Signed-off-by: Paul Moore <pmoore@redhat.com>
> CC: Andy Lutomirski <luto@amacapital.net>
> CC: Stephen Smalley <sds@tycho.nsa.gov>
> ---
> security/selinux/hooks.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 57b0b49..6fafe86 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -2106,11 +2106,13 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm)
> new_tsec->exec_sid = 0;
>
> /*
> - * Minimize confusion: if no_new_privs and a transition is
> - * explicitly requested, then fail the exec.
> + * Minimize confusion: if no_new_privs or nosuid and a
> + * transition is explicitly requested, then fail the exec.
> */
> if (bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS)
> return -EPERM;
> + if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)
> + return -EACCES;
> } else {
> /* Check for a default transition on this program. */
> rc = security_transition_sid(old_tsec->sid, isec->sid,
>
>
next prev parent reply other threads:[~2014-05-14 16:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-14 15:58 [RFC PATCH] selinux: prevent setting a security label on MNT_NOSUID applications Paul Moore
2014-05-14 16:16 ` Andy Lutomirski
2014-05-14 16:18 ` Andy Lutomirski
2014-05-14 16:23 ` Stephen Smalley
2014-05-14 16:48 ` Andy Lutomirski
2014-05-14 16:28 ` Stephen Smalley [this message]
2014-05-14 21:00 ` Paul Moore
2014-05-14 21:26 ` Andy Lutomirski
2014-05-15 15:14 ` Paul Moore
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=537399A8.2000405@tycho.nsa.gov \
--to=sds@tycho.nsa.gov \
--cc=luto@amacapital.net \
--cc=pmoore@redhat.com \
--cc=selinux@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.