android_kernel_motorola_sm6375/arch/arm
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Mike Rapoport 7845532adb arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map
commit 260364d112bc822005224667c0c9b1b17a53eafd upstream.

The semantics of pfn_valid() is to check presence of the memory map for a
PFN and not whether a PFN is covered by the linear map.  The memory map
may be present for NOMAP memory regions, but they won't be mapped in the
linear mapping.  Accessing such regions via __va() when they are
memremap()'ed will cause a crash.

On v5.4.y the crash happens on qemu-arm with UEFI [1]:

<1>[    0.084476] 8<--- cut here ---
<1>[    0.084595] Unable to handle kernel paging request at virtual address dfb76000
<1>[    0.084938] pgd = (ptrval)
<1>[    0.085038] [dfb76000] *pgd=5f7fe801, *pte=00000000, *ppte=00000000

...

<4>[    0.093923] [<c0ed6ce8>] (memcpy) from [<c16a06f8>] (dmi_setup+0x60/0x418)
<4>[    0.094204] [<c16a06f8>] (dmi_setup) from [<c16a38d4>] (arm_dmi_init+0x8/0x10)
<4>[    0.094408] [<c16a38d4>] (arm_dmi_init) from [<c0302e9c>] (do_one_initcall+0x50/0x228)
<4>[    0.094619] [<c0302e9c>] (do_one_initcall) from [<c16011e4>] (kernel_init_freeable+0x15c/0x1f8)
<4>[    0.094841] [<c16011e4>] (kernel_init_freeable) from [<c0f028cc>] (kernel_init+0x8/0x10c)
<4>[    0.095057] [<c0f028cc>] (kernel_init) from [<c03010e8>] (ret_from_fork+0x14/0x2c)

