Re: (repost) Confirmation of methods for calculating requested pathname.

From: Jamie Lokier
Date: Tue Sep 02 2008 - 02:42:21 EST


Kentaro Takeda wrote:
> If our understanding is correct, we would like to propose a new
> method that does not require modifications to vfs helper functions.
> Attached patch is a trial of this method.
>
> vfs helper functions are surrounded by mnt_want_write() and
> mnt_drop_write() pairs which receive "struct vfsmount" parameter
> since 2.6.26. So, by remembering the absolute pathname of "struct
> vfsmount" of the moment, LSM module can calculate an absolute
> pathname of the given "struct dentry" parameter inside vfs_*
> functions, without passing "struct vfsmount" parameter to vfs_*
> functions.
>
> This approach doesn't access vfsmount inside vfs helper functions,
> and modification of existing kernel is only in task_struct and
> mnt_want/drop_write().

This is exactly the same as passing vfsmount through vfs helper functions,
except the parameter is "hidden" inside struct task.

Although this seems to violate the idea that the vfs helper call
chains (including functions they call) aren't affected by the mount
point, to be frank they are affected by the mount point _already_ - by
virtue of mnt_get_write()/mnt_drop_write() existing.

Ironically, the _current_ way that vfs helper call chains are affected
by mount point is for security: read-only mount points are basic security.

So I don't understand the objection to using path mount point in
security decisions, given that it already is to some extent.

This patch seems ugly at first because of hidden parameters in struct
task. On the other hand, mnt_get_write() already does a similar thing
(and the implementation is uglier imho, though clever), and it is accepted.

-- Jamie
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/