summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Wellving <andreas.wellving@enea.com>2019-07-10 09:35:03 +0200
committerAdrian Stratulat <adrian.stratulat@enea.com>2019-07-12 14:02:34 +0200
commit41f8ec53f2fcbb9cb476e355ed61d67cd77a03e4 (patch)
treec704ff93acc2be1f0b77961de34e26d980e562c7
parent61c4c50172bc2ef605d686c11508c3690bb4a36b (diff)
downloadenea-kernel-cache-41f8ec53f2fcbb9cb476e355ed61d67cd77a03e4.tar.gz
mm: CVE-2019-9213
mm: enforce min addr even if capable() in expand_downwards() References: https://nvd.nist.gov/vuln/detail/CVE-2019-9213 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.9.y&id=331fc4df776be3e5a88a1a9f08ef2f7e063ef1a9 Change-Id: I63e9ecc3091d8c0ff8bc9de49680fe4e7632eb81 Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
-rw-r--r--patches/cve/4.9.x.scc3
-rw-r--r--patches/cve/CVE-2019-9213-mm-enforce-min-addr-even-if-capable-in-expand_downwa.patch50
2 files changed, 53 insertions, 0 deletions
diff --git a/patches/cve/4.9.x.scc b/patches/cve/4.9.x.scc
index 2794efe..99eb8ce 100644
--- a/patches/cve/4.9.x.scc
+++ b/patches/cve/4.9.x.scc
@@ -31,3 +31,6 @@ patch CVE-2018-20169-USB-check-usb_get_extra_descriptor-for-proper-size.patch
31 31
32#CVEs fixed in 4.9.151: 32#CVEs fixed in 4.9.151:
33patch CVE-2018-16884-sunrpc-use-after-free-in-svc_process_common.patch 33patch CVE-2018-16884-sunrpc-use-after-free-in-svc_process_common.patch
34
35#CVEs fixed in 4.9.162:
36patch CVE-2019-9213-mm-enforce-min-addr-even-if-capable-in-expand_downwa.patch
diff --git a/patches/cve/CVE-2019-9213-mm-enforce-min-addr-even-if-capable-in-expand_downwa.patch b/patches/cve/CVE-2019-9213-mm-enforce-min-addr-even-if-capable-in-expand_downwa.patch
new file mode 100644
index 0000000..f709596
--- /dev/null
+++ b/patches/cve/CVE-2019-9213-mm-enforce-min-addr-even-if-capable-in-expand_downwa.patch
@@ -0,0 +1,50 @@
1From 331fc4df776be3e5a88a1a9f08ef2f7e063ef1a9 Mon Sep 17 00:00:00 2001
2From: Jann Horn <jannh@google.com>
3Date: Wed, 27 Feb 2019 21:29:52 +0100
4Subject: [PATCH] mm: enforce min addr even if capable() in expand_downwards()
5
6commit 0a1d52994d440e21def1c2174932410b4f2a98a1 upstream.
7
8security_mmap_addr() does a capability check with current_cred(), but
9we can reach this code from contexts like a VFS write handler where
10current_cred() must not be used.
11
12This can be abused on systems without SMAP to make NULL pointer
13dereferences exploitable again.
14
15CVE: CVE-2019-9213
16Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.9.y&id=331fc4df776be3e5a88a1a9f08ef2f7e063ef1a9]
17
18Fixes: 8869477a49c3 ("security: protect from stack expansion into low vm addresses")
19Cc: stable@kernel.org
20Signed-off-by: Jann Horn <jannh@google.com>
21Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
22Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
24---
25 mm/mmap.c | 7 +++----
26 1 file changed, 3 insertions(+), 4 deletions(-)
27
28diff --git a/mm/mmap.c b/mm/mmap.c
29index 283755645d17..3f2314ad6acd 100644
30--- a/mm/mmap.c
31+++ b/mm/mmap.c
32@@ -2345,12 +2345,11 @@ int expand_downwards(struct vm_area_struct *vma,
33 struct mm_struct *mm = vma->vm_mm;
34 struct vm_area_struct *prev;
35 unsigned long gap_addr;
36- int error;
37+ int error = 0;
38
39 address &= PAGE_MASK;
40- error = security_mmap_addr(address);
41- if (error)
42- return error;
43+ if (address < mmap_min_addr)
44+ return -EPERM;
45
46 /* Enforce stack_guard_gap */
47 gap_addr = address - stack_guard_gap;
48--
492.20.1
50