audit: no leading space in audit_log_d_path prefix
Subsystems (2)
PATCH 1/1 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 Kees Cook <[email protected]>
--- kernel/audit.c | 2 +- kernel/auditsc.c | 4 ++-- security/lsm_audit.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-)
kernel/audit.c +1 -1
@@ -1422,7 +1422,7 @@ void audit_log_d_path(struct audit_buffer *ab, const char *prefix,char *p, *pathname;if (prefix) -audit_log_format (ab," %s" , prefix); +audit_log_format (ab,"%s" , prefix);/* We will allow 11 spaces for ' (deleted)' to be appended */ pathname =kmalloc (PATH_MAX +11 , ab->gfp_mask);
kernel/auditsc.c +2 -2
@@ -975,7 +975,7 @@ static void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tskwhile (vma) {if ((vma->vm_flags &VM_EXECUTABLE ) && vma->vm_file) { -audit_log_d_path (ab,"exe=" , +audit_log_d_path (ab," exe=" , &vma->vm_file->f_path);break ; }
@@ -1489,7 +1489,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *tscase 0 :/* name was specified as a relative path and the * directory component is the cwd */ -audit_log_d_path (ab,"name=" , &context->pwd); +audit_log_d_path (ab," name=" , &context->pwd);break ;default :/* log the name's directory component */
security/lsm_audit.c +2 -2
@@ -231,7 +231,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,case LSM_AUDIT_DATA_PATH : {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;if (inode)
@@ -314,7 +314,7 @@ static void dump_common_audit_data(struct audit_buffer *ab, .dentry = u->dentry, .mnt = u->mnt }; -audit_log_d_path (ab,"path=" , &path); +audit_log_d_path (ab," path=" , &path);break ; }if (!u->addr)
Signature · 1 line
1.7.0.4
Quoted 5 lines · Kees Cook
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 Kees Cook <[email protected]>
Reviewed-by James Morris <[email protected]>