public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: James Morris <jmorris@namei.org>
To: "Serge E. Hallyn" <serue@us.ibm.com>
Cc: Andrew Morgan <morgan@kernel.org>,
	Chris Wright <chrisw@sous-sol.org>,
	Andrew Morgan <agm@google.com>,
	casey@schaufler-ca.com, Andrew Morton <akpm@google.com>,
	Stephen Smalley <sds@tycho.nsa.gov>,
	KaiGai Kohei <kaigai@kaigai.gr.jp>,
	linux-security-module@vger.kernel.org,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] file capabilities: clear fcaps on inode change (v2)
Date: Tue, 7 Aug 2007 06:47:16 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0708070640160.31104@us.intercode.com.au> (raw)
In-Reply-To: <20070806185231.GA21550@sergelap.austin.ibm.com>

On Mon, 6 Aug 2007, Serge E. Hallyn wrote:

> +	err = security_inode_killpriv(out->f_path.dentry, LSM_NEED_LOCK);
> +	if (err)
> +		return err;
> +
>  	err = should_remove_suid(out->f_path.dentry);
>  	if (unlikely(err)) {
>  		mutex_lock(&inode->i_mutex);

It seems hackish to pass a needlock arg to an API, and that that we'll end 
up with some conceptually similar call-outs for both caps and setuid.

How about encapsulating this stuff so that there's something like:


	err = should_remove_privs();
	if (err)
		remove_privs();

with

void remove_privs()
{
	mutex_lock();
	__remove_privs();
	mutex_unlock();
}

and then __remove_privs() handles the logic for all file privileges, 
including at this stage suid and the LSM call for file caps ?



- James
-- 
James Morris
<jmorris@namei.org>

  parent reply	other threads:[~2007-08-07 13:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-06 18:52 [PATCH 1/1] file capabilities: clear fcaps on inode change (v2) Serge E. Hallyn
2007-08-07  6:50 ` Andrew Morgan
2007-08-07 13:47 ` James Morris [this message]
2007-08-07 14:08   ` Serge E. Hallyn
2007-08-07 14:17     ` James Morris
2007-08-07 15:19       ` Serge E. Hallyn
2007-08-07 13:57 ` Stephen Smalley
2007-08-07 14:11   ` 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=Pine.LNX.4.64.0708070640160.31104@us.intercode.com.au \
    --to=jmorris@namei.org \
    --cc=agm@google.com \
    --cc=akpm@google.com \
    --cc=casey@schaufler-ca.com \
    --cc=chrisw@sous-sol.org \
    --cc=kaigai@kaigai.gr.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=morgan@kernel.org \
    --cc=sds@tycho.nsa.gov \
    --cc=serue@us.ibm.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