diff options
author | Andreas Wellving <andreas.wellving@enea.com> | 2019-05-22 12:50:23 +0200 |
---|---|---|
committer | Adrian Mangeac <Adrian.Mangeac@enea.com> | 2019-05-22 13:23:18 +0200 |
commit | 7109a2536c95d4c3a438b22e8d176859f76e6d25 (patch) | |
tree | 5ab3da30679c92ece981a3471b0ab3435d7178c5 | |
parent | 8253b77b46d1499b5639fd49bf25e8453f6c4e98 (diff) | |
download | enea-kernel-cache-7109a2536c95d4c3a438b22e8d176859f76e6d25.tar.gz |
mm: CVE-2019-9213
mm: enforce min addr even if capable() in expand_downwards()
Reference:
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.14.y&id=f5817069248630b3b7b17ebfcdee0b679c52be33
Change-Id: I13dc9fc12825a3c83dc695b7dc4bb7724048d562
Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
-rw-r--r-- | patches/cve/CVE-2019-9213-mm-enforce-min-addr-even-if-capable-in-expand_downwa.patch | 50 |
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..3552669 --- /dev/null +++ b/patches/cve/CVE-2019-9213-mm-enforce-min-addr-even-if-capable-in-expand_downwa.patch | |||
@@ -0,0 +1,50 @@ | |||
1 | From f5817069248630b3b7b17ebfcdee0b679c52be33 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: [PATCH] mm: enforce min addr even if capable() in expand_downwards() | ||
5 | |||
6 | commit 0a1d52994d440e21def1c2174932410b4f2a98a1 upstream. | ||
7 | |||
8 | security_mmap_addr() does a capability check with current_cred(), but | ||
9 | we can reach this code from contexts like a VFS write handler where | ||
10 | current_cred() must not be used. | ||
11 | |||
12 | This can be abused on systems without SMAP to make NULL pointer | ||
13 | dereferences exploitable again. | ||
14 | |||
15 | CVE: CVE-2019-9213 | ||
16 | Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.14.y&id=f5817069248630b3b7b17ebfcdee0b679c52be33] | ||
17 | |||
18 | Fixes: 8869477a49c3 ("security: protect from stack expansion into low vm addresses") | ||
19 | Cc: stable@kernel.org | ||
20 | Signed-off-by: Jann Horn <jannh@google.com> | ||
21 | Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> | ||
22 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | ||
23 | Signed-off-by: Andreas Wellving <andreas.wellving@enea.com> | ||
24 | --- | ||
25 | mm/mmap.c | 7 +++---- | ||
26 | 1 file changed, 3 insertions(+), 4 deletions(-) | ||
27 | |||
28 | diff --git a/mm/mmap.c b/mm/mmap.c | ||
29 | index 2398776195d2..00dab291e61d 100644 | ||
30 | --- a/mm/mmap.c | ||
31 | +++ b/mm/mmap.c | ||
32 | @@ -2348,12 +2348,11 @@ int expand_downwards(struct vm_area_struct *vma, | ||
33 | { | ||
34 | struct mm_struct *mm = vma->vm_mm; | ||
35 | struct vm_area_struct *prev; | ||
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 | prev = vma->vm_prev; | ||
48 | -- | ||
49 | 2.20.1 | ||
50 | |||