[PATCH 07/14] evm: inode post removexattr

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Mimi Zohar
Date: Wednesday, April 21, 2010 - 2:49 pm

When an EVM protected extended attribute is removed, update 'security.evm'.

Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>

diff --git a/fs/xattr.c b/fs/xattr.c
index 341ad71..9372e77 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -14,6 +14,7 @@
 #include <linux/mount.h>
 #include <linux/namei.h>
 #include <linux/security.h>
+#include <linux/evm.h>
 #include <linux/syscalls.h>
 #include <linux/module.h>
 #include <linux/fsnotify.h>
@@ -294,8 +295,10 @@ vfs_removexattr(struct dentry *dentry, const char *name)
 	error = inode->i_op->removexattr(dentry, name);
 	mutex_unlock(&inode->i_mutex);
 
-	if (!error)
+	if (!error) {
 		fsnotify_xattr(dentry);
+		evm_inode_post_removexattr(dentry, name);
+	}
 	return error;
 }
 EXPORT_SYMBOL_GPL(vfs_removexattr);
diff --git a/include/linux/evm.h b/include/linux/evm.h
index 1a30beb..93edadd 100644
--- a/include/linux/evm.h
+++ b/include/linux/evm.h
@@ -22,6 +22,8 @@ extern void evm_inode_post_setxattr(struct dentry *dentry,
 				    const void *xattr_value,
 				    size_t xattr_value_len);
 extern int evm_inode_removexattr(struct dentry *dentry, const char *xattr_name);
+extern void evm_inode_post_removexattr(struct dentry *dentry,
+				       const char *xattr_name);
 #else
 static enum integrity_status evm_verifyxattr(struct dentry *dentry,
 					     char *xattr_name,
@@ -50,5 +52,12 @@ static inline int evm_inode_removexattr(struct dentry *dentry,
 {
 	return 0;
 }
+
+static inline void evm_inode_post_removexattr(struct dentry *dentry,
+					      const char *xattr_name)
+{
+	return;
+}
+
 #endif /* CONFIG_EVM_H */
 #endif /* LINUX_EVM_H */
-- 
1.6.6.1

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/14] EVM, Mimi Zohar, (Wed Apr 21, 2:49 pm)
[PATCH 04/14] evm: re-release, Mimi Zohar, (Wed Apr 21, 2:49 pm)
[PATCH 07/14] evm: inode post removexattr, Mimi Zohar, (Wed Apr 21, 2:49 pm)
[PATCH 08/14] evm: imbed evm_inode_post_setattr, Mimi Zohar, (Wed Apr 21, 2:49 pm)
[PATCH 09/14] evm: inode_post_init, Mimi Zohar, (Wed Apr 21, 2:49 pm)
[PATCH 10/14] fs: add evm_inode_post_init calls, Mimi Zohar, (Wed Apr 21, 2:49 pm)
[PATCH 11/14] ima: integrity appraisal extension, Mimi Zohar, (Wed Apr 21, 2:49 pm)
[PATCH 12/14] ima: appraise default rules, Mimi Zohar, (Wed Apr 21, 2:49 pm)
[PATCH 13/14] ima: inode post_setattr, Mimi Zohar, (Wed Apr 21, 2:49 pm)
Re: [PATCH 00/14] EVM, Randy Dunlap, (Wed Apr 21, 2:58 pm)
Re: [PATCH 00/14] EVM, Mimi Zohar, (Wed Apr 21, 3:18 pm)
Re: [PATCH 00/14] EVM, Randy Dunlap, (Wed Apr 21, 3:23 pm)
Re: [PATCH 00/14] EVM, Mimi Zohar, (Wed Apr 21, 3:41 pm)
Re: [PATCH 04/14] evm: re-release, Serge E. Hallyn, (Mon Apr 26, 2:03 pm)
Re: [PATCH 00/14] EVM, James Morris, (Sun May 30, 5:20 pm)
Re: [PATCH 00/14] EVM, Shaz, (Mon May 31, 3:02 am)
Re: [PATCH 00/14] EVM, Shaz, (Mon May 31, 3:08 am)
Re: [PATCH 00/14] EVM, Mimi Zohar, (Tue Jun 1, 12:28 pm)
Re: [PATCH 00/14] EVM, Dmitry Kasatkin, (Wed Jun 2, 12:03 am)
Re: [PATCH 00/14] EVM, Shaz, (Wed Jun 2, 12:50 am)
Re: [PATCH 00/14] EVM, Dmitry Kasatkin, (Wed Jun 2, 2:12 am)
Re: [PATCH 00/14] EVM, Shaz, (Wed Jun 2, 3:15 am)
Re: [PATCH 00/14] EVM, Dmitry Kasatkin, (Wed Jun 2, 3:23 am)
Re: [PATCH 00/14] EVM, Mimi Zohar, (Wed Jun 2, 7:02 am)
Re: [PATCH 00/14] EVM, James Morris, (Thu Jun 3, 5:57 pm)
Re: [PATCH 00/14] EVM, Shaz, (Thu Jun 3, 11:53 pm)
Re: [PATCH 00/14] EVM, Shaz, (Thu Jun 3, 11:56 pm)
Re: [PATCH 04/14] evm: re-release, Stephen Smalley, (Fri Jun 4, 7:28 am)
Re: [PATCH 04/14] evm: re-release, Mimi Zohar, (Fri Jun 4, 7:53 am)
Re: [PATCH 00/14] EVM, Mimi Zohar, (Fri Jun 4, 8:09 am)
Re: [PATCH 04/14] evm: re-release, Stephen Smalley, (Fri Jun 4, 8:20 am)
Re: [PATCH 04/14] evm: re-release, David Safford, (Fri Jun 4, 11:08 am)
Re: [PATCH 00/14] EVM, Shaz, (Fri Jun 4, 11:47 am)
Re: [ProbableSpam] Re: [PATCH 00/14] EVM, David Safford, (Fri Jun 4, 1:25 pm)