diff options
Diffstat (limited to 'patches/cve/CVE-2019-9213.patch')
-rw-r--r-- | patches/cve/CVE-2019-9213.patch | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/patches/cve/CVE-2019-9213.patch b/patches/cve/CVE-2019-9213.patch new file mode 100644 index 0000000..3b1d5d9 --- /dev/null +++ b/patches/cve/CVE-2019-9213.patch | |||
@@ -0,0 +1,46 @@ | |||
1 | From 0a1d52994d440e21def1c2174932410b4f2a98a1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jann Horn <jannh@google.com> | ||
3 | Date: Wed, 27 Feb 2019 21:29:52 +0100 | ||
4 | Subject: mm: enforce min addr even if capable() in expand_downwards() | ||
5 | |||
6 | security_mmap_addr() does a capability check with current_cred(), but | ||
7 | we can reach this code from contexts like a VFS write handler where | ||
8 | current_cred() must not be used. | ||
9 | |||
10 | This can be abused on systems without SMAP to make NULL pointer | ||
11 | dereferences exploitable again. | ||
12 | |||
13 | Fixes: 8869477a49c3 ("security: protect from stack expansion into low vm addresses") | ||
14 | Cc: stable@kernel.org | ||
15 | Signed-off-by: Jann Horn <jannh@google.com> | ||
16 | Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> | ||
17 | Signed-off-by: Adrian Stratulat <adrian.stratulat@enea.com> | ||
18 | Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0a1d52994d440e21def1c2174932410b4f2a98a1] | ||
19 | CVE: CVE-2019-9213 | ||
20 | --- | ||
21 | mm/mmap.c | 7 +++---- | ||
22 | 1 file changed, 3 insertions(+), 4 deletions(-) | ||
23 | |||
24 | diff --git a/mm/mmap.c b/mm/mmap.c | ||
25 | index f901065c4c64..fc1809b1bed6 100644 | ||
26 | --- a/mm/mmap.c | ||
27 | +++ b/mm/mmap.c | ||
28 | @@ -2426,12 +2426,11 @@ int expand_downwards(struct vm_area_struct *vma, | ||
29 | { | ||
30 | struct mm_struct *mm = vma->vm_mm; | ||
31 | struct vm_area_struct *prev; | ||
32 | - int error; | ||
33 | + int error = 0; | ||
34 | |||
35 | address &= PAGE_MASK; | ||
36 | - error = security_mmap_addr(address); | ||
37 | - if (error) | ||
38 | - return error; | ||
39 | + if (address < mmap_min_addr) | ||
40 | + return -EPERM; | ||
41 | |||
42 | /* Enforce stack_guard_gap */ | ||
43 | prev = vma->vm_prev; | ||
44 | -- | ||
45 | cgit 1.2-0.3.lf.el7 | ||
46 | |||