Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753097AbYLCIte (ORCPT ); Wed, 3 Dec 2008 03:49:34 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751283AbYLCItX (ORCPT ); Wed, 3 Dec 2008 03:49:23 -0500 Received: from ms0.nttdata.co.jp ([163.135.193.231]:49633 "EHLO ms0.nttdata.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751208AbYLCItW (ORCPT ); Wed, 3 Dec 2008 03:49:22 -0500 Message-ID: <49364808.1070907@nttdata.co.jp> Date: Wed, 03 Dec 2008 17:49:12 +0900 From: Kentaro Takeda User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.8.1.18) Gecko/20081105 Thunderbird/2.0.0.18 Mnenhy/0.7.5.0 MIME-Version: 1.0 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. References: <20081120112543.799450455@I-love.SAKURA.ne.jp> <20081120112727.557697893@I-love.SAKURA.ne.jp> <1228161612.18720.211.camel@moss-spartans.epoch.ncsc.mil> <200812021939.FFC05200.OVQJSOMtFFHLFO@I-love.SAKURA.ne.jp> <1228225719.26101.52.camel@moss-spartans.epoch.ncsc.mil> In-Reply-To: <1228225719.26101.52.camel@moss-spartans.epoch.ncsc.mil> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 03 Dec 2008 08:49:13.0974 (UTC) FILETIME=[04846960:01C95524] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3774 Lines: 74 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, -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/