From: Kentaro Takeda <takedakn@nttdata.co.jp>
To: sds@tycho.nsa.gov
Cc: penguin-kernel@I-love.SAKURA.ne.jp, akpm@linux-foundation.org,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk,
hch@lst.de, crispin@crispincowan.com, casey@schaufler-ca.com,
jmorris@namei.org, haradats@nttdata.co.jp
Subject: Re: [TOMOYO #13 (mmotm 2008-11-19-02-19) 01/11] Introduce security_path_clear() hook.
Date: Wed, 03 Dec 2008 17:49:12 +0900 [thread overview]
Message-ID: <49364808.1070907@nttdata.co.jp> (raw)
In-Reply-To: <1228225719.26101.52.camel@moss-spartans.epoch.ncsc.mil>
Stephen Smalley wrote:
> To be precise, I was recommending passing the return value of
> security_path* down to security_inode* explicitly rather than doing it
> implicitly as you presently do. Thereby making the actual control flow
> and relationship between the security_path* and security_inode* hooks
> evident. However, I guess that is moot given your statements below.
I think so too.
>> I think there are two problems.
>>
>> One is that the variable passed via stack memory won't be used by SELinux and
>> SMACK and "CONFIG_SECURITY=n kernels", which will be a waste of stack memory.
>
> I'm more concerned with the hook interface being understandable and
> maintainable.
I see.
>> The other one is that TOMOYO will need another variable for telling how the
>> security_inode_*() are called. Passing the variable via stack memory requires
>> modification of all vfs_*() calls, but TOMOYO doesn't check requests issued
>> by (e.g.) stackable filesystems.
>
> I'm not clear on why that requires a separate argument; if the caller is
> passing in the access decision result as an input, then certain callers
> (e.g. stackable filesystems) can always pass 0 (success).
If we use stack memory to pass the access decision result from security_path_*()
to security_inode_*(), this method seems possible.
>> By the way, this security_path_clear() is intended to be able to return DAC's
>> error code in priority to MAC's error code, but there are two problems for
>> TOMOYO.
>> One is that pathnames which will be later denied by DAC are appended by
>> TOMOYO's learning mode (i.e. garbage entries appears in the learned policy).
>> The other is that warning messages on pathnames which will be later denied by
>> DAC are generated by TOMOYO's enforcing mode.
>>
>> Thus, it will be preferable for TOMOYO to "do MAC checks after DAC checks"
>> rather than to "return DAC's error in priority to MAC's error while doing MAC
>> checks before DAC checks".
>
> It sounds like the existing security_path* hooks are not adequate for
> your needs then, and that patch should not in fact be merged. Yes?
Sorry for confusing you. security_path_*() hooks are adequate for TOMOYO
functionality itself. But they are inadequate for performing DAC before MAC,
which we eventually want to do. We've reached this "passing vfsmount's pathname"
approach after proposing the previous patch. The new approach is a little
divergence of the existing approach, which Serge has patiently advised us.
It should be more suitable for DAC-before-MAC than the previous patch, we think.
>> To do so, "security_path_*() should be replaced by security_path_set(vfsmount)"
>> and "let security_inode_*() do MAC checks using the result of
>> security_path_set()" and "let security_path_clear() clear the result of
>> security_path_set() in case security_inode_*() was not called".
>>
>> So, I think storing the pathname of "struct vfsmount" in the form of "char *"
>> into private hash at security_path_set() and clearing the private hash at
>> security_path_clear() should be most preferable.
>
> Then I guess you need to redo your patches along those lines and
> re-submit them. Likely starting with just a patch adding the
> security_path_set/clear hooks, posted to lsm and fsdevel.
I'll post it soon.
If we pass the access decision result through stack memory, we don't need
security_path_clear() as you mentioned. However, if we pass the vfsmount's
pathname, security_path_clear() is still needed in order to free the pathname.
Regards,
next prev parent reply other threads:[~2008-12-03 8:49 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-20 11:25 [TOMOYO #13 (mmotm 2008-11-19-02-19) 00/11] TOMOYO Linux Tetsuo Handa
2008-11-20 11:25 ` [TOMOYO #13 (mmotm 2008-11-19-02-19) 01/11] Introduce security_path_clear() hook Tetsuo Handa
2008-12-01 20:00 ` Stephen Smalley
2008-12-02 10:39 ` Tetsuo Handa
2008-12-02 13:48 ` Stephen Smalley
2008-12-03 8:49 ` Kentaro Takeda [this message]
2008-12-03 8:56 ` [PATCH (mmotm-2008-12-02-17-08)] Introduce security_path_set/clear() hooks Kentaro Takeda
2008-12-03 14:13 ` Stephen Smalley
2008-12-04 12:00 ` Tetsuo Handa
2008-12-04 18:20 ` Serge E. Hallyn
2008-12-04 21:41 ` [PATCH (mmotm-2008-12-02-17-08)] Introducesecurity_path_set/clear() hooks Tetsuo Handa
2008-12-05 21:53 ` [PATCH (mmotm-2008-12-02-17-08)] Introduce security_path_set/clear() hooks Stephen Smalley
2008-12-05 23:27 ` Tetsuo Handa
2008-12-06 5:25 ` [RFC] Add "reason" parameter to mnt_want_write() Tetsuo Handa
2008-12-06 5:53 ` Al Viro
2008-12-06 6:16 ` [PATCH (mmotm-2008-12-02-17-08)] Introduce security_path_set/clear() hooks Al Viro
2008-11-20 11:25 ` [TOMOYO #13 (mmotm 2008-11-19-02-19) 02/11] Add in_execve flag into task_struct Tetsuo Handa
2008-11-20 11:25 ` [TOMOYO #13 (mmotm 2008-11-19-02-19) 03/11] Singly linked list implementation Tetsuo Handa
2008-11-20 11:25 ` [TOMOYO #13 (mmotm 2008-11-19-02-19) 04/11] Introduce d_realpath() Tetsuo Handa
2008-11-20 11:25 ` [TOMOYO #13 (mmotm 2008-11-19-02-19) 05/11] Memory and pathname management functions Tetsuo Handa
2008-11-20 11:25 ` [TOMOYO #13 (mmotm 2008-11-19-02-19) 06/11] Common functions for TOMOYO Linux Tetsuo Handa
2008-11-20 11:25 ` [TOMOYO #13 (mmotm 2008-11-19-02-19) 07/11] File operation restriction part Tetsuo Handa
2008-11-20 11:25 ` [TOMOYO #13 (mmotm 2008-11-19-02-19) 08/11] Domain transition handler Tetsuo Handa
2008-11-20 11:25 ` [TOMOYO #13 (mmotm 2008-11-19-02-19) 09/11] LSM adapter functions Tetsuo Handa
2008-12-01 20:10 ` Stephen Smalley
2008-12-02 10:40 ` Tetsuo Handa
2008-11-20 11:25 ` [TOMOYO #13 (mmotm 2008-11-19-02-19) 10/11] Kconfig and Makefile Tetsuo Handa
2008-11-20 11:25 ` [TOMOYO #13 (mmotm 2008-11-19-02-19) 11/11] MAINTAINERS info Tetsuo Handa
2008-11-29 11:59 ` [TOMOYO #13 (mmotm 2008-11-19-02-19) 00/11] TOMOYO Linux Tetsuo Handa
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=49364808.1070907@nttdata.co.jp \
--to=takedakn@nttdata.co.jp \
--cc=akpm@linux-foundation.org \
--cc=casey@schaufler-ca.com \
--cc=crispin@crispincowan.com \
--cc=haradats@nttdata.co.jp \
--cc=hch@lst.de \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=sds@tycho.nsa.gov \
--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