On kernels v5.10.y and newer the same crash won't reproduce on ARM because
commit b10d6bca8720 ("arch, drivers: replace for_each_membock() with
for_each_mem_range()") changed the way memory regions are registered in
the resource tree, but that merely covers up the problem.

On ARM64 memory resources registered in yet another way and there the
issue of wrong usage of pfn_valid() to ensure availability of the linear
map is also covered.

Implement arch_memremap_can_ram_remap() on ARM and ARM64 to prevent access
to NOMAP regions via the linear mapping in memremap().

Link: https://lore.kernel.org/all/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Mike Rapoport <[email protected]>
Reported-by: "kernelci.org bot" <[email protected]>
Tested-by: Mark Brown <[email protected]>
Reviewed-by: Ard Biesheuvel <[email protected]>
Acked-by: Catalin Marinas <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Mark-PK Tsai <[email protected]>
Cc: Russell King <[email protected]>
Cc: Tony Lindgren <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: <[email protected]>	[5.4+]
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Mike Rapoport <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-18 09:47:28 +02:00
..
boot ARM: dts: imx6ull-colibri: fix vqmmc regulator 2022-05-09 09:03:25 +02:00
common
configs scsi: sr: remove references to BLK_DEV_SR_VENDOR, leave it enabled 2020-07-22 09:32:57 +02:00
crypto crypto: arm/aes-ce - work around Cortex-A57/A72 silion errata 2020-12-30 11:51:36 +01:00
include arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map 2022-05-18 09:47:28 +02:00
kernel ARM: fix Thumb2 regression with Spectre BHB 2022-03-16 13:21:48 +01:00
kvm KVM: arm64: Ensure I-cache isolation between vcpus of a same VM 2021-03-17 17:03:57 +01:00
lib
mach-actions
mach-alpine
mach-artpec
mach-asm9260
mach-aspeed
mach-at91 ARM: at91: pm: of_node_put() after its usage 2020-10-29 09:57:58 +01:00
mach-axxia
mach-bcm arm: remove CONFIG_ARCH_HAS_HOLES_MEMORYMODEL 2022-05-15 19:54:46 +02:00
mach-berlin
mach-clps711x
mach-cns3xxx
mach-davinci arm: remove CONFIG_ARCH_HAS_HOLES_MEMORYMODEL 2022-05-15 19:54:46 +02:00
mach-digicolor
mach-dove
mach-ebsa110
mach-efm32
mach-ep93xx
mach-exynos arm: remove CONFIG_ARCH_HAS_HOLES_MEMORYMODEL 2022-05-15 19:54:46 +02:00
mach-footbridge ARM: footbridge: fix PCI interrupt mapping 2021-04-21 12:56:17 +02:00
mach-gemini
mach-highbank arm: remove CONFIG_ARCH_HAS_HOLES_MEMORYMODEL 2022-05-15 19:54:46 +02:00
mach-hisi
mach-imx ARM: imx6: disable the GIC CPU interface before calling stby-poweroff sequence 2021-10-13 10:08:19 +02:00
mach-integrator ARM: integrator: Add some Kconfig selections 2020-06-24 17:50:10 +02:00
mach-iop32x ARM: iop32x: offset IRQ numbers by 1 2022-04-15 14:18:29 +02:00
mach-ixp4xx clocksource/drivers/ixp4xx: Select TIMER_OF when needed 2021-03-04 10:26:29 +01:00
mach-keystone ARM: keystone: fix integer overflow warning 2021-04-21 12:56:13 +02:00
mach-lpc18xx
mach-lpc32xx
mach-mediatek
mach-meson
mach-milbeaut
mach-mmp ARM: mmp: Fix failure to remove sram device 2022-04-15 14:18:25 +02:00
mach-moxart
mach-mv78xx0
mach-mvebu
mach-mxs
mach-nomadik
mach-npcm
mach-nspire
mach-omap1 ARM: OMAP: replace setup_irq() by request_irq() 2021-06-23 14:41:31 +02:00
mach-omap2 arm: remove CONFIG_ARCH_HAS_HOLES_MEMORYMODEL 2022-05-15 19:54:46 +02:00
mach-orion5x
mach-oxnas
mach-picoxcell
mach-prima2
mach-pxa
mach-qcom
mach-rda
mach-realview
mach-rockchip
mach-rpc
mach-s3c24xx ARM: 9187/1: JIVE: fix return value of __setup handler 2022-04-15 14:18:31 +02:00
mach-s3c64xx
mach-s5pv210 arm: remove CONFIG_ARCH_HAS_HOLES_MEMORYMODEL 2022-05-15 19:54:46 +02:00
mach-sa1100
mach-shmobile ARM: shmobile: rcar-gen2: Add missing of_node_put() 2022-01-27 09:19:40 +01:00
mach-socfpga ARM: socfpga: fix missing RESET_CONTROLLER 2022-02-16 12:52:49 +01:00
mach-spear
mach-sti
mach-stm32
mach-sunxi ARM: sunxi: Add machine match for the Allwinner V3 SoC 2020-12-30 11:51:29 +01:00
mach-tango arm: remove CONFIG_ARCH_HAS_HOLES_MEMORYMODEL 2022-05-15 19:54:46 +02:00
mach-tegra ARM: tegra: Correct PL310 Auxiliary Control Register initialization 2020-06-22 09:31:22 +02:00
mach-u300
mach-uniphier
mach-ux500
mach-versatile
mach-vexpress ARM: vexpress/spc: Avoid negative array index when !SMP 2022-04-27 13:50:47 +02:00
mach-vt8500
mach-zx
mach-zynq
mm arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map 2022-05-18 09:47:28 +02:00
net bpf, arm: Fix register clobbering in div/mod implementation 2021-10-13 10:08:18 +02:00
nwfpe
oprofile
plat-omap
plat-orion
plat-pxa
plat-samsung ARM: samsung: fix PM debug build with DEBUG_LL but !MMU 2020-11-05 11:43:36 +01:00
plat-versatile
probes ARM: 9139/1: kprobes: fix arch_init_kprobes() prototype 2021-11-02 19:46:11 +01:00
tools
vdso
vfp ARM: 9044/1: vfp: use undef hook for VFP support detection 2021-03-24 11:26:35 +01:00
xen Xen/gnttab: handle p2m update errors on a per-slot basis 2021-03-07 12:20:49 +01:00
Kconfig arm: remove CONFIG_ARCH_HAS_HOLES_MEMORYMODEL 2022-05-15 19:54:46 +02:00
Kconfig-nommu
Kconfig.debug
Makefile ARM: 9156/1: drop cc-option fallbacks for architecture selection 2021-11-17 09:48:48 +01:00