linux-stable/arch/powerpc
Aneesh Kumar K.V 2c474c0350 powerpc/mm/radix: Fix kernel crash when running subpage protect test
This patch fixes the below crash by making sure we touch the subpage
protection related structures only if we know they are allocated on
the platform. With radix translation we don't allocate hash context at
all and trying to access subpage_prot_table results in:

  Faulting instruction address: 0xc00000000008bdb4
  Oops: Kernel access of bad area, sig: 11 [#1]
  LE PAGE_SIZE=64K MMU=Radix MMU=Hash SMP NR_CPUS=2048 NUMA PowerNV
  ....
  NIP [c00000000008bdb4] sys_subpage_prot+0x74/0x590
  LR [c00000000000b688] system_call+0x5c/0x70
  Call Trace:
  [c00020002c6b7d30] [c00020002c6b7d90] 0xc00020002c6b7d90 (unreliable)
  [c00020002c6b7e20] [c00000000000b688] system_call+0x5c/0x70
  Instruction dump:
  fb61ffd8 fb81ffe0 fba1ffe8 fbc1fff0 fbe1fff8 f821ff11 e92d1178 f9210068
  39200000 e92d0968 ebe90630 e93f03e8 <eb891038> 60000000 3860fffe e9410068

We also move the subpage_prot_table with mmp_sem held to avoid race
between two parallel subpage_prot syscall.

Fixes: 701101865f ("powerpc/mm: Reduce memory usage for mm_context_t for radix")
Reported-by: Sachin Sant <sachinp@linux.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Tested-by: Sachin Sant <sachinp@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2019-05-01 23:01:33 +10:00
..
boot Kbuild updates for v5.1 2019-03-10 17:48:21 -07:00
configs powerpc/configs: Enable CONFIG_USB_XHCI_HCD by default 2019-04-20 22:02:26 +10:00
crypto powerpc/crypto: Use cheaper random numbers for crc-vpmsum self-test 2019-04-20 22:03:11 +10:00
include powerpc/powernv/mce: Print additional information about MCE error. 2019-05-01 22:23:20 +10:00
kernel powerpc/powernv/mce: Print additional information about MCE error. 2019-05-01 22:23:20 +10:00
kvm Merge branch 'topic/ppc-kvm' into next 2019-04-30 22:52:03 +10:00
lib powerpc/lib: Refactor __patch_instruction() to use __put_user_asm() 2019-04-21 23:06:02 +10:00
math-emu powerpc: math-emu: remove unneeded header search paths 2019-01-14 20:39:27 +11:00
mm powerpc/mm/radix: Fix kernel crash when running subpage protect test 2019-05-01 23:01:33 +10:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 2019-03-16 12:20:08 -07:00
oprofile Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
perf powerpc updates for 5.1 2019-03-07 12:56:26 -08:00
platforms powerpc/powernv/mce: Print correct severity for MCE error. 2019-05-01 22:22:51 +10:00
purgatory powerpc updates for 4.19 2018-08-17 11:32:50 -07:00
sysdev powerpc/xive: add OPAL extensions for the XIVE native exploitation support 2019-04-11 15:31:41 +10:00
tools powerpc/tools/checkpatch: Ignore DT_SPLIT_BINDING_PATCH 2018-12-04 19:45:01 +11:00
xmon powerpc/64s: Reimplement book3s idle code in C 2019-04-30 22:37:48 +10:00
Kbuild powerpc: Add -Werror at arch/powerpc level 2018-10-19 00:56:17 +11:00
Kconfig DMA mapping updates for 5.1 2019-03-10 11:54:48 -07:00
Kconfig.debug powerpc: Move page table dump files in a dedicated subdirectory 2019-02-22 22:29:22 +11:00
Makefile powerpc: vdso: Make vdso32 installation conditional in vdso_install 2019-04-20 22:02:12 +10:00
Makefile.postlink