public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Paris <eparis@redhat.com>
To: torvalds@linux-foundation.org
Cc: sds@tycho.nsa.gov, linux-kernel@vger.kernel.org, selinux@tycho.nsa.gov
Subject: Re: [RFC PATCH 1/2] selinux: merge selinux_inode_permission and inode_has_perm
Date: Mon, 03 Jun 2013 15:33:54 -0400	[thread overview]
Message-ID: <1370288034.19018.1.camel@localhost> (raw)
In-Reply-To: <1370285941-18367-1-git-send-email-eparis@redhat.com>

On Mon, 2013-06-03 at 14:59 -0400, Eric Paris wrote:
> selinux_inode_permission had some heavy lifting done to make it more
> performance polite.  But it still does largely the same thing as
> inode_has_perm.  So move that work into inode_has_perm and call
> inode_has_perm from selinux_inode_permission.
> 
> Signed-off-by: Eric Paris <eparis@redhat.com>
> ---
>  security/selinux/hooks.c | 92 ++++++++++++++++++++++--------------------------
>  1 file changed, 42 insertions(+), 50 deletions(-)
> 
> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 5c6f2cd..cfecb52 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c

> @@ -1514,6 +1538,14 @@ static int inode_has_perm(const struct cred *cred,
>  	sid = cred_sid(cred);
>  	isec = inode->i_security;
>  
> +	rc = avc_has_perm_noaudit(sid, isec->sid, isec->sclass, perms, 0, &avd);
> +	audited = avc_audit_required(perms, &avd, rc, dontaudit, &denied);
> +	if (likely(!audited))
> +		return rc;
> +
> +	rc2 = audit_inode_permission(inode, adp, perms, audited, denied, flags);
> +	if (rc2)
> +		return rc2;
>  	return avc_has_perm_flags(sid, isec->sid, isec->sclass, perms, adp, flags);
>  }
>  

Should just return rc, not avc_has_perm_flags().  I fixed that in the
2/2 patch and this should work just fine.  Kills a little performance,
but still works.

-Eric


      parent reply	other threads:[~2013-06-03 19:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-03 18:59 [RFC PATCH 1/2] selinux: merge selinux_inode_permission and inode_has_perm Eric Paris
2013-06-03 18:59 ` [RFC PATCH 2/2] SELinux: cache inode checks inside struct inode Eric Paris
2013-06-03 20:26   ` Casey Schaufler
2013-06-04  1:00     ` Casey Schaufler
2013-06-03 21:31   ` Linus Torvalds
2013-06-03 23:18     ` Eric Paris
2013-06-04  2:52       ` Casey Schaufler
2013-06-03 19:33 ` Eric Paris [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=1370288034.19018.1.camel@localhost \
    --to=eparis@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    --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