linux-stable/arch/arm64
Huang Shijie 20156ce236 arm64: hugetlb: remove the wrong pmd check in find_num_contig()
The find_num_contig() will return 1 when the pmd is not present.
It will cause a kernel dead loop in the following scenaro:

   1.) pmd entry is not present.

   2.) the page fault occurs:
       ... hugetlb_fault() --> hugetlb_no_page() --> set_huge_pte_at()

   3.) set_huge_pte_at() will only set the first PMD entry, since the
       find_num_contig just return 1 in this case. So the PMD entries
       are all empty except the first one.

   4.) when kernel accesses the address mapped by the second PMD entry,
       a new page fault occurs:
       ... hugetlb_fault() --> huge_ptep_set_access_flags()

       The second PMD entry is still empty now.

   5.) When the kernel returns, the access will cause a page fault again.
       The kernel will run like the "4)" above.
       We will see a dead loop since here.

The dead loop is caught in the 32M hugetlb page (2M PMD + Contiguous bit).

This patch removes wrong pmd check, and fixes this dead loop.

This patch also removes the redundant checks for PGD/PUD in
the find_num_contig().

Acked-by: Steve Capper <steve.capper@arm.com>
Signed-off-by: Huang Shijie <shijie.huang@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-11-09 16:54:55 +00:00
..
boot Correct regulator handling on Rockchip arm64 boards to make 2016-10-29 11:09:37 -07:00
configs ZTE arm64 defconfig updates for 4.9: 2016-09-19 22:35:21 +02:00
crypto crypto: arm64/aes-ctr - fix NULL dereference in tail processing 2016-09-13 18:44:59 +08:00
include arm64: Add uprobe support 2016-11-07 18:15:21 +00:00
kernel arm64: fix error: conflicting types for 'kprobe_fault_handler' 2016-11-07 18:15:21 +00:00
kvm KVM updates for v4.9-rc1 2016-10-06 10:49:01 -07:00
lib Merge branch 'work.uaccess' into for-linus 2016-10-14 20:42:44 -04:00
mm arm64: hugetlb: remove the wrong pmd check in find_num_contig() 2016-11-09 16:54:55 +00:00
net arm64: bpf: optimize LD_ABS, LD_IND 2016-06-10 23:11:50 -07:00
xen arm/xen: add support for vm_assist hypercall 2016-07-06 10:42:14 +01:00
Kconfig arm64: Add uprobe support 2016-11-07 18:15:21 +00:00
Kconfig.debug arm64: dump: Add checking for writable and exectuable pages 2016-11-07 18:15:04 +00:00
Kconfig.platforms arm64: uniphier: select ARCH_HAS_RESET_CONTROLLER 2016-10-22 18:25:52 +09:00
Makefile arm64: kernel: force ET_DYN ELF type for CONFIG_RELOCATABLE=y 2016-10-20 11:37:25 +01:00