From: Al Viro <viro@ZenIV.linux.org.uk>
To: David Howells <dhowells@redhat.com>
Cc: Kentaro Takeda <takedakn@nttdata.co.jp>,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Toshiharu Harada <haradats@nttdata.co.jp>,
linux-kernel@vger.kernel.org
Subject: Re: Are path-based LSM hooks called from the wrong places?
Date: Thu, 26 Mar 2009 15:53:57 +0000 [thread overview]
Message-ID: <20090326155357.GS28946@ZenIV.linux.org.uk> (raw)
In-Reply-To: <13750.1237997653@redhat.com>
On Wed, Mar 25, 2009 at 04:14:13PM +0000, David Howells wrote:
>
> Hi Kentaro,
>
> I've just been looking at some of the VFS syscall routines, such as
> notify_change(), with an eye to calling it from FS-Cache to grow a file. I
> see that whilst notify_change() calls the inode-based LSM hooks (as drive
> SELinux), it doesn't call the path-based LSM hooks (as drive other security
> modules). It leaves that to the callers, such as do_sys_ftruncate().
>
> I see that vfs_mkdir(), for example, is similar, in that vfs_mkdir() - which
> I'm calling from FS-Cache - invokes the inode-based LSM hooks, but it bypasses
> the path-based LSM hooks as those are called from sys_mkdir().
>
> It would appear that path-based LSM hooks may well be being called from the
> wrong places. They were added in:
>
> commit be6d3e56a6b9b3a4ee44a0685e39e595073c6f0d
> Author: Kentaro Takeda <takedakn@nttdata.co.jp>
> Date: Wed Dec 17 13:24:15 2008 +0900
>
> introduce new LSM hooks where vfsmount is available.
>
> Add new LSM hooks for path-based checks. Call them on directory-modifying
> operations at the points where we still know the vfsmount involved.
>
> Signed-off-by: Kentaro Takeda <takedakn@nttdata.co.jp>
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Signed-off-by: Toshiharu Harada <haradats@nttdata.co.jp>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
>
> Using sys_mkdir() and suchlike directly from within the kernel would add a lot
> of overhead as I'd have to generate a full pathname for each call, whereas
> vfs_mkdir() or notify_change() allows me to start from an inode I already
> have.
If you start from inode (or dentry, for that matter), you don't *have*
a pathname at all. The real question is, do you want these checks to
apply and if you do - which path do you want to use (esp. if you have
multiple namespaces)?
next prev parent reply other threads:[~2009-03-26 15:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-25 16:14 Are path-based LSM hooks called from the wrong places? David Howells
2009-03-26 7:14 ` Kentaro Takeda
2009-03-26 15:53 ` Al Viro [this message]
2009-03-26 16:14 ` David Howells
2009-03-26 16:19 ` Al Viro
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=20090326155357.GS28946@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=dhowells@redhat.com \
--cc=haradats@nttdata.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=takedakn@nttdata.co.jp \
/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