Home Home > GIT Browse > SLE12-SP4
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2019-05-16 12:04:39 +0200
committerJan Kara <jack@suse.cz>2019-05-20 14:48:49 +0200
commit545b409ab9e3943a18e3789628e22b96c5f66e80 (patch)
tree1e32ebbfe1a63aa9035e63a231e7c031aff984c5
parente060719be45f530e0fb06cb4e6b522e63b42e4ff (diff)
mm/huge_memory: fix vmf_insert_pfn_{pmd, pud}() crash, handle
unaligned addresses (bsc#1135330).
-rw-r--r--patches.fixes/mm-huge_memory-fix-vmf_insert_pfn_-pmd-pud-crash-han.patch79
-rw-r--r--series.conf1
2 files changed, 80 insertions, 0 deletions
diff --git a/patches.fixes/mm-huge_memory-fix-vmf_insert_pfn_-pmd-pud-crash-han.patch b/patches.fixes/mm-huge_memory-fix-vmf_insert_pfn_-pmd-pud-crash-han.patch
new file mode 100644
index 0000000000..4529e50b35
--- /dev/null
+++ b/patches.fixes/mm-huge_memory-fix-vmf_insert_pfn_-pmd-pud-crash-han.patch
@@ -0,0 +1,79 @@
+From fce86ff5802bac3a7b19db171aa1949ef9caac31 Mon Sep 17 00:00:00 2001
+From: Dan Williams <dan.j.williams@intel.com>
+Date: Mon, 13 May 2019 17:15:33 -0700
+Subject: [PATCH] mm/huge_memory: fix vmf_insert_pfn_{pmd, pud}() crash, handle
+ unaligned addresses
+Git-commit: fce86ff5802bac3a7b19db171aa1949ef9caac31
+Patch-mainline: v5.2-rc1
+References: bsc#1135330
+
+Starting with c6f3c5ee40c1 ("mm/huge_memory.c: fix modifying of page
+protection by insert_pfn_pmd()") vmf_insert_pfn_pmd() internally calls
+pmdp_set_access_flags(). That helper enforces a pmd aligned @address
+argument via VM_BUG_ON() assertion.
+
+Update the implementation to take a 'struct vm_fault' argument directly
+and apply the address alignment fixup internally to fix crash signatures
+Like:
+
+ kernel BUG at arch/x86/mm/pgtable.c:515!
+ invalid opcode: 0000 [#1] SMP NOPTI
+ CPU: 51 PID: 43713 Comm: java Tainted: G OE 4.19.35 #1
+ [..]
+ RIP: 0010:pmdp_set_access_flags+0x48/0x50
+ [..]
+ Call Trace:
+ vmf_insert_pfn_pmd+0x198/0x350
+ dax_iomap_fault+0xe82/0x1190
+ ext4_dax_huge_fault+0x103/0x1f0
+ ? __switch_to_asm+0x40/0x70
+ __handle_mm_fault+0x3f6/0x1370
+ ? __switch_to_asm+0x34/0x70
+ ? __switch_to_asm+0x40/0x70
+ handle_mm_fault+0xda/0x200
+ __do_page_fault+0x249/0x4f0
+ do_page_fault+0x32/0x110
+ ? page_fault+0x8/0x30
+ page_fault+0x1e/0x30
+
+Link: http://lkml.kernel.org/r/155741946350.372037.11148198430068238140.stgit@dwillia2-desk3.amr.corp.intel.com
+Fixes: c6f3c5ee40c1 ("mm/huge_memory.c: fix modifying of page protection by insert_pfn_pmd()")
+Signed-off-by: Dan Williams <dan.j.williams@intel.com>
+Reported-by: Piotr Balcer <piotr.balcer@intel.com>
+Tested-by: Yan Ma <yan.ma@intel.com>
+Tested-by: Pankaj Gupta <pagupta@redhat.com>
+Reviewed-by: Matthew Wilcox <willy@infradead.org>
+Reviewed-by: Jan Kara <jack@suse.cz>
+Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
+Cc: Chandan Rajendra <chandan@linux.ibm.com>
+Cc: Souptick Joarder <jrdr.linux@gmail.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Acked-by: Jan Kara <jack@suse.cz>
+[JK: Removed changes in vmf_insert_pfn_pmd/pud() prototypes to maintain kABI]
+
+---
+ mm/huge_memory.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/mm/huge_memory.c
++++ b/mm/huge_memory.c
+@@ -780,6 +780,8 @@ int vmf_insert_pfn_pmd(struct vm_area_st
+ {
+ pgprot_t pgprot = vma->vm_page_prot;
+ pgtable_t pgtable = NULL;
++
++ addr &= PMD_MASK;
+ /*
+ * If we had pmd_special, we could avoid all these restrictions,
+ * but we need to be consistent with PTEs and architectures that
+@@ -855,6 +857,8 @@ int vmf_insert_pfn_pud(struct vm_area_st
+ pud_t *pud, pfn_t pfn, bool write)
+ {
+ pgprot_t pgprot = vma->vm_page_prot;
++
++ addr &= PUD_MASK;
+ /*
+ * If we had pud_special, we could avoid all these restrictions,
+ * but we need to be consistent with PTEs and architectures that
diff --git a/series.conf b/series.conf
index 1342d6f1bc..d4a2dbf0b5 100644
--- a/series.conf
+++ b/series.conf
@@ -21946,6 +21946,7 @@
patches.arch/x86-speculation-mds-add-smt-warning-message.patch
patches.arch/x86-speculation-mds-print-smt-vulnerable-on-msbds-with-mitigations-off.patch
patches.arch/x86-speculation-mds-add-mitigations-support-for-mds.patch
+ patches.fixes/mm-huge_memory-fix-vmf_insert_pfn_-pmd-pud-crash-han.patch
patches.drivers/PCI-Mark-AMD-Stoney-Radeon-R7-GPU-ATS-as-broken.patch
patches.drivers/PCI-Mark-Atheros-AR9462-to-avoid-bus-reset.patch
patches.drivers/backlight-lm3630a-Return-0-on-success-in-update_stat.patch