]> git.baikalelectronics.ru Git - kernel.git/commit
mm: Fix mremap not considering huge pmd devmap
authorFan Yang <Fan_Yang@sjtu.edu.cn>
Thu, 4 Jun 2020 10:22:07 +0000 (18:22 +0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Jun 2020 02:05:24 +0000 (19:05 -0700)
commitd340a27035aef9ba6098e2c63594c2dc82c7f210
treeedad86fc86a98a8f13c4ebd1c4cdc3beb2114435
parentf5726f086fb12c6ed263fd19f0c2cf95d7d84e39
mm: Fix mremap not considering huge pmd devmap

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: 2de326aa86f2 ("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>
arch/x86/include/asm/pgtable.h
mm/mremap.c