file context questions
Hi!
Several questions here:
1. What is the difference between getfilecon and lgetfilecon?
2. I cannot [l]getfilecon /selinux/context even in permissive mode. What's happening? Is there a way to get file contexts of a genfscontexted file, or I have to guess?
3. If I use genfscontext and fs_use for the same file, which will be in effect? (or genfscontext is just fs_use_genfs?)
4. When I boot, several filesystems are not configured for labeling. Which is the recommended way to label each of them, and why? (And anyway, what the heck are they?)
eventpollfs
tmpfs
futexfs
bdev
rootfs
sysfs
usbfs
usbdevfs
Signature · 7 lines
GNU GPL: csak tiszta forrásból -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 1 line · Magosányi Árpád
1. What is the difference between getfilecon and lgetfilecon?
Analogous to stat(2) vs. lstat(2) or getxattr(2) vs. lgetxattr(2). Identical when applied to a non-symlink. When applied to a symlink, getfilecon will return the context of the referenced file, while lgetfilecon will return the context of the symlink itself.
Quoted 3 lines
2. I cannot [l]getfilecon /selinux/context even in permissive mode. What's happening? Is there a way to get file contexts of a genfscontexted file, or I have to guess?
selinuxfs doesn't presently provide an xattr handler, so its contexts aren't exported to userspace. You could easily implement a fake xattr handler for it, as we have already done for devpts (to support relabeling of ptys by sshd) and are likely to do for tmpfs, but we haven't had a need for one for selinuxfs yet.
Quoted 2 lines
3. If I use genfscontext and
fs_usefor the same file, which will be in effect? (or genfscontext is justfs_use_genfs?)
Should be an error, as they are exclusive. I think that the current code will simply end up using the fs_use rule and ignore the genfs_contexts entries, as it checks the fs_use list first when determining the labeling behavior for the filesystem type.
Quoted 11 lines
4. When I boot, several filesystems are not configured for labeling. Which is the recommended way to label each of them, and why? (And anyway, what the heck are they?)
eventpollfs
tmpfs
futexfs
bdev
rootfs
sysfs
usbfs
usbdevfs
Look at the policy in the sourceforge CVS tree.
Signature · 8 lines
Stephen Smalley <[email protected]> National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.