diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/audit.c | 23 | ||||
-rw-r--r-- | kernel/audit.h | 3 | ||||
-rw-r--r-- | kernel/auditsc.c | 9 |
3 files changed, 19 insertions, 16 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index d219bb03a364..684b51d612a3 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -1848,11 +1848,24 @@ error_path: | |||
1848 | } | 1848 | } |
1849 | EXPORT_SYMBOL(audit_log_task_context); | 1849 | EXPORT_SYMBOL(audit_log_task_context); |
1850 | 1850 | ||
1851 | void audit_log_d_path_exe(struct audit_buffer *ab, | ||
1852 | struct mm_struct *mm) | ||
1853 | { | ||
1854 | if (!mm) { | ||
1855 | audit_log_format(ab, " exe=(null)"); | ||
1856 | return; | ||
1857 | } | ||
1858 | |||
1859 | down_read(&mm->mmap_sem); | ||
1860 | if (mm->exe_file) | ||
1861 | audit_log_d_path(ab, " exe=", &mm->exe_file->f_path); | ||
1862 | up_read(&mm->mmap_sem); | ||
1863 | } | ||
1864 | |||
1851 | void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk) | 1865 | void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk) |
1852 | { | 1866 | { |
1853 | const struct cred *cred; | 1867 | const struct cred *cred; |
1854 | char comm[sizeof(tsk->comm)]; | 1868 | char comm[sizeof(tsk->comm)]; |
1855 | struct mm_struct *mm = tsk->mm; | ||
1856 | char *tty; | 1869 | char *tty; |
1857 | 1870 | ||
1858 | if (!ab) | 1871 | if (!ab) |
@@ -1888,13 +1901,7 @@ void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk) | |||
1888 | audit_log_format(ab, " comm="); | 1901 | audit_log_format(ab, " comm="); |
1889 | audit_log_untrustedstring(ab, get_task_comm(comm, tsk)); | 1902 | audit_log_untrustedstring(ab, get_task_comm(comm, tsk)); |
1890 | 1903 | ||
1891 | if (mm) { | 1904 | audit_log_d_path_exe(ab, tsk->mm); |
1892 | down_read(&mm->mmap_sem); | ||
1893 | if (mm->exe_file) | ||
1894 | audit_log_d_path(ab, " exe=", &mm->exe_file->f_path); | ||
1895 | up_read(&mm->mmap_sem); | ||
1896 | } else | ||
1897 | audit_log_format(ab, " exe=(null)"); | ||
1898 | audit_log_task_context(ab); | 1905 | audit_log_task_context(ab); |
1899 | } | 1906 | } |
1900 | EXPORT_SYMBOL(audit_log_task_info); | 1907 | EXPORT_SYMBOL(audit_log_task_info); |
diff --git a/kernel/audit.h b/kernel/audit.h index 3cdffad5a1d9..28067c50fd04 100644 --- a/kernel/audit.h +++ b/kernel/audit.h | |||
@@ -270,6 +270,9 @@ extern struct list_head audit_filter_list[]; | |||
270 | 270 | ||
271 | extern struct audit_entry *audit_dupe_rule(struct audit_krule *old); | 271 | extern struct audit_entry *audit_dupe_rule(struct audit_krule *old); |
272 | 272 | ||
273 | extern void audit_log_d_path_exe(struct audit_buffer *ab, | ||
274 | struct mm_struct *mm); | ||
275 | |||
273 | /* audit watch functions */ | 276 | /* audit watch functions */ |
274 | #ifdef CONFIG_AUDIT_WATCH | 277 | #ifdef CONFIG_AUDIT_WATCH |
275 | extern void audit_put_watch(struct audit_watch *watch); | 278 | extern void audit_put_watch(struct audit_watch *watch); |
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 793e9e98f7f8..4b89f7f95d84 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -2460,7 +2460,6 @@ static void audit_log_task(struct audit_buffer *ab) | |||
2460 | kuid_t auid, uid; | 2460 | kuid_t auid, uid; |
2461 | kgid_t gid; | 2461 | kgid_t gid; |
2462 | unsigned int sessionid; | 2462 | unsigned int sessionid; |
2463 | struct mm_struct *mm = current->mm; | ||
2464 | char comm[sizeof(current->comm)]; | 2463 | char comm[sizeof(current->comm)]; |
2465 | 2464 | ||
2466 | auid = audit_get_loginuid(current); | 2465 | auid = audit_get_loginuid(current); |
@@ -2475,13 +2474,7 @@ static void audit_log_task(struct audit_buffer *ab) | |||
2475 | audit_log_task_context(ab); | 2474 | audit_log_task_context(ab); |
2476 | audit_log_format(ab, " pid=%d comm=", task_pid_nr(current)); | 2475 | audit_log_format(ab, " pid=%d comm=", task_pid_nr(current)); |
2477 | audit_log_untrustedstring(ab, get_task_comm(comm, current)); | 2476 | audit_log_untrustedstring(ab, get_task_comm(comm, current)); |
2478 | if (mm) { | 2477 | audit_log_d_path_exe(ab, current->mm); |
2479 | down_read(&mm->mmap_sem); | ||
2480 | if (mm->exe_file) | ||
2481 | audit_log_d_path(ab, " exe=", &mm->exe_file->f_path); | ||
2482 | up_read(&mm->mmap_sem); | ||
2483 | } else | ||
2484 | audit_log_format(ab, " exe=(null)"); | ||
2485 | } | 2478 | } |
2486 | 2479 | ||
2487 | /** | 2480 | /** |