1 /* SPDX-License-Identifier: GPL-2.0 */
5 * Copyright (c) 2009 IBM Corporation
12 #include <linux/integrity.h>
13 #include <linux/xattr.h>
15 struct integrity_iint_cache;
18 extern int evm_set_key(void *key, size_t keylen);
19 extern enum integrity_status evm_verifyxattr(struct dentry *dentry,
20 const char *xattr_name,
22 size_t xattr_value_len,
23 struct integrity_iint_cache *iint);
24 extern int evm_inode_setattr(struct mnt_idmap *idmap,
25 struct dentry *dentry, struct iattr *attr);
26 extern void evm_inode_post_setattr(struct dentry *dentry, int ia_valid);
27 extern int evm_inode_setxattr(struct mnt_idmap *idmap,
28 struct dentry *dentry, const char *name,
29 const void *value, size_t size);
30 extern void evm_inode_post_setxattr(struct dentry *dentry,
31 const char *xattr_name,
32 const void *xattr_value,
33 size_t xattr_value_len);
34 extern int evm_inode_removexattr(struct mnt_idmap *idmap,
35 struct dentry *dentry, const char *xattr_name);
36 extern void evm_inode_post_removexattr(struct dentry *dentry,
37 const char *xattr_name);
38 static inline void evm_inode_post_remove_acl(struct mnt_idmap *idmap,
39 struct dentry *dentry,
42 evm_inode_post_removexattr(dentry, acl_name);
44 extern int evm_inode_set_acl(struct mnt_idmap *idmap,
45 struct dentry *dentry, const char *acl_name,
46 struct posix_acl *kacl);
47 static inline int evm_inode_remove_acl(struct mnt_idmap *idmap,
48 struct dentry *dentry,
51 return evm_inode_set_acl(idmap, dentry, acl_name, NULL);
53 static inline void evm_inode_post_set_acl(struct dentry *dentry,
55 struct posix_acl *kacl)
57 return evm_inode_post_setxattr(dentry, acl_name, NULL, 0);
59 extern int evm_inode_init_security(struct inode *inode,
60 const struct xattr *xattr_array,
62 extern bool evm_revalidate_status(const char *xattr_name);
63 extern int evm_protected_xattr_if_enabled(const char *req_xattr_name);
64 extern int evm_read_protected_xattrs(struct dentry *dentry, u8 *buffer,
65 int buffer_size, char type,
67 #ifdef CONFIG_FS_POSIX_ACL
68 extern int posix_xattr_acl(const char *xattrname);
70 static inline int posix_xattr_acl(const char *xattrname)
77 static inline int evm_set_key(void *key, size_t keylen)
82 #ifdef CONFIG_INTEGRITY
83 static inline enum integrity_status evm_verifyxattr(struct dentry *dentry,
84 const char *xattr_name,
86 size_t xattr_value_len,
87 struct integrity_iint_cache *iint)
89 return INTEGRITY_UNKNOWN;
93 static inline int evm_inode_setattr(struct mnt_idmap *idmap,
94 struct dentry *dentry, struct iattr *attr)
99 static inline void evm_inode_post_setattr(struct dentry *dentry, int ia_valid)
104 static inline int evm_inode_setxattr(struct mnt_idmap *idmap,
105 struct dentry *dentry, const char *name,
106 const void *value, size_t size)
111 static inline void evm_inode_post_setxattr(struct dentry *dentry,
112 const char *xattr_name,
113 const void *xattr_value,
114 size_t xattr_value_len)
119 static inline int evm_inode_removexattr(struct mnt_idmap *idmap,
120 struct dentry *dentry,
121 const char *xattr_name)
126 static inline void evm_inode_post_removexattr(struct dentry *dentry,
127 const char *xattr_name)
132 static inline void evm_inode_post_remove_acl(struct mnt_idmap *idmap,
133 struct dentry *dentry,
134 const char *acl_name)
139 static inline int evm_inode_set_acl(struct mnt_idmap *idmap,
140 struct dentry *dentry, const char *acl_name,
141 struct posix_acl *kacl)
146 static inline int evm_inode_remove_acl(struct mnt_idmap *idmap,
147 struct dentry *dentry,
148 const char *acl_name)
153 static inline void evm_inode_post_set_acl(struct dentry *dentry,
154 const char *acl_name,
155 struct posix_acl *kacl)
160 static inline int evm_inode_init_security(struct inode *inode,
161 const struct xattr *xattr_array,
167 static inline bool evm_revalidate_status(const char *xattr_name)
172 static inline int evm_protected_xattr_if_enabled(const char *req_xattr_name)
177 static inline int evm_read_protected_xattrs(struct dentry *dentry, u8 *buffer,
178 int buffer_size, char type,
184 #endif /* CONFIG_EVM */
185 #endif /* LINUX_EVM_H */