diff options
author | Eric Paris <eparis@redhat.com> | 2011-05-24 20:12:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-25 11:39:31 -0400 |
commit | b09e0fa4b4ea66266058eead43350bd7d55fec67 (patch) | |
tree | 35eed2e1bc39bbbca1c041b69e1e12e826241ccf /fs/Kconfig | |
parent | 4eb317072be81bd93906f768679f745bc574e6b7 (diff) |
tmpfs: implement generic xattr support
Implement generic xattrs for tmpfs filesystems. The Feodra project, while
trying to replace suid apps with file capabilities, realized that tmpfs,
which is used on the build systems, does not support file capabilities and
thus cannot be used to build packages which use file capabilities. Xattrs
are also needed for overlayfs.
The xattr interface is a bit odd. If a filesystem does not implement any
{get,set,list}xattr functions the VFS will call into some random LSM hooks
and the running LSM can then implement some method for handling xattrs.
SELinux for example provides a method to support security.selinux but no
other security.* xattrs.
As it stands today when one enables CONFIG_TMPFS_POSIX_ACL tmpfs will have
xattr handler routines specifically to handle acls. Because of this tmpfs
would loose the VFS/LSM helpers to support the running LSM. To make up
for that tmpfs had stub functions that did nothing but call into the LSM
hooks which implement the helpers.
This new patch does not use the LSM fallback functions and instead just
implements a native get/set/list xattr feature for the full security.* and
trusted.* namespace like a normal filesystem. This means that tmpfs can
now support both security.selinux and security.capability, which was not
previously possible.
The basic implementation is that I attach a:
struct shmem_xattr {
struct list_head list; /* anchored by shmem_inode_info->xattr_list */
char *name;
size_t size;
char value[0];
};
Into the struct shmem_inode_info for each xattr that is set. This
implementation could easily support the user.* namespace as well, except
some care needs to be taken to prevent large amounts of unswappable memory
being allocated for unprivileged users.
[mszeredi@suse.cz: new config option, suport trusted.*, support symlinks]
Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Tested-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Acked-by: Hugh Dickins <hughd@google.com>
Tested-by: Jordi Pujol <jordipujolp@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/Kconfig')
-rw-r--r-- | fs/Kconfig | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/fs/Kconfig b/fs/Kconfig index f3aa9b08b228..979992dcb386 100644 --- a/fs/Kconfig +++ b/fs/Kconfig | |||
@@ -121,9 +121,25 @@ config TMPFS | |||
121 | 121 | ||
122 | See <file:Documentation/filesystems/tmpfs.txt> for details. | 122 | See <file:Documentation/filesystems/tmpfs.txt> for details. |
123 | 123 | ||
124 | config TMPFS_XATTR | ||
125 | bool "Tmpfs extended attributes" | ||
126 | depends on TMPFS | ||
127 | default n | ||
128 | help | ||
129 | Extended attributes are name:value pairs associated with inodes by | ||
130 | the kernel or by users (see the attr(5) manual page, or visit | ||
131 | <http://acl.bestbits.at/> for details). | ||
132 | |||
133 | Currently this enables support for the trusted.* and | ||
134 | security.* namespaces. | ||
135 | |||
136 | If unsure, say N. | ||
137 | |||
138 | You need this for POSIX ACL support on tmpfs. | ||
139 | |||
124 | config TMPFS_POSIX_ACL | 140 | config TMPFS_POSIX_ACL |
125 | bool "Tmpfs POSIX Access Control Lists" | 141 | bool "Tmpfs POSIX Access Control Lists" |
126 | depends on TMPFS | 142 | depends on TMPFS_XATTR |
127 | select GENERIC_ACL | 143 | select GENERIC_ACL |
128 | help | 144 | help |
129 | POSIX Access Control Lists (ACLs) support permissions for users and | 145 | POSIX Access Control Lists (ACLs) support permissions for users and |