diff options
| -rw-r--r-- | fs/ubifs/Kconfig | 13 | ||||
| -rw-r--r-- | fs/ubifs/ubifs.h | 14 | ||||
| -rw-r--r-- | fs/ubifs/xattr.c | 6 |
3 files changed, 31 insertions, 2 deletions
diff --git a/fs/ubifs/Kconfig b/fs/ubifs/Kconfig index b0d0623c83ed..83a961bf7280 100644 --- a/fs/ubifs/Kconfig +++ b/fs/ubifs/Kconfig | |||
| @@ -61,3 +61,16 @@ config UBIFS_FS_ENCRYPTION | |||
| 61 | feature is similar to ecryptfs, but it is more memory | 61 | feature is similar to ecryptfs, but it is more memory |
| 62 | efficient since it avoids caching the encrypted and | 62 | efficient since it avoids caching the encrypted and |
| 63 | decrypted pages in the page cache. | 63 | decrypted pages in the page cache. |
| 64 | |||
| 65 | config UBIFS_FS_SECURITY | ||
| 66 | bool "UBIFS Security Labels" | ||
| 67 | depends on UBIFS_FS | ||
| 68 | default y | ||
| 69 | help | ||
| 70 | Security labels provide an access control facility to support Linux | ||
| 71 | Security Models (LSMs) accepted by AppArmor, SELinux, Smack and TOMOYO | ||
| 72 | Linux. This option enables an extended attribute handler for file | ||
| 73 | security labels in the ubifs filesystem, so that it requires enabling | ||
| 74 | the extended attribute support in advance. | ||
| 75 | |||
| 76 | If you are not using a security module, say N. | ||
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 4d57e488038e..abdd11634ba4 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
| @@ -1756,13 +1756,23 @@ int ubifs_check_dir_empty(struct inode *dir); | |||
| 1756 | /* xattr.c */ | 1756 | /* xattr.c */ |
| 1757 | extern const struct xattr_handler *ubifs_xattr_handlers[]; | 1757 | extern const struct xattr_handler *ubifs_xattr_handlers[]; |
| 1758 | ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size); | 1758 | ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size); |
| 1759 | int ubifs_init_security(struct inode *dentry, struct inode *inode, | ||
| 1760 | const struct qstr *qstr); | ||
| 1761 | int ubifs_xattr_set(struct inode *host, const char *name, const void *value, | 1759 | int ubifs_xattr_set(struct inode *host, const char *name, const void *value, |
| 1762 | size_t size, int flags); | 1760 | size_t size, int flags); |
| 1763 | ssize_t ubifs_xattr_get(struct inode *host, const char *name, void *buf, | 1761 | ssize_t ubifs_xattr_get(struct inode *host, const char *name, void *buf, |
| 1764 | size_t size); | 1762 | size_t size); |
| 1765 | 1763 | ||
| 1764 | #ifdef CONFIG_UBIFS_FS_SECURITY | ||
| 1765 | extern int ubifs_init_security(struct inode *dentry, struct inode *inode, | ||
| 1766 | const struct qstr *qstr); | ||
| 1767 | #else | ||
| 1768 | static inline int ubifs_init_security(struct inode *dentry, | ||
| 1769 | struct inode *inode, const struct qstr *qstr) | ||
| 1770 | { | ||
| 1771 | return 0; | ||
| 1772 | } | ||
| 1773 | #endif | ||
| 1774 | |||
| 1775 | |||
| 1766 | /* super.c */ | 1776 | /* super.c */ |
| 1767 | struct inode *ubifs_iget(struct super_block *sb, unsigned long inum); | 1777 | struct inode *ubifs_iget(struct super_block *sb, unsigned long inum); |
| 1768 | 1778 | ||
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c index efe00fcb8b75..de88732c680c 100644 --- a/fs/ubifs/xattr.c +++ b/fs/ubifs/xattr.c | |||
| @@ -559,6 +559,7 @@ out_free: | |||
| 559 | return err; | 559 | return err; |
| 560 | } | 560 | } |
| 561 | 561 | ||
| 562 | #ifdef CONFIG_UBIFS_FS_SECURITY | ||
| 562 | static int init_xattrs(struct inode *inode, const struct xattr *xattr_array, | 563 | static int init_xattrs(struct inode *inode, const struct xattr *xattr_array, |
| 563 | void *fs_info) | 564 | void *fs_info) |
| 564 | { | 565 | { |
| @@ -599,6 +600,7 @@ int ubifs_init_security(struct inode *dentry, struct inode *inode, | |||
| 599 | } | 600 | } |
| 600 | return err; | 601 | return err; |
| 601 | } | 602 | } |
| 603 | #endif | ||
| 602 | 604 | ||
| 603 | static int xattr_get(const struct xattr_handler *handler, | 605 | static int xattr_get(const struct xattr_handler *handler, |
| 604 | struct dentry *dentry, struct inode *inode, | 606 | struct dentry *dentry, struct inode *inode, |
| @@ -639,15 +641,19 @@ static const struct xattr_handler ubifs_trusted_xattr_handler = { | |||
| 639 | .set = xattr_set, | 641 | .set = xattr_set, |
| 640 | }; | 642 | }; |
| 641 | 643 | ||
| 644 | #ifdef CONFIG_UBIFS_FS_SECURITY | ||
| 642 | static const struct xattr_handler ubifs_security_xattr_handler = { | 645 | static const struct xattr_handler ubifs_security_xattr_handler = { |
| 643 | .prefix = XATTR_SECURITY_PREFIX, | 646 | .prefix = XATTR_SECURITY_PREFIX, |
| 644 | .get = xattr_get, | 647 | .get = xattr_get, |
| 645 | .set = xattr_set, | 648 | .set = xattr_set, |
| 646 | }; | 649 | }; |
| 650 | #endif | ||
| 647 | 651 | ||
| 648 | const struct xattr_handler *ubifs_xattr_handlers[] = { | 652 | const struct xattr_handler *ubifs_xattr_handlers[] = { |
| 649 | &ubifs_user_xattr_handler, | 653 | &ubifs_user_xattr_handler, |
| 650 | &ubifs_trusted_xattr_handler, | 654 | &ubifs_trusted_xattr_handler, |
| 655 | #ifdef CONFIG_UBIFS_FS_SECURITY | ||
| 651 | &ubifs_security_xattr_handler, | 656 | &ubifs_security_xattr_handler, |
| 657 | #endif | ||
| 652 | NULL | 658 | NULL |
| 653 | }; | 659 | }; |
