linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Casey Schaufler <casey@schaufler-ca.com>,
	James Morris <jmorris@namei.org>,
	James Morris <james.l.morris@oracle.com>,
	LSM <linux-security-module@vger.kernel.org>,
	LKLM <linux-kernel@vger.kernel.org>
Cc: Paul Moore <pmoore@redhat.com>,
	John Johansen <john.johansen@canonical.com>,
	Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	Eric Paris <eparis@redhat.com>, Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH 6/7 v21] LSM: Switch to lists of hooks
Date: Wed, 11 Mar 2015 12:42:51 -0400	[thread overview]
Message-ID: <5500708B.3050101@tycho.nsa.gov> (raw)
In-Reply-To: <54FE46EF.4000708@schaufler-ca.com>

On 03/09/2015 09:20 PM, Casey Schaufler wrote:
> Subject: [PATCH 6/7 v21] LSM: Switch to lists of hooks
> 
> Instead of using a vector of security operations
> with explicit, special case stacking of the capability
> and yama hooks use lists of hooks with capability and
> yama hooks included as appropriate. 
> 
> The security_operations structure is no longer required.
> Instead, there is a union of the function pointers that
> allows all the hooks lists to use a common mechanism for
> list management while retaining typing. Each module
> supplies an array describing the hooks it provides instead
> of a sparsely populated security_operations structure.
> The description includes the element that gets put on
> the hook list, avoiding the issues surrounding individual
> element allocation.
>  
> The method for registering security modules is changed to
> reflect the information available. The method for removing
> a module, currently only used by SELinux, has also changed.
> It should be generic now, however if there are potential
> race conditions based on ordering of hook removal that needs
> to be addressed by the calling module.
> 
> The security hooks are called from the lists and the first
> failure is returned.
>  
> Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
> 
> --- 

> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 0c45f08..3fd8610 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -2008,24 +2002,12 @@ static int selinux_ptrace_access_check(struct task_struct *child,
>  
>  static int selinux_ptrace_traceme(struct task_struct *parent)
>  {
> -	int rc;
> -
> -	rc = cap_ptrace_traceme(parent);
> -	if (rc)
> -		return rc;
> -
>  	return task_has_perm(parent, current, PROCESS__PTRACE);
>  }
>  
>  static int selinux_capget(struct task_struct *target, kernel_cap_t *effective,
>  			  kernel_cap_t *inheritable, kernel_cap_t *permitted)
>  {
> -	int error;
> -
> -	error = current_has_perm(target, PROCESS__GETCAP);
> -	if (error)
> -		return error;
> -
>  	return cap_capget(target, effective, inheritable, permitted);

Deleted the wrong code here.

>  }

And failed to delete the cap_capset() call from selinux_capset(), and
the cap_capable() call from selinux_capable(), so we're calling that
code twice after the patch.

  reply	other threads:[~2015-03-11 16:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10  1:13 [PATCH 0/7 v21] LSM: Multiple concurrent LSMs Casey Schaufler
2015-03-10  1:20 ` [PATCH 1/7 v21] LSM: Split security.h Casey Schaufler
2015-03-10  1:20 ` [PATCH 2/7 v21] LSM: Add the comment to lsm_hooks.h Casey Schaufler
2015-03-10  1:20 ` [PATCH 3/7 v21] LSM: Remove a comment from security.h Casey Schaufler
2015-03-10  1:20 ` [PATCH 4/7 v21] LSM: Introduce security hook calling Macros Casey Schaufler
2015-03-10  1:20 ` [PATCH 5/7 v21] LSM: Add security module hook list heads Casey Schaufler
2015-03-10  1:20 ` [PATCH 6/7 v21] LSM: Switch to lists of hooks Casey Schaufler
2015-03-11 16:42   ` Stephen Smalley [this message]
2015-03-11 18:47     ` Casey Schaufler
2015-03-11 19:24       ` Stephen Smalley
2015-03-11 22:42         ` [PATCH 8/7 v21] LSM: Fixes for issues found in review Casey Schaufler
2015-03-12 13:24           ` Stephen Smalley
2015-03-10  1:20 ` [PATCH 7/7 v21] LSM: Remove unused capability.c Casey Schaufler
2015-03-10 18:58 ` [PATCH 0/7 v21] LSM: Multiple concurrent LSMs Kees Cook
2015-03-11 16:25 ` Stephen Smalley
2015-03-11 16:35   ` Stephen Smalley
2015-03-12  0:42 ` Casey Schaufler
2015-03-12 14:32 ` Tetsuo Handa
2015-04-10 11:24 ` Tetsuo Handa
2015-04-10 18:22   ` John Johansen
2015-04-10 18:27   ` Casey Schaufler
2015-04-11 10:47   ` John Johansen
2015-04-20 16:24   ` Casey Schaufler

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=5500708B.3050101@tycho.nsa.gov \
    --to=sds@tycho.nsa.gov \
    --cc=casey@schaufler-ca.com \
    --cc=eparis@redhat.com \
    --cc=james.l.morris@oracle.com \
    --cc=jmorris@namei.org \
    --cc=john.johansen@canonical.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=pmoore@redhat.com \
    /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).