Commit c158a35c authored by Kees Cook's avatar Kees Cook Committed by Al Viro

audit: no leading space in audit_log_d_path prefix

audit_log_d_path() injects an additional space before the prefix,
which serves no purpose and doesn't mix well with other audit_log*()
functions that do not sneak extra characters into the log.
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarEric Paris <eparis@redhat.com>
parent 41fdc305
...@@ -1423,7 +1423,7 @@ void audit_log_d_path(struct audit_buffer *ab, const char *prefix, ...@@ -1423,7 +1423,7 @@ void audit_log_d_path(struct audit_buffer *ab, const char *prefix,
char *p, *pathname; char *p, *pathname;
if (prefix) if (prefix)
audit_log_format(ab, " %s", prefix); audit_log_format(ab, "%s", prefix);
/* We will allow 11 spaces for ' (deleted)' to be appended */ /* We will allow 11 spaces for ' (deleted)' to be appended */
pathname = kmalloc(PATH_MAX+11, ab->gfp_mask); pathname = kmalloc(PATH_MAX+11, ab->gfp_mask);
......
...@@ -1171,7 +1171,7 @@ static void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk ...@@ -1171,7 +1171,7 @@ static void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk
while (vma) { while (vma) {
if ((vma->vm_flags & VM_EXECUTABLE) && if ((vma->vm_flags & VM_EXECUTABLE) &&
vma->vm_file) { vma->vm_file) {
audit_log_d_path(ab, "exe=", audit_log_d_path(ab, " exe=",
&vma->vm_file->f_path); &vma->vm_file->f_path);
break; break;
} }
...@@ -1540,7 +1540,7 @@ static void audit_log_name(struct audit_context *context, struct audit_names *n, ...@@ -1540,7 +1540,7 @@ static void audit_log_name(struct audit_context *context, struct audit_names *n,
case 0: case 0:
/* name was specified as a relative path and the /* name was specified as a relative path and the
* directory component is the cwd */ * directory component is the cwd */
audit_log_d_path(ab, "name=", &context->pwd); audit_log_d_path(ab, " name=", &context->pwd);
break; break;
default: default:
/* log the name's directory component */ /* log the name's directory component */
...@@ -1725,7 +1725,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts ...@@ -1725,7 +1725,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
if (context->pwd.dentry && context->pwd.mnt) { if (context->pwd.dentry && context->pwd.mnt) {
ab = audit_log_start(context, GFP_KERNEL, AUDIT_CWD); ab = audit_log_start(context, GFP_KERNEL, AUDIT_CWD);
if (ab) { if (ab) {
audit_log_d_path(ab, "cwd=", &context->pwd); audit_log_d_path(ab, " cwd=", &context->pwd);
audit_log_end(ab); audit_log_end(ab);
} }
} }
......
...@@ -232,7 +232,7 @@ static void dump_common_audit_data(struct audit_buffer *ab, ...@@ -232,7 +232,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
case LSM_AUDIT_DATA_PATH: { case LSM_AUDIT_DATA_PATH: {
struct inode *inode; struct inode *inode;
audit_log_d_path(ab, "path=", &a->u.path); audit_log_d_path(ab, " path=", &a->u.path);
inode = a->u.path.dentry->d_inode; inode = a->u.path.dentry->d_inode;
if (inode) { if (inode) {
...@@ -318,7 +318,7 @@ static void dump_common_audit_data(struct audit_buffer *ab, ...@@ -318,7 +318,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
.dentry = u->dentry, .dentry = u->dentry,
.mnt = u->mnt .mnt = u->mnt
}; };
audit_log_d_path(ab, "path=", &path); audit_log_d_path(ab, " path=", &path);
break; break;
} }
if (!u->addr) if (!u->addr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment