security/lsm_hooks: Updated set/remove xattr documentation
PATCH 1/1 security/lsm_hooks: Updated set/remove xattr documentation
The inode_setxattr and inode_removexattr hooks check for CAP_SYS_ADMIN capability when no LSMs exist. When LSMs exist, the hook expects them to check for capabilities - which SMACK and SELinux indeed do.
This behavior is only mentioned in a comment in the hooks' implementation. This patch makes it clearer for LSM programmers that when implememting these hooks they are responsible for the CAP check.
Signed-off-by Carmeli Tamir <[email protected]>
--- include/linux/lsm_hooks.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
include/linux/lsm_hooks.h +4 -2
@@ -377,7 +377,8 @@* Return 0 if permission is granted. * @inode_setxattr: * Check permission before setting the extended attributes -* @value identified by @name for @dentry. +* @value identified by @name for @dentry. Note that the hook +* is responsible to check for capabilities. * Return 0 if permission is granted. * @inode_post_setxattr: * Update inode security field after successful setxattr operation.
@@ -392,7 +393,8 @@* Return 0 if permission is granted. * @inode_removexattr: * Check permission before removing the extended attribute -* identified by @name for @dentry. +* identified by @name for @dentry. Note that the hook +* is responsible to check for capabilities. * Return 0 if permission is granted. * @inode_getsecurity: * Retrieve a copy of the extended attribute representation of the
Signature · 1 line
2.21.0