linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] security/lsm_hooks: Updated set/remove xattr documentation
@ 2019-07-10 19:06 Carmeli Tamir
  0 siblings, 0 replies; only message in thread
From: Carmeli Tamir @ 2019-07-10 19:06 UTC (permalink / raw)
  To: keescook, casey, james.morris, efremov, viro, dhowells,
	linux-kernel, carmeli.tamir

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-07-10 19:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-10 19:06 [PATCH] security/lsm_hooks: Updated set/remove xattr documentation Carmeli Tamir

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).