summaryrefslogtreecommitdiffstats
path: root/patches/cve/CVE-2019-9213-mm-enforce-min-addr-even-if-capable-in-expand_downwa.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/cve/CVE-2019-9213-mm-enforce-min-addr-even-if-capable-in-expand_downwa.patch')
-rw-r--r--patches/cve/CVE-2019-9213-mm-enforce-min-addr-even-if-capable-in-expand_downwa.patch50
1 files changed, 50 insertions, 0 deletions
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