aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/auditsc.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r--kernel/auditsc.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 1c06ecf38d7b..2087d6de67ea 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -208,8 +208,7 @@ struct audit_context {
208 int name_count; 208 int name_count;
209 struct audit_names names[AUDIT_NAMES]; 209 struct audit_names names[AUDIT_NAMES];
210 char * filterkey; /* key for rule that triggered record */ 210 char * filterkey; /* key for rule that triggered record */
211 struct dentry * pwd; 211 struct path pwd;
212 struct vfsmount * pwdmnt;
213 struct audit_context *previous; /* For nested syscalls */ 212 struct audit_context *previous; /* For nested syscalls */
214 struct audit_aux_data *aux; 213 struct audit_aux_data *aux;
215 struct audit_aux_data *aux_pids; 214 struct audit_aux_data *aux_pids;
@@ -786,12 +785,9 @@ static inline void audit_free_names(struct audit_context *context)
786 __putname(context->names[i].name); 785 __putname(context->names[i].name);
787 } 786 }
788 context->name_count = 0; 787 context->name_count = 0;
789 if (context->pwd) 788 path_put(&context->pwd);
790 dput(context->pwd); 789 context->pwd.dentry = NULL;
791 if (context->pwdmnt) 790 context->pwd.mnt = NULL;
792 mntput(context->pwdmnt);
793 context->pwd = NULL;
794 context->pwdmnt = NULL;
795} 791}
796 792
797static inline void audit_free_aux(struct audit_context *context) 793static inline void audit_free_aux(struct audit_context *context)
@@ -930,8 +926,7 @@ static void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk
930 if ((vma->vm_flags & VM_EXECUTABLE) && 926 if ((vma->vm_flags & VM_EXECUTABLE) &&
931 vma->vm_file) { 927 vma->vm_file) {
932 audit_log_d_path(ab, "exe=", 928 audit_log_d_path(ab, "exe=",
933 vma->vm_file->f_path.dentry, 929 &vma->vm_file->f_path);
934 vma->vm_file->f_path.mnt);
935 break; 930 break;
936 } 931 }
937 vma = vma->vm_next; 932 vma = vma->vm_next;
@@ -1005,9 +1000,10 @@ static int audit_log_single_execve_arg(struct audit_context *context,
1005 * for strings that are too long, we should not have created 1000 * for strings that are too long, we should not have created
1006 * any. 1001 * any.
1007 */ 1002 */
1008 if (unlikely((len = -1) || len > MAX_ARG_STRLEN - 1)) { 1003 if (unlikely((len == -1) || len > MAX_ARG_STRLEN - 1)) {
1009 WARN_ON(1); 1004 WARN_ON(1);
1010 send_sig(SIGKILL, current, 0); 1005 send_sig(SIGKILL, current, 0);
1006 return -1;
1011 } 1007 }
1012 1008
1013 /* walk the whole argument looking for non-ascii chars */ 1009 /* walk the whole argument looking for non-ascii chars */
@@ -1025,6 +1021,7 @@ static int audit_log_single_execve_arg(struct audit_context *context,
1025 if (ret) { 1021 if (ret) {
1026 WARN_ON(1); 1022 WARN_ON(1);
1027 send_sig(SIGKILL, current, 0); 1023 send_sig(SIGKILL, current, 0);
1024 return -1;
1028 } 1025 }
1029 buf[to_send] = '\0'; 1026 buf[to_send] = '\0';
1030 has_cntl = audit_string_contains_control(buf, to_send); 1027 has_cntl = audit_string_contains_control(buf, to_send);
@@ -1088,6 +1085,7 @@ static int audit_log_single_execve_arg(struct audit_context *context,
1088 if (ret) { 1085 if (ret) {
1089 WARN_ON(1); 1086 WARN_ON(1);
1090 send_sig(SIGKILL, current, 0); 1087 send_sig(SIGKILL, current, 0);
1088 return -1;
1091 } 1089 }
1092 buf[to_send] = '\0'; 1090 buf[to_send] = '\0';
1093 1091
@@ -1341,10 +1339,10 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
1341 context->target_sid, context->target_comm)) 1339 context->target_sid, context->target_comm))
1342 call_panic = 1; 1340 call_panic = 1;
1343 1341
1344 if (context->pwd && context->pwdmnt) { 1342 if (context->pwd.dentry && context->pwd.mnt) {
1345 ab = audit_log_start(context, GFP_KERNEL, AUDIT_CWD); 1343 ab = audit_log_start(context, GFP_KERNEL, AUDIT_CWD);
1346 if (ab) { 1344 if (ab) {
1347 audit_log_d_path(ab, "cwd=", context->pwd, context->pwdmnt); 1345 audit_log_d_path(ab, "cwd=", &context->pwd);
1348 audit_log_end(ab); 1346 audit_log_end(ab);
1349 } 1347 }
1350 } 1348 }
@@ -1367,8 +1365,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
1367 case 0: 1365 case 0:
1368 /* name was specified as a relative path and the 1366 /* name was specified as a relative path and the
1369 * directory component is the cwd */ 1367 * directory component is the cwd */
1370 audit_log_d_path(ab, " name=", context->pwd, 1368 audit_log_d_path(ab, " name=", &context->pwd);
1371 context->pwdmnt);
1372 break; 1369 break;
1373 default: 1370 default:
1374 /* log the name's directory component */ 1371 /* log the name's directory component */
@@ -1695,10 +1692,10 @@ void __audit_getname(const char *name)
1695 context->names[context->name_count].ino = (unsigned long)-1; 1692 context->names[context->name_count].ino = (unsigned long)-1;
1696 context->names[context->name_count].osid = 0; 1693 context->names[context->name_count].osid = 0;
1697 ++context->name_count; 1694 ++context->name_count;
1698 if (!context->pwd) { 1695 if (!context->pwd.dentry) {
1699 read_lock(&current->fs->lock); 1696 read_lock(&current->fs->lock);
1700 context->pwd = dget(current->fs->pwd); 1697 context->pwd = current->fs->pwd;
1701 context->pwdmnt = mntget(current->fs->pwdmnt); 1698 path_get(&current->fs->pwd);
1702 read_unlock(&current->fs->lock); 1699 read_unlock(&current->fs->lock);
1703 } 1700 }
1704 1701