summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorRichard Guy Briggs <rgb@redhat.com>2019-03-26 14:49:20 -0400
committerPaul Moore <paul@paul-moore.com>2019-03-27 18:11:52 -0400
commita1aa08a01f734d48a8f76b12aca9f4e4adae7649 (patch)
treee313baf2bfba83b688c3c75522db2a42ad4fa753 /security
parent16add411645cff83360086e102daa67b25f1e39a (diff)
audit: link integrity evm_write_xattrs record to syscall event
In commit fa516b66a1bf ("EVM: Allow runtime modification of the set of verified xattrs"), the call to audit_log_start() is missing a context to link it to an audit event. Since this event is in user context, add the process' syscall context to the record. In addition, the orphaned keyword "locked" appears in the record. Normalize this by changing it to logging the locking string "." as any other user input in the "xattr=" field. Please see the github issue https://github.com/linux-audit/audit-kernel/issues/109 Signed-off-by: Richard Guy Briggs <rgb@redhat.com> Acked-by: Mimi Zohar <zohar@linux.ibm.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security')
-rw-r--r--security/integrity/evm/evm_secfs.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/security/integrity/evm/evm_secfs.c b/security/integrity/evm/evm_secfs.c
index 015aea8fdf1e..3f7cbb238923 100644
--- a/security/integrity/evm/evm_secfs.c
+++ b/security/integrity/evm/evm_secfs.c
@@ -192,7 +192,8 @@ static ssize_t evm_write_xattrs(struct file *file, const char __user *buf,
192 if (count > XATTR_NAME_MAX) 192 if (count > XATTR_NAME_MAX)
193 return -E2BIG; 193 return -E2BIG;
194 194
195 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_INTEGRITY_EVM_XATTR); 195 ab = audit_log_start(audit_context(), GFP_KERNEL,
196 AUDIT_INTEGRITY_EVM_XATTR);
196 if (!ab) 197 if (!ab)
197 return -ENOMEM; 198 return -ENOMEM;
198 199
@@ -214,6 +215,9 @@ static ssize_t evm_write_xattrs(struct file *file, const char __user *buf,
214 if (len && xattr->name[len-1] == '\n') 215 if (len && xattr->name[len-1] == '\n')
215 xattr->name[len-1] = '\0'; 216 xattr->name[len-1] = '\0';
216 217
218 audit_log_format(ab, "xattr=");
219 audit_log_untrustedstring(ab, xattr->name);
220
217 if (strcmp(xattr->name, ".") == 0) { 221 if (strcmp(xattr->name, ".") == 0) {
218 evm_xattrs_locked = 1; 222 evm_xattrs_locked = 1;
219 newattrs.ia_mode = S_IFREG | 0440; 223 newattrs.ia_mode = S_IFREG | 0440;
@@ -222,15 +226,11 @@ static ssize_t evm_write_xattrs(struct file *file, const char __user *buf,
222 inode_lock(inode); 226 inode_lock(inode);
223 err = simple_setattr(evm_xattrs, &newattrs); 227 err = simple_setattr(evm_xattrs, &newattrs);
224 inode_unlock(inode); 228 inode_unlock(inode);
225 audit_log_format(ab, "locked");
226 if (!err) 229 if (!err)
227 err = count; 230 err = count;
228 goto out; 231 goto out;
229 } 232 }
230 233
231 audit_log_format(ab, "xattr=");
232 audit_log_untrustedstring(ab, xattr->name);
233
234 if (strncmp(xattr->name, XATTR_SECURITY_PREFIX, 234 if (strncmp(xattr->name, XATTR_SECURITY_PREFIX,
235 XATTR_SECURITY_PREFIX_LEN) != 0) { 235 XATTR_SECURITY_PREFIX_LEN) != 0) {
236 err = -EINVAL; 236 err = -EINVAL;