Skip to content
Snippets Groups Projects
Commit a1aa08a0 authored by Richard Guy Briggs's avatar Richard Guy Briggs Committed by Paul Moore
Browse files

audit: link integrity evm_write_xattrs record to syscall event

In commit fa516b66 ("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: default avatarRichard Guy Briggs <rgb@redhat.com>
Acked-by: default avatarMimi Zohar <zohar@linux.ibm.com>
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
parent 16add411
No related branches found
No related tags found
No related merge requests found
...@@ -192,7 +192,8 @@ static ssize_t evm_write_xattrs(struct file *file, const char __user *buf, ...@@ -192,7 +192,8 @@ static ssize_t evm_write_xattrs(struct file *file, const char __user *buf,
if (count > XATTR_NAME_MAX) if (count > XATTR_NAME_MAX)
return -E2BIG; return -E2BIG;
ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_INTEGRITY_EVM_XATTR); ab = audit_log_start(audit_context(), GFP_KERNEL,
AUDIT_INTEGRITY_EVM_XATTR);
if (!ab) if (!ab)
return -ENOMEM; return -ENOMEM;
...@@ -214,6 +215,9 @@ static ssize_t evm_write_xattrs(struct file *file, const char __user *buf, ...@@ -214,6 +215,9 @@ static ssize_t evm_write_xattrs(struct file *file, const char __user *buf,
if (len && xattr->name[len-1] == '\n') if (len && xattr->name[len-1] == '\n')
xattr->name[len-1] = '\0'; xattr->name[len-1] = '\0';
audit_log_format(ab, "xattr=");
audit_log_untrustedstring(ab, xattr->name);
if (strcmp(xattr->name, ".") == 0) { if (strcmp(xattr->name, ".") == 0) {
evm_xattrs_locked = 1; evm_xattrs_locked = 1;
newattrs.ia_mode = S_IFREG | 0440; newattrs.ia_mode = S_IFREG | 0440;
...@@ -222,15 +226,11 @@ static ssize_t evm_write_xattrs(struct file *file, const char __user *buf, ...@@ -222,15 +226,11 @@ static ssize_t evm_write_xattrs(struct file *file, const char __user *buf,
inode_lock(inode); inode_lock(inode);
err = simple_setattr(evm_xattrs, &newattrs); err = simple_setattr(evm_xattrs, &newattrs);
inode_unlock(inode); inode_unlock(inode);
audit_log_format(ab, "locked");
if (!err) if (!err)
err = count; err = count;
goto out; goto out;
} }
audit_log_format(ab, "xattr=");
audit_log_untrustedstring(ab, xattr->name);
if (strncmp(xattr->name, XATTR_SECURITY_PREFIX, if (strncmp(xattr->name, XATTR_SECURITY_PREFIX,
XATTR_SECURITY_PREFIX_LEN) != 0) { XATTR_SECURITY_PREFIX_LEN) != 0) {
err = -EINVAL; err = -EINVAL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment