diff options
author | Andrew Morton <akpm@digeo.com> | 2003-05-07 08:20:32 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-05-07 08:20:32 -0700 |
commit | c5013b3f2e7e74b415aa708a31451dfa07fe59e1 (patch) | |
tree | 5d699c36169fe07c2ead9b4f61f1b04fe381719e /fs/ext3/xattr.c | |
parent | 3558ebfc6791bcfcfaf8bd9e3a4c0a28d0c54e51 (diff) | |
download | history-c5013b3f2e7e74b415aa708a31451dfa07fe59e1.tar.gz |
[PATCH] ext3 xattr handler for security modules
From: Stephen Smalley <sds@epoch.ncsc.mil>
This patch against 2.5.68 implements an xattr handler for ext3 to support the
use of extended attributes by security modules for storing file security
labels. As per the earlier discussion of extended attributes for security
modules, this handler uses a "security." prefix and allows for per-module
attribute names. Security checking for userspace access to these attributes
can be performed by the security module using the LSM hooks in fs/xattr.c,
and the security module is free to internally use the inode operations
without restriction for managing its security labels. Unlike the trusted
namespace, these labels are used internally for access control purposes by
the security modules, and controls over userspace access to them require
finer granularity than capable() supports.
Diffstat (limited to 'fs/ext3/xattr.c')
-rw-r--r-- | fs/ext3/xattr.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c index 46863b4ff8df81..cd8cb24a344158 100644 --- a/fs/ext3/xattr.c +++ b/fs/ext3/xattr.c @@ -1142,22 +1142,33 @@ init_ext3_xattr(void) &ext3_xattr_trusted_handler); if (err) goto out; +#ifdef CONFIG_EXT3_FS_SECURITY + err = ext3_xattr_register(EXT3_XATTR_INDEX_SECURITY, + &ext3_xattr_security_handler); + if (err) + goto out1; +#endif #ifdef CONFIG_EXT3_FS_POSIX_ACL err = init_ext3_acl(); if (err) - goto out1; + goto out2; #endif ext3_xattr_cache = mb_cache_create("ext3_xattr", NULL, sizeof(struct mb_cache_entry) + sizeof(struct mb_cache_entry_index), 1, 6); if (!ext3_xattr_cache) { err = -ENOMEM; - goto out2; + goto out3; } return 0; -out2: +out3: #ifdef CONFIG_EXT3_FS_POSIX_ACL exit_ext3_acl(); +out2: +#endif +#ifdef CONFIG_EXT3_FS_SECURITY + ext3_xattr_unregister(EXT3_XATTR_INDEX_SECURITY, + &ext3_xattr_security_handler); out1: #endif ext3_xattr_unregister(EXT3_XATTR_INDEX_TRUSTED, @@ -1177,6 +1188,10 @@ exit_ext3_xattr(void) #ifdef CONFIG_EXT3_FS_POSIX_ACL exit_ext3_acl(); #endif +#ifdef CONFIG_EXT3_FS_SECURITY + ext3_xattr_unregister(EXT3_XATTR_INDEX_SECURITY, + &ext3_xattr_security_handler); +#endif ext3_xattr_unregister(EXT3_XATTR_INDEX_TRUSTED, &ext3_xattr_trusted_handler); ext3_xattr_unregister(EXT3_XATTR_INDEX_USER, |