From: John Johansen <john.johansen@canonical.com>
To: Kees Cook <keescook@chromium.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: James Morris <james.l.morris@oracle.com>,
"Eric W . Biederman" <ebiederm@xmission.com>,
David Howells <dhowells@redhat.com>,
"Serge E. Hallyn" <serge@hallyn.com>,
Paul Moore <paul@paul-moore.com>,
Stephen Smalley <sds@tycho.nsa.gov>,
Casey Schaufler <casey@schaufler-ca.com>,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Andy Lutomirski <luto@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-fsdevel@vger.kernel.org,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 08/15] LSM: drop bprm_secureexec hook
Date: Tue, 18 Jul 2017 17:02:37 -0700 [thread overview]
Message-ID: <15255f64-e728-07c3-68de-4558850dd2eb@canonical.com> (raw)
In-Reply-To: <1500416736-49829-9-git-send-email-keescook@chromium.org>
On 07/18/2017 03:25 PM, Kees Cook wrote:
> This removes the bprm_secureexec hook since the logic has been folded into
> the bprm_set_creds hook for all LSMs now.
>
> Cc: James Morris <james.l.morris@oracle.com>
> Cc: Eric W. Biederman <ebiederm@xmission.com>
> Signed-off-by: Kees Cook <keescook@chromium.org>
looks good
Reviewed-by: John Johansen <john.johansen@canonical.com>
> ---
> fs/binfmt_elf.c | 1 -
> fs/binfmt_elf_fdpic.c | 1 -
> include/linux/lsm_hooks.h | 14 +++++---------
> include/linux/security.h | 7 -------
> security/security.c | 5 -----
> 5 files changed, 5 insertions(+), 23 deletions(-)
>
> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> index 991e4de3515f..7f6ec4dac13d 100644
> --- a/fs/binfmt_elf.c
> +++ b/fs/binfmt_elf.c
> @@ -254,7 +254,6 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
> NEW_AUX_ENT(AT_EUID, from_kuid_munged(cred->user_ns, cred->euid));
> NEW_AUX_ENT(AT_GID, from_kgid_munged(cred->user_ns, cred->gid));
> NEW_AUX_ENT(AT_EGID, from_kgid_munged(cred->user_ns, cred->egid));
> - bprm->secureexec |= security_bprm_secureexec(bprm);
> NEW_AUX_ENT(AT_SECURE, bprm->secureexec);
> NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes);
> #ifdef ELF_HWCAP2
> diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
> index c88b35d4a6b3..5aa9199dfb13 100644
> --- a/fs/binfmt_elf_fdpic.c
> +++ b/fs/binfmt_elf_fdpic.c
> @@ -650,7 +650,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
> NEW_AUX_ENT(AT_EUID, (elf_addr_t) from_kuid_munged(cred->user_ns, cred->euid));
> NEW_AUX_ENT(AT_GID, (elf_addr_t) from_kgid_munged(cred->user_ns, cred->gid));
> NEW_AUX_ENT(AT_EGID, (elf_addr_t) from_kgid_munged(cred->user_ns, cred->egid));
> - bprm->secureexec |= security_bprm_secureexec(bprm);
> NEW_AUX_ENT(AT_SECURE, bprm->secureexec);
> NEW_AUX_ENT(AT_EXECFN, bprm->exec);
>
> diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
> index 080f34e66017..2ddc1c7e8923 100644
> --- a/include/linux/lsm_hooks.h
> +++ b/include/linux/lsm_hooks.h
> @@ -40,7 +40,11 @@
> * interpreters. The hook can tell whether it has already been called by
> * checking to see if @bprm->security is non-NULL. If so, then the hook
> * may decide either to retain the security information saved earlier or
> - * to replace it.
> + * to replace it. The hook must set @bprm->secureexec to 1 if a "secure
> + * exec" has happened as a result of this hook call. The flag is used to
> + * indicate the need for a sanitized execution environment, and is also
> + * passed in the ELF auxiliary table on the initial stack to indicate
> + * whether libc should enable secure mode.
> * @bprm contains the linux_binprm structure.
> * Return 0 if the hook is successful and permission is granted.
> * @bprm_check_security:
> @@ -68,12 +72,6 @@
> * linux_binprm structure. This hook is a good place to perform state
> * changes on the process such as clearing out non-inheritable signal
> * state. This is called immediately after commit_creds().
> - * @bprm_secureexec:
> - * Return a boolean value (0 or 1) indicating whether a "secure exec"
> - * is required. The flag is passed in the auxiliary table
> - * on the initial stack to the ELF interpreter to indicate whether libc
> - * should enable secure mode.
> - * @bprm contains the linux_binprm structure.
> *
> * Security hooks for filesystem operations.
> *
> @@ -1368,7 +1366,6 @@ union security_list_options {
>
> int (*bprm_set_creds)(struct linux_binprm *bprm);
> int (*bprm_check_security)(struct linux_binprm *bprm);
> - int (*bprm_secureexec)(struct linux_binprm *bprm);
> void (*bprm_committing_creds)(struct linux_binprm *bprm);
> void (*bprm_committed_creds)(struct linux_binprm *bprm);
>
> @@ -1680,7 +1677,6 @@ struct security_hook_heads {
> struct list_head vm_enough_memory;
> struct list_head bprm_set_creds;
> struct list_head bprm_check_security;
> - struct list_head bprm_secureexec;
> struct list_head bprm_committing_creds;
> struct list_head bprm_committed_creds;
> struct list_head sb_alloc_security;
> diff --git a/include/linux/security.h b/include/linux/security.h
> index af675b576645..133c41bb666d 100644
> --- a/include/linux/security.h
> +++ b/include/linux/security.h
> @@ -80,7 +80,6 @@ extern int cap_capset(struct cred *new, const struct cred *old,
> const kernel_cap_t *inheritable,
> const kernel_cap_t *permitted);
> extern int cap_bprm_set_creds(struct linux_binprm *bprm);
> -extern int cap_bprm_secureexec(struct linux_binprm *bprm);
> extern int cap_inode_setxattr(struct dentry *dentry, const char *name,
> const void *value, size_t size, int flags);
> extern int cap_inode_removexattr(struct dentry *dentry, const char *name);
> @@ -223,7 +222,6 @@ int security_bprm_set_creds(struct linux_binprm *bprm);
> int security_bprm_check(struct linux_binprm *bprm);
> void security_bprm_committing_creds(struct linux_binprm *bprm);
> void security_bprm_committed_creds(struct linux_binprm *bprm);
> -int security_bprm_secureexec(struct linux_binprm *bprm);
> int security_sb_alloc(struct super_block *sb);
> void security_sb_free(struct super_block *sb);
> int security_sb_copy_data(char *orig, char *copy);
> @@ -515,11 +513,6 @@ static inline void security_bprm_committed_creds(struct linux_binprm *bprm)
> {
> }
>
> -static inline int security_bprm_secureexec(struct linux_binprm *bprm)
> -{
> - return cap_bprm_secureexec(bprm);
> -}
> -
> static inline int security_sb_alloc(struct super_block *sb)
> {
> return 0;
> diff --git a/security/security.c b/security/security.c
> index b9fea3999cf8..750b83186869 100644
> --- a/security/security.c
> +++ b/security/security.c
> @@ -311,11 +311,6 @@ void security_bprm_committed_creds(struct linux_binprm *bprm)
> call_void_hook(bprm_committed_creds, bprm);
> }
>
> -int security_bprm_secureexec(struct linux_binprm *bprm)
> -{
> - return call_int_hook(bprm_secureexec, 0, bprm);
> -}
> -
> int security_sb_alloc(struct super_block *sb)
> {
> return call_int_hook(sb_alloc_security, 0, sb);
>
next prev parent reply other threads:[~2017-07-19 0:02 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-18 22:25 [PATCH v3 00/15] exec: Use sane stack rlimit under secureexec Kees Cook
2017-07-18 22:25 ` [PATCH v3 01/15] binfmt: Introduce secureexec flag Kees Cook
2017-07-19 0:05 ` John Johansen
2017-07-19 1:01 ` Andy Lutomirski
2017-07-18 22:25 ` [PATCH v3 02/15] exec: Rename bprm->cred_prepared to called_set_creds Kees Cook
2017-07-19 0:08 ` John Johansen
2017-07-19 1:06 ` Andy Lutomirski
2017-07-19 4:40 ` Kees Cook
2017-07-19 9:19 ` James Morris
2017-07-19 23:56 ` Paul Moore
2017-07-18 22:25 ` [PATCH v3 03/15] apparmor: Refactor to remove bprm_secureexec hook Kees Cook
2017-07-19 0:00 ` John Johansen
2017-07-19 9:21 ` James Morris
2017-07-18 22:25 ` [PATCH v3 04/15] selinux: " Kees Cook
2017-07-20 0:03 ` Paul Moore
2017-07-20 0:19 ` Paul Moore
2017-07-20 1:37 ` Kees Cook
2017-07-20 13:42 ` Paul Moore
2017-07-20 17:06 ` Kees Cook
2017-07-20 20:42 ` Paul Moore
2017-07-21 15:40 ` Paul Moore
2017-07-21 17:37 ` Kees Cook
2017-07-21 19:16 ` Paul Moore
2017-07-18 22:25 ` [PATCH v3 05/15] smack: " Kees Cook
2017-07-26 3:58 ` Kees Cook
2017-07-26 15:24 ` Casey Schaufler
2017-07-18 22:25 ` [PATCH v3 06/15] commoncap: " Kees Cook
2017-07-19 1:10 ` Andy Lutomirski
2017-07-19 4:41 ` Kees Cook
2017-07-20 4:53 ` Andy Lutomirski
2017-07-31 22:43 ` Kees Cook
2017-08-01 13:12 ` Andy Lutomirski
2017-07-19 9:26 ` James Morris
2017-07-18 22:25 ` [PATCH v3 07/15] commoncap: Move cap_elevated calculation into bprm_set_creds Kees Cook
2017-07-19 1:52 ` Andy Lutomirski
2017-07-19 9:28 ` James Morris
2017-07-18 22:25 ` [PATCH v3 08/15] LSM: drop bprm_secureexec hook Kees Cook
2017-07-19 0:02 ` John Johansen [this message]
2017-07-19 9:29 ` James Morris
2017-07-18 22:25 ` [PATCH v3 09/15] exec: Correct comments about "point of no return" Kees Cook
2017-07-19 0:45 ` Eric W. Biederman
2017-07-18 22:25 ` [PATCH v3 10/15] exec: Use secureexec for setting dumpability Kees Cook
2017-07-26 3:59 ` Kees Cook
2017-07-18 22:25 ` [PATCH v3 11/15] exec: Use secureexec for clearing pdeath_signal Kees Cook
2017-07-18 22:25 ` [PATCH v3 12/15] smack: Remove redundant pdeath_signal clearing Kees Cook
2017-07-18 22:25 ` [PATCH v3 13/15] exec: Consolidate dumpability logic Kees Cook
2017-07-18 22:25 ` [PATCH v3 14/15] exec: Use sane stack rlimit under secureexec Kees Cook
2017-07-19 9:42 ` James Morris
2017-07-18 22:25 ` [PATCH v3 15/15] exec: Consolidate pdeath_signal clearing Kees Cook
2017-07-18 23:03 ` [PATCH v3 00/15] exec: Use sane stack rlimit under secureexec Linus Torvalds
2017-07-19 3:22 ` Serge E. Hallyn
2017-07-19 5:23 ` Kees Cook
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=15255f64-e728-07c3-68de-4558850dd2eb@canonical.com \
--to=john.johansen@canonical.com \
--cc=akpm@linux-foundation.org \
--cc=casey@schaufler-ca.com \
--cc=dhowells@redhat.com \
--cc=ebiederm@xmission.com \
--cc=james.l.morris@oracle.com \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=luto@kernel.org \
--cc=paul@paul-moore.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=sds@tycho.nsa.gov \
--cc=serge@hallyn.com \
--cc=torvalds@linux-foundation.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®