diff options
author | Fan Yang <Fan_Yang@sjtu.edu.cn> | 2020-06-04 18:22:07 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-06-11 09:22:20 +0200 |
commit | c915cffda0a4329ee454646138fe2b11c5ba3cd6 (patch) | |
tree | b788bfd327239355abd10ba3f1700734c2a94b29 /mm | |
parent | b1fa53f2bc3b99760ab94fe1455b41ec8bb06de9 (diff) | |
download | linux-stable-c915cffda0a4329ee454646138fe2b11c5ba3cd6.tar.gz linux-stable-c915cffda0a4329ee454646138fe2b11c5ba3cd6.tar.bz2 linux-stable-c915cffda0a4329ee454646138fe2b11c5ba3cd6.zip |
mm: Fix mremap not considering huge pmd devmap
commit 5bfea2d9b17f1034a68147a8b03b9789af5700f9 upstream.
The original code in mm/mremap.c checks huge pmd by:
if (is_swap_pmd(*old_pmd) || pmd_trans_huge(*old_pmd)) {
However, a DAX mapped nvdimm is mapped as huge page (by default) but it
is not transparent huge page (_PAGE_PSE | PAGE_DEVMAP). This commit
changes the condition to include the case.
This addresses CVE-2020-10757.
Fixes: 5c7fb56e5e3f ("mm, dax: dax-pmd vs thp-pmd vs hugetlbfs-pmd")
Cc: <stable@vger.kernel.org>
Reported-by: Fan Yang <Fan_Yang@sjtu.edu.cn>
Signed-off-by: Fan Yang <Fan_Yang@sjtu.edu.cn>
Tested-by: Fan Yang <Fan_Yang@sjtu.edu.cn>
Tested-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mremap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/mremap.c b/mm/mremap.c index 9e6035969d7b..b5d8d25173c6 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -212,7 +212,7 @@ unsigned long move_page_tables(struct vm_area_struct *vma, new_pmd = alloc_new_pmd(vma->vm_mm, vma, new_addr); if (!new_pmd) break; - if (pmd_trans_huge(*old_pmd)) { + if (pmd_trans_huge(*old_pmd) || pmd_devmap(*old_pmd)) { if (extent == HPAGE_PMD_SIZE) { bool moved; /* See comment in move_ptes() */ |