aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2012-01-06 17:07:10 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-17 16:17:04 -0500
commitc158a35c8a681cf68d36f22f058f9f5466386c71 (patch)
tree54a7fe4d21a30848539b2bf94c885f0a0b123717
parent41fdc3054e23e3229edea27053522fe052d02ec2 (diff)
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 <keescook@chromium.org> Signed-off-by: Eric Paris <eparis@redhat.com>
-rw-r--r--kernel/audit.c2
-rw-r--r--kernel/auditsc.c6
-rw-r--r--security/lsm_audit.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index 00efe4758c86..705c25a70bff 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1423,7 +1423,7 @@ void audit_log_d_path(struct audit_buffer *ab, const char *prefix,
1423 char *p, *pathname; 1423 char *p, *pathname;
1424 1424
1425 if (prefix) 1425 if (prefix)
1426 audit_log_format(ab, " %s", prefix); 1426 audit_log_format(ab, "%s", prefix);
1427 1427
1428 /* We will allow 11 spaces for ' (deleted)' to be appended */ 1428 /* We will allow 11 spaces for ' (deleted)' to be appended */
1429 pathname = kmalloc(PATH_MAX+11, ab->gfp_mask); 1429 pathname = kmalloc(PATH_MAX+11, ab->gfp_mask);
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 86584ecb1039..caaea6e944f8 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1171,7 +1171,7 @@ static void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk
1171 while (vma) { 1171 while (vma) {
1172 if ((vma->vm_flags & VM_EXECUTABLE) && 1172 if ((vma->vm_flags & VM_EXECUTABLE) &&
1173 vma->vm_file) { 1173 vma->vm_file) {
1174 audit_log_d_path(ab, "exe=", 1174 audit_log_d_path(ab, " exe=",
1175 &vma->vm_file->f_path); 1175 &vma->vm_file->f_path);
1176 break; 1176 break;
1177 } 1177 }
@@ -1540,7 +1540,7 @@ static void audit_log_name(struct audit_context *context, struct audit_names *n,
1540 case 0: 1540 case 0:
1541 /* name was specified as a relative path and the 1541 /* name was specified as a relative path and the
1542 * directory component is the cwd */ 1542 * directory component is the cwd */
1543 audit_log_d_path(ab, "name=", &context->pwd); 1543 audit_log_d_path(ab, " name=", &context->pwd);
1544 break; 1544 break;
1545 default: 1545 default:
1546 /* log the name's directory component */ 1546 /* log the name's directory component */
@@ -1725,7 +1725,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
1725 if (context->pwd.dentry && context->pwd.mnt) { 1725 if (context->pwd.dentry && context->pwd.mnt) {
1726 ab = audit_log_start(context, GFP_KERNEL, AUDIT_CWD); 1726 ab = audit_log_start(context, GFP_KERNEL, AUDIT_CWD);
1727 if (ab) { 1727 if (ab) {
1728 audit_log_d_path(ab, "cwd=", &context->pwd); 1728 audit_log_d_path(ab, " cwd=", &context->pwd);
1729 audit_log_end(ab); 1729 audit_log_end(ab);
1730 } 1730 }
1731 } 1731 }
diff --git a/security/lsm_audit.c b/security/lsm_audit.c
index fc41b7cccb53..293b8c45b1d1 100644
--- a/security/lsm_audit.c
+++ b/security/lsm_audit.c
@@ -232,7 +232,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
232 case LSM_AUDIT_DATA_PATH: { 232 case LSM_AUDIT_DATA_PATH: {
233 struct inode *inode; 233 struct inode *inode;
234 234
235 audit_log_d_path(ab, "path=", &a->u.path); 235 audit_log_d_path(ab, " path=", &a->u.path);
236 236
237 inode = a->u.path.dentry->d_inode; 237 inode = a->u.path.dentry->d_inode;
238 if (inode) { 238 if (inode) {
@@ -318,7 +318,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
318 .dentry = u->dentry, 318 .dentry = u->dentry,
319 .mnt = u->mnt 319 .mnt = u->mnt
320 }; 320 };
321 audit_log_d_path(ab, "path=", &path); 321 audit_log_d_path(ab, " path=", &path);
322 break; 322 break;
323 } 323 }
324 if (!u->addr) 324 if (!u->addr)