1 |
commit: 4b5ce4d1c2e83a77090bd0654ef4524a4539b961 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jul 31 14:53:32 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jul 31 14:53:32 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=4b5ce4d1 |
7 |
|
8 |
mm/vmalloc: Sync unmappings in __purge_vmap_area_lazy() |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 +++ |
13 |
1800_vmalloc-sync-unmappings-fix.patch | 58 ++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 62 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 983b9f0..01e534c 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -71,6 +71,10 @@ Patch: 1510_fs-enable-link-security-restrictions-by-default.patch |
21 |
From: http://sources.debian.net/src/linux/3.16.7-ckt4-3/debian/patches/debian/fs-enable-link-security-restrictions-by-default.patch/ |
22 |
Desc: Enable link security restrictions by default. |
23 |
|
24 |
+Patch: 1800_vmalloc-sync-unmappings-fix.patch |
25 |
+From: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/?id=3f8fd02b1bf1d7ba964485a56f2f4b53ae88c167 |
26 |
+Desc: mm/vmalloc: Sync unmappings in __purge_vmap_area_lazy() |
27 |
+ |
28 |
Patch: 2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch |
29 |
From: https://lore.kernel.org/linux-bluetooth/20190522070540.48895-1-marcel@××××××××.org/raw |
30 |
Desc: Bluetooth: Check key sizes only when Secure Simple Pairing is enabled. See bug #686758 |
31 |
|
32 |
diff --git a/1800_vmalloc-sync-unmappings-fix.patch b/1800_vmalloc-sync-unmappings-fix.patch |
33 |
new file mode 100644 |
34 |
index 0000000..7e56e51 |
35 |
--- /dev/null |
36 |
+++ b/1800_vmalloc-sync-unmappings-fix.patch |
37 |
@@ -0,0 +1,58 @@ |
38 |
+From 3f8fd02b1bf1d7ba964485a56f2f4b53ae88c167 Mon Sep 17 00:00:00 2001 |
39 |
+From: Joerg Roedel <jroedel@××××.de> |
40 |
+Date: Fri, 19 Jul 2019 20:46:52 +0200 |
41 |
+Subject: mm/vmalloc: Sync unmappings in __purge_vmap_area_lazy() |
42 |
+ |
43 |
+On x86-32 with PTI enabled, parts of the kernel page-tables are not shared |
44 |
+between processes. This can cause mappings in the vmalloc/ioremap area to |
45 |
+persist in some page-tables after the region is unmapped and released. |
46 |
+ |
47 |
+When the region is re-used the processes with the old mappings do not fault |
48 |
+in the new mappings but still access the old ones. |
49 |
+ |
50 |
+This causes undefined behavior, in reality often data corruption, kernel |
51 |
+oopses and panics and even spontaneous reboots. |
52 |
+ |
53 |
+Fix this problem by activly syncing unmaps in the vmalloc/ioremap area to |
54 |
+all page-tables in the system before the regions can be re-used. |
55 |
+ |
56 |
+References: https://bugzilla.suse.com/show_bug.cgi?id=1118689 |
57 |
+Fixes: 5d72b4fba40ef ('x86, mm: support huge I/O mapping capability I/F') |
58 |
+Signed-off-by: Joerg Roedel <jroedel@××××.de> |
59 |
+Signed-off-by: Thomas Gleixner <tglx@××××××××××.de> |
60 |
+Reviewed-by: Dave Hansen <dave.hansen@×××××××××××.com> |
61 |
+Link: https://lkml.kernel.org/r/20190719184652.11391-4-joro@××××××.org |
62 |
+--- |
63 |
+ mm/vmalloc.c | 9 +++++++++ |
64 |
+ 1 file changed, 9 insertions(+) |
65 |
+ |
66 |
+diff --git a/mm/vmalloc.c b/mm/vmalloc.c |
67 |
+index 4fa8d84599b0..e0fc963acc41 100644 |
68 |
+--- a/mm/vmalloc.c |
69 |
++++ b/mm/vmalloc.c |
70 |
+@@ -1258,6 +1258,12 @@ static bool __purge_vmap_area_lazy(unsigned long start, unsigned long end) |
71 |
+ if (unlikely(valist == NULL)) |
72 |
+ return false; |
73 |
+ |
74 |
++ /* |
75 |
++ * First make sure the mappings are removed from all page-tables |
76 |
++ * before they are freed. |
77 |
++ */ |
78 |
++ vmalloc_sync_all(); |
79 |
++ |
80 |
+ /* |
81 |
+ * TODO: to calculate a flush range without looping. |
82 |
+ * The list can be up to lazy_max_pages() elements. |
83 |
+@@ -3038,6 +3044,9 @@ EXPORT_SYMBOL(remap_vmalloc_range); |
84 |
+ /* |
85 |
+ * Implement a stub for vmalloc_sync_all() if the architecture chose not to |
86 |
+ * have one. |
87 |
++ * |
88 |
++ * The purpose of this function is to make sure the vmalloc area |
89 |
++ * mappings are identical in all page-tables in the system. |
90 |
+ */ |
91 |
+ void __weak vmalloc_sync_all(void) |
92 |
+ { |
93 |
+-- |
94 |
+cgit 1.2-0.3.lf.el7 |
95 |
+ |