diff options
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r-- | kernel/auditsc.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 3828ad5fb8f1..f49a0318c2ed 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -65,7 +65,6 @@ | |||
65 | #include <linux/binfmts.h> | 65 | #include <linux/binfmts.h> |
66 | #include <linux/highmem.h> | 66 | #include <linux/highmem.h> |
67 | #include <linux/syscalls.h> | 67 | #include <linux/syscalls.h> |
68 | #include <linux/inotify.h> | ||
69 | #include <linux/capability.h> | 68 | #include <linux/capability.h> |
70 | #include <linux/fs_struct.h> | 69 | #include <linux/fs_struct.h> |
71 | 70 | ||
@@ -242,6 +241,10 @@ struct audit_context { | |||
242 | pid_t pid; | 241 | pid_t pid; |
243 | struct audit_cap_data cap; | 242 | struct audit_cap_data cap; |
244 | } capset; | 243 | } capset; |
244 | struct { | ||
245 | int fd; | ||
246 | int flags; | ||
247 | } mmap; | ||
245 | }; | 248 | }; |
246 | int fds[2]; | 249 | int fds[2]; |
247 | 250 | ||
@@ -549,9 +552,8 @@ static int audit_filter_rules(struct task_struct *tsk, | |||
549 | } | 552 | } |
550 | break; | 553 | break; |
551 | case AUDIT_WATCH: | 554 | case AUDIT_WATCH: |
552 | if (name && audit_watch_inode(rule->watch) != (unsigned long)-1) | 555 | if (name) |
553 | result = (name->dev == audit_watch_dev(rule->watch) && | 556 | result = audit_watch_compare(rule->watch, name->ino, name->dev); |
554 | name->ino == audit_watch_inode(rule->watch)); | ||
555 | break; | 557 | break; |
556 | case AUDIT_DIR: | 558 | case AUDIT_DIR: |
557 | if (ctx) | 559 | if (ctx) |
@@ -1307,6 +1309,10 @@ static void show_special(struct audit_context *context, int *call_panic) | |||
1307 | audit_log_cap(ab, "cap_pp", &context->capset.cap.permitted); | 1309 | audit_log_cap(ab, "cap_pp", &context->capset.cap.permitted); |
1308 | audit_log_cap(ab, "cap_pe", &context->capset.cap.effective); | 1310 | audit_log_cap(ab, "cap_pe", &context->capset.cap.effective); |
1309 | break; } | 1311 | break; } |
1312 | case AUDIT_MMAP: { | ||
1313 | audit_log_format(ab, "fd=%d flags=0x%x", context->mmap.fd, | ||
1314 | context->mmap.flags); | ||
1315 | break; } | ||
1310 | } | 1316 | } |
1311 | audit_log_end(ab); | 1317 | audit_log_end(ab); |
1312 | } | 1318 | } |
@@ -1726,7 +1732,7 @@ static inline void handle_one(const struct inode *inode) | |||
1726 | struct audit_tree_refs *p; | 1732 | struct audit_tree_refs *p; |
1727 | struct audit_chunk *chunk; | 1733 | struct audit_chunk *chunk; |
1728 | int count; | 1734 | int count; |
1729 | if (likely(list_empty(&inode->inotify_watches))) | 1735 | if (likely(hlist_empty(&inode->i_fsnotify_marks))) |
1730 | return; | 1736 | return; |
1731 | context = current->audit_context; | 1737 | context = current->audit_context; |
1732 | p = context->trees; | 1738 | p = context->trees; |
@@ -1769,7 +1775,7 @@ retry: | |||
1769 | seq = read_seqbegin(&rename_lock); | 1775 | seq = read_seqbegin(&rename_lock); |
1770 | for(;;) { | 1776 | for(;;) { |
1771 | struct inode *inode = d->d_inode; | 1777 | struct inode *inode = d->d_inode; |
1772 | if (inode && unlikely(!list_empty(&inode->inotify_watches))) { | 1778 | if (inode && unlikely(!hlist_empty(&inode->i_fsnotify_marks))) { |
1773 | struct audit_chunk *chunk; | 1779 | struct audit_chunk *chunk; |
1774 | chunk = audit_tree_lookup(inode); | 1780 | chunk = audit_tree_lookup(inode); |
1775 | if (chunk) { | 1781 | if (chunk) { |
@@ -1837,13 +1843,8 @@ void __audit_getname(const char *name) | |||
1837 | context->names[context->name_count].ino = (unsigned long)-1; | 1843 | context->names[context->name_count].ino = (unsigned long)-1; |
1838 | context->names[context->name_count].osid = 0; | 1844 | context->names[context->name_count].osid = 0; |
1839 | ++context->name_count; | 1845 | ++context->name_count; |
1840 | if (!context->pwd.dentry) { | 1846 | if (!context->pwd.dentry) |
1841 | read_lock(¤t->fs->lock); | 1847 | get_fs_pwd(current->fs, &context->pwd); |
1842 | context->pwd = current->fs->pwd; | ||
1843 | path_get(¤t->fs->pwd); | ||
1844 | read_unlock(¤t->fs->lock); | ||
1845 | } | ||
1846 | |||
1847 | } | 1848 | } |
1848 | 1849 | ||
1849 | /* audit_putname - intercept a putname request | 1850 | /* audit_putname - intercept a putname request |
@@ -2483,6 +2484,14 @@ void __audit_log_capset(pid_t pid, | |||
2483 | context->type = AUDIT_CAPSET; | 2484 | context->type = AUDIT_CAPSET; |
2484 | } | 2485 | } |
2485 | 2486 | ||
2487 | void __audit_mmap_fd(int fd, int flags) | ||
2488 | { | ||
2489 | struct audit_context *context = current->audit_context; | ||
2490 | context->mmap.fd = fd; | ||
2491 | context->mmap.flags = flags; | ||
2492 | context->type = AUDIT_MMAP; | ||
2493 | } | ||
2494 | |||
2486 | /** | 2495 | /** |
2487 | * audit_core_dumps - record information about processes that end abnormally | 2496 | * audit_core_dumps - record information about processes that end abnormally |
2488 | * @signr: signal value | 2497 | * @signr: signal value |