Getting full path from dentry in LSM hooks

From: Kristian Sørensen
Date: Fri Sep 03 2004 - 07:21:35 EST


Hi!

I have a short question, concerning how to get the full path of a file from a LSM hook.

- If the "file" of the dentry is located in the root filesystem: no
problem - simply traverse the dentrys, to generate the path.

- If the "file" is mounted from another partition, you do not get the
full path by traversing the dentrys.

Example:
If we have a system with a normal root (/) and a seperate boot partition (mounted on /boot :). In the LSM hook inode_permission, you get the arguments (struct inode *inode, int mask, struct nameidata *nd).
Finding the path, we traverse the dentrys from (nd->dentry). But if the inode is a file in /boot we only get the filename (e.g. kernel-2.6.8.1 instead of /boot/kernel-2.6.8.1)


Can some one reveal the trick to get the full path nomater if the filesystem is root or mounted elsewhere in the filesystem?


Best regards,
Kristian Sørensen.
The Umbrella Project -- http://umbrella.sf.net
-
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/