linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Carmeli Tamir <carmeli.tamir@gmail.com>
To: keescook@chromium.org, casey@schaufler-ca.com,
	james.morris@microsoft.com, efremov@ispras.ru,
	viro@zeniv.linux.org.uk, dhowells@redhat.com,
	linux-kernel@vger.kernel.org, carmeli.tamir@gmail.com
Subject: [PATCH] security/lsm_hooks: Updated set/remove xattr documentation
Date: Wed, 10 Jul 2019 15:06:07 -0400	[thread overview]
Message-ID: <20190710190607.5026-1-carmeli.tamir@gmail.com> (raw)

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


                 reply	other threads:[~2019-07-10 19:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190710190607.5026-1-carmeli.tamir@gmail.com \
    --to=carmeli.tamir@gmail.com \
    --cc=casey@schaufler-ca.com \
    --cc=dhowells@redhat.com \
    --cc=efremov@ispras.ru \
    --cc=james.morris@microsoft.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).