[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1186526285.6625.41.camel@heimdal.trondhjem.org>
Date: Tue, 07 Aug 2007 18:38:05 -0400
From: Trond Myklebust <trond.myklebust@....uio.no>
To: "Serge E. Hallyn" <sergeh@...ibm.com>
Cc: Andrew Morgan <morgan@...nel.org>,
Chris Wright <chrisw@...s-sol.org>,
Andrew Morgan <agm@...gle.com>, casey@...aufler-ca.com,
Andrew Morton <akpm@...gle.com>,
Stephen Smalley <sds@...ho.nsa.gov>,
KaiGai Kohei <kaigai@...gai.gr.jp>,
James Morris <jmorris@...ei.org>,
linux-security-module@...r.kernel.org,
lkml <linux-kernel@...r.kernel.org>
Subject: Re: file capabilities: clear fcaps on inode change (v3)
On Tue, 2007-08-07 at 17:17 -0500, Serge E. Hallyn wrote:
> diff --git a/fs/splice.c b/fs/splice.c
> index e36c003..2df95f3 100644
> --- a/fs/splice.c
> +++ b/fs/splice.c
> @@ -827,6 +827,12 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
> ssize_t ret;
> int err;
>
> + mutex_lock(&inode->i_mutex);
> + err = security_inode_killpriv(out->f_path.dentry);
> + mutex_unlock(&inode->i_mutex);
> + if (err)
> + return err;
You are unconditionally taking the i_mutex whether or not you actually
have any capabilities to remove. Normally, removing capabilities due to
a write is something which occurs once every blue moon. Can't you
introduce a heuristic along the lines of should_remove_suid() in order
to optimise away the common case?
In addition, if you need to remove both the capabilities and the suid
bits, then it should be unnecessary to take the i_mutex twice.
> +
> err = should_remove_suid(out->f_path.dentry);
> if (unlikely(err)) {
> mutex_lock(&inode->i_mutex);
Trond
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists