linux/arch/powerpc
Laurentiu Tudor 3fb66a70a4 powerpc/booke: Fix boot crash due to null hugepd
On 32-bit book-e machines, hugepd_ok() no longer takes into account null
hugepd values, causing this crash at boot:

  Unable to handle kernel paging request for data at address 0x80000000
  ...
  NIP [c0018378] follow_huge_addr+0x38/0xf0
  LR [c001836c] follow_huge_addr+0x2c/0xf0
  Call Trace:
   follow_huge_addr+0x2c/0xf0 (unreliable)
   follow_page_mask+0x40/0x3e0
   __get_user_pages+0xc8/0x450
   get_user_pages_remote+0x8c/0x250
   copy_strings+0x110/0x390
   copy_strings_kernel+0x2c/0x50
   do_execveat_common+0x478/0x630
   do_execve+0x2c/0x40
   try_to_run_init_process+0x18/0x60
   kernel_init+0xbc/0x110
   ret_from_kernel_thread+0x5c/0x64

This impacts all nxp (ex-freescale) 32-bit booke platforms.

This was caused by the change of hugepd_t.pd from signed to unsigned,
and the update to the nohash version of hugepd_ok(). Previously
hugepd_ok() could exclude all non-huge and NULL pgds using > 0, whereas
now we need to explicitly check that the value is not zero and also that
PD_HUGE is *clear*.

This isn't protected by the pgd_none() check in __find_linux_pte_or_hugepte()
because on 32-bit we use pgtable-nopud.h, which causes the pgd_none()
check to be always false.

Fixes: 20717e1ff5 ("powerpc/mm: Fix little-endian 4K hugetlb")
Cc: stable@vger.kernel.org # v4.7+
Reported-by: Madalin-Cristian Bucur <madalin.bucur@nxp.com>
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
[mpe: Flesh out change log details.]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2017-03-03 11:24:50 +11:00
..
boot powerpc updates for 4.11 part 2 2017-03-01 10:10:16 -08:00
configs powerpc updates for 4.11 part 2 2017-03-01 10:10:16 -08:00
crypto crypto: crc32c-vpmsum - Rename CRYPT_CRC32C_VPMSUM option 2016-11-28 21:23:17 +08:00
include powerpc/booke: Fix boot crash due to null hugepd 2017-03-03 11:24:50 +11:00
kernel powerpc/powernv: Fix bug due to labeling ambiguity in power_enter_stop 2017-03-03 11:24:50 +11:00
kvm mm: cma_alloc: allow to specify GFP mask 2017-02-24 17:46:55 -08:00
lib powerpc: emulate_step() tests for load/store instructions 2017-03-03 11:24:50 +11:00
math-emu Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
mm powerpc/64: Invalidate process table caching after setting process table 2017-03-03 11:24:50 +11:00
net powerpc updates for 4.11 part 1. 2017-02-22 10:30:38 -08:00
oprofile ktime: Cleanup ktime_set() usage 2016-12-25 17:21:22 +01:00
perf Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/scottwood/linux into next 2017-02-18 21:37:14 +11:00
platforms powerpc updates for 4.11 part 2 2017-03-01 10:10:16 -08:00
purgatory powerpc: Add purgatory for kexec_file_load() implementation. 2016-11-30 23:15:26 +11:00
scripts
sysdev powerpc/powernv: Properly set "host-ipi" on IPIs 2017-02-09 15:51:21 +11:00
xmon powerpc updates for 4.11 part 2 2017-03-01 10:10:16 -08:00
Kconfig powerpc updates for 4.11 part 2 2017-03-01 10:10:16 -08:00
Kconfig.debug powerpc/xmon: Enable disassembly files (compilation changes) 2017-02-15 20:02:42 +11:00
Makefile powerpc: Fix compiling a BE kernel with a powerpc64le toolchain 2017-03-03 11:24:50 +11:00
relocs_check.sh