From: Chris Wright <chrisw@sous-sol.org>
To: Toshiharu Harada <haradats@nttdata.co.jp>
Cc: akpm@linux-foundation.org, chrisw@sous-sol.org,
viro@ZenIV.linux.org.uk, linux-security-module@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Kentaro Takeda <takedakn@nttdata.co.jp>,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Subject: Re: [TOMOYO #8 (2.6.25-mm1) 1/7] Introduce new LSM hooks.
Date: Thu, 1 May 2008 01:01:44 -0700 [thread overview]
Message-ID: <20080501080144.GJ30511@sequoia.sous-sol.org> (raw)
In-Reply-To: <20080501055543.269648000@nttdata.co.jp>
* Toshiharu Harada (haradats@nttdata.co.jp) wrote:
> This patch allows LSM to check permission using "struct vfsmount"
> without passing "struct vfsmount" to VFS helper functions.
This is simply duplicating many of the existing checks.
I don't see how this is an improvement.
> --- mm.orig/fs/namei.c
> +++ mm/fs/namei.c
> @@ -1595,6 +1595,9 @@ int vfs_create(struct inode *dir, struct
> error = security_inode_create(dir, dentry, mode);
> if (error)
> return error;
> + error = security_path_create(dir, dentry, mode, nd);
> + if (error)
> + return error;
Pure duplication (of course adding nameidata, although I think you just
want path).
> DQUOT_INIT(dir);
> error = dir->i_op->create(dir, dentry, mode, nd);
> if (!error)
> @@ -1650,6 +1653,17 @@ int may_open(struct nameidata *nd, int a
...
error = vfs_permission(nd, acc_mode);
if (error)
return error;
...
> return -EPERM;
>
> /*
> + * security_inode_permission() called from vfs_permission()
> + * can't know that the file is going to be truncated when
> + * open(filename, O_WRONLY | O_TRUNC | O_APPEND) is used.
> + * So, this hook checks O_APPEND and O_TRUNC flags as well
> + * as MAY_READ and MAY_WRITE flags.
> + */
> + error = security_path_open(nd->path.dentry, nd->path.mnt, flag);
> + if (error)
> + return error;
Also duplication. And why the unique flag handling, you don't seem to
ever check?
> +
> + /*
> * Ensure there are no outstanding leases on the file.
> */
> error = break_lease(inode, flag);
> @@ -2021,7 +2035,12 @@ fail:
> }
> EXPORT_SYMBOL_GPL(lookup_create);
>
> -int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
> +/*
> + * These pre_vfs_*() functions are separated from vfs_*() functions so that
> + * LSM's security_path_*() functions can do DAC checks before MAC checks
> + * without duplicating may_create()/may_delete() functions.
> + */
> +int pre_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode)
> {
> int error = may_create(dir, dentry, NULL);
>
> @@ -2033,6 +2052,14 @@ int vfs_mknod(struct inode *dir, struct
>
> if (!dir->i_op || !dir->i_op->mknod)
> return -EPERM;
> + return 0;
> +}
> +
> +int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
> +{
> + int error = pre_vfs_mknod(dir, dentry, mode);
> + if (error)
> + return error;
More duplication, you'll get a call chain like:
sys_mknod
security_path_mknod
pre_vfs_mknod
vfs_mknod
pre_vfs_mknod
security_inode_mknod
next prev parent reply other threads:[~2008-05-01 8:02 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-01 5:54 [TOMOYO #8 (2.6.25-mm1) 0/7] TOMOYO Linux Toshiharu Harada
2008-05-01 5:54 ` [TOMOYO #8 (2.6.25-mm1) 1/7] Introduce new LSM hooks Toshiharu Harada
2008-05-01 8:01 ` Chris Wright [this message]
2008-05-01 15:07 ` Tetsuo Handa
2008-05-01 15:17 ` Stephen Smalley
2008-05-01 15:47 ` Chris Wright
2008-05-01 16:45 ` Stephen Smalley
2008-05-07 15:15 ` Tetsuo Handa
2008-05-01 5:54 ` [TOMOYO #8 (2.6.25-mm1) 2/7] LSM adapter functions Toshiharu Harada
2008-05-01 5:54 ` [TOMOYO #8 (2.6.25-mm1) 3/7] Memory and pathname management functions Toshiharu Harada
2008-05-01 5:54 ` [TOMOYO #8 (2.6.25-mm1) 4/7] Common functions for TOMOYO Linux Toshiharu Harada
2008-05-01 5:54 ` [TOMOYO #8 (2.6.25-mm1) 5/7] Domain transition handler Toshiharu Harada
2008-05-01 5:54 ` [TOMOYO #8 (2.6.25-mm1) 6/7] File operation restriction part Toshiharu Harada
2008-05-01 5:54 ` [TOMOYO #8 (2.6.25-mm1) 7/7] Kconfig and Makefile Toshiharu Harada
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=20080501080144.GJ30511@sequoia.sous-sol.org \
--to=chrisw@sous-sol.org \
--cc=akpm@linux-foundation.org \
--cc=haradats@nttdata.co.jp \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=takedakn@nttdata.co.jp \
--cc=viro@ZenIV.linux.org.uk \
/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
Powered by JetHome