summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/files/auditsc-CVE-2014-3917.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/files/auditsc-CVE-2014-3917.patch')
-rw-r--r--recipes-kernel/linux/files/auditsc-CVE-2014-3917.patch91
1 files changed, 91 insertions, 0 deletions
diff --git a/recipes-kernel/linux/files/auditsc-CVE-2014-3917.patch b/recipes-kernel/linux/files/auditsc-CVE-2014-3917.patch
new file mode 100644
index 0000000..a0bdc27
--- /dev/null
+++ b/recipes-kernel/linux/files/auditsc-CVE-2014-3917.patch
@@ -0,0 +1,91 @@
1From 6004b0e5ac2e8e9e1bb0f012dc9242e03cca95df Mon Sep 17 00:00:00 2001
2From: Andy Lutomirski <luto@amacapital.net>
3Date: Wed, 28 May 2014 23:09:58 -0400
4Subject: [PATCH] auditsc: audit_krule mask accesses need bounds checking
5
6commit a3c54931199565930d6d84f4c3456f6440aefd41 upstream.
7
8Fixes an easy DoS and possible information disclosure.
9
10This does nothing about the broken state of x32 auditing.
11
12eparis: If the admin has enabled auditd and has specifically loaded
13audit rules. This bug has been around since before git. Wow...
14
15This fixes CVE-2014-3917
16Upstream-Status: Backport
17
18Signed-off-by: Andy Lutomirski <luto@amacapital.net>
19Signed-off-by: Eric Paris <eparis@redhat.com>
20Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
21Signed-off-by: Jiri Slaby <jslaby@suse.cz>
22Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com>
23---
24 kernel/auditsc.c | 27 ++++++++++++++++++---------
25 1 file changed, 18 insertions(+), 9 deletions(-)
26
27diff --git a/kernel/auditsc.c b/kernel/auditsc.c
28index 3b79a47..979c00b 100644
29--- a/kernel/auditsc.c
30+++ b/kernel/auditsc.c
31@@ -733,6 +733,22 @@ static enum audit_state audit_filter_task(struct task_struct *tsk, char **key)
32 return AUDIT_BUILD_CONTEXT;
33 }
34
35+static int audit_in_mask(const struct audit_krule *rule, unsigned long val)
36+{
37+ int word, bit;
38+
39+ if (val > 0xffffffff)
40+ return false;
41+
42+ word = AUDIT_WORD(val);
43+ if (word >= AUDIT_BITMASK_SIZE)
44+ return false;
45+
46+ bit = AUDIT_BIT(val);
47+
48+ return rule->mask[word] & bit;
49+}
50+
51 /* At syscall entry and exit time, this filter is called if the
52 * audit_state is not low enough that auditing cannot take place, but is
53 * also not high enough that we already know we have to write an audit
54@@ -750,11 +766,8 @@ static enum audit_state audit_filter_syscall(struct task_struct *tsk,
55
56 rcu_read_lock();
57 if (!list_empty(list)) {
58- int word = AUDIT_WORD(ctx->major);
59- int bit = AUDIT_BIT(ctx->major);
60-
61 list_for_each_entry_rcu(e, list, list) {
62- if ((e->rule.mask[word] & bit) == bit &&
63+ if (audit_in_mask(&e->rule, ctx->major) &&
64 audit_filter_rules(tsk, &e->rule, ctx, NULL,
65 &state, false)) {
66 rcu_read_unlock();
67@@ -774,20 +787,16 @@ static enum audit_state audit_filter_syscall(struct task_struct *tsk,
68 static int audit_filter_inode_name(struct task_struct *tsk,
69 struct audit_names *n,
70 struct audit_context *ctx) {
71- int word, bit;
72 int h = audit_hash_ino((u32)n->ino);
73 struct list_head *list = &audit_inode_hash[h];
74 struct audit_entry *e;
75 enum audit_state state;
76
77- word = AUDIT_WORD(ctx->major);
78- bit = AUDIT_BIT(ctx->major);
79-
80 if (list_empty(list))
81 return 0;
82
83 list_for_each_entry_rcu(e, list, list) {
84- if ((e->rule.mask[word] & bit) == bit &&
85+ if (audit_in_mask(&e->rule, ctx->major) &&
86 audit_filter_rules(tsk, &e->rule, ctx, n, &state, false)) {
87 ctx->current_state = state;
88 return 1;
89--
901.9.1
91