lkml.org 
[lkml]   [2019]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] security/lsm_hooks: Updated set/remove xattr documentation
Date
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 <carmeli.tamir@gmail.com>
---
include/linux/lsm_hooks.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index 47f58cfb6a19..d16c88a31ea9 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -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
--
2.21.0
\
 
 \ /
  Last update: 2019-07-10 21:07    [W:0.041 / U:2.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site