diff options
author | Tejun Heo <tj@kernel.org> | 2013-11-23 17:40:02 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-12-04 10:34:45 -0500 |
commit | 2322392b020badfe49730f1529b9c1a15248c387 (patch) | |
tree | da17c0d183045351ae25f8173f2c0cfd7c7b8a55 /fs/kernfs/kernfs-internal.h | |
parent | 9a8049affd55a2c857a89faece27b878416fbf91 (diff) |
kernfs: implement "trusted.*" xattr support
kernfs inherited "security.*" xattr support from sysfs. This patch
extends xattr support to "trusted.*" using simple_xattr_*(). As
trusted xattrs are restricted to CAP_SYS_ADMIN, simple_xattr_*() which
uses kernel memory for storage shouldn't be problematic.
Note that the existing "security.*" support doesn't implement
get/remove/list and the this patch only implements those ops for
"trusted.*". We probably want to extend those ops to include support
for "security.*".
This patch will allow using kernfs from cgroup which requires
"trusted.*" xattr support.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: David P. Quigley <dpquigl@tycho.nsa.gov>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs/kernfs-internal.h')
-rw-r--r-- | fs/kernfs/kernfs-internal.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/kernfs/kernfs-internal.h b/fs/kernfs/kernfs-internal.h index f25b3548bcca..910e485b7333 100644 --- a/fs/kernfs/kernfs-internal.h +++ b/fs/kernfs/kernfs-internal.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/lockdep.h> | 14 | #include <linux/lockdep.h> |
15 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
16 | #include <linux/mutex.h> | 16 | #include <linux/mutex.h> |
17 | #include <linux/xattr.h> | ||
17 | 18 | ||
18 | #include <linux/kernfs.h> | 19 | #include <linux/kernfs.h> |
19 | 20 | ||
@@ -21,6 +22,8 @@ struct sysfs_inode_attrs { | |||
21 | struct iattr ia_iattr; | 22 | struct iattr ia_iattr; |
22 | void *ia_secdata; | 23 | void *ia_secdata; |
23 | u32 ia_secdata_len; | 24 | u32 ia_secdata_len; |
25 | |||
26 | struct simple_xattrs xattrs; | ||
24 | }; | 27 | }; |
25 | 28 | ||
26 | #define SD_DEACTIVATED_BIAS INT_MIN | 29 | #define SD_DEACTIVATED_BIAS INT_MIN |
@@ -81,6 +84,10 @@ int sysfs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
81 | struct kstat *stat); | 84 | struct kstat *stat); |
82 | int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value, | 85 | int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value, |
83 | size_t size, int flags); | 86 | size_t size, int flags); |
87 | int sysfs_removexattr(struct dentry *dentry, const char *name); | ||
88 | ssize_t sysfs_getxattr(struct dentry *dentry, const char *name, void *buf, | ||
89 | size_t size); | ||
90 | ssize_t sysfs_listxattr(struct dentry *dentry, char *buf, size_t size); | ||
84 | void sysfs_inode_init(void); | 91 | void sysfs_inode_init(void); |
85 | 92 | ||
86 | /* | 93 | /* |