linux/arch/arm
Ard Biesheuvel e6fab54423 ARM/arm64: KVM: test properly for a PTE's uncachedness
The open coded tests for checking whether a PTE maps a page as
uncached use a flawed '(pte_val(xxx) & CONST) != CONST' pattern,
which is not guaranteed to work since the type of a mapping is
not a set of mutually exclusive bits

For HYP mappings, the type is an index into the MAIR table (i.e, the
index itself does not contain any information whatsoever about the
type of the mapping), and for stage-2 mappings it is a bit field where
normal memory and device types are defined as follows:

    #define MT_S2_NORMAL            0xf
    #define MT_S2_DEVICE_nGnRE      0x1

I.e., masking *and* comparing with the latter matches on the former,
and we have been getting lucky merely because the S2 device mappings
also have the PTE_UXN bit set, or we would misidentify memory mappings
as device mappings.

Since the unmap_range() code path (which contains one instance of the
flawed test) is used both for HYP mappings and stage-2 mappings, and
considering the difference between the two, it is non-trivial to fix
this by rewriting the tests in place, as it would involve passing
down the type of mapping through all the functions.

However, since HYP mappings and stage-2 mappings both deal with host
physical addresses, we can simply check whether the mapping is backed
by memory that is managed by the host kernel, and only perform the
D-cache maintenance if this is the case.

Cc: stable@vger.kernel.org
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Pavel Fedin <p.fedin@samsung.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2015-11-24 17:58:00 +01:00
..
boot ARM: dts: imx27.dtsi: change the clock information for usb 2015-11-18 14:07:54 +08:00
common dmaengine updates for 4.4-rc1 2015-11-10 10:05:17 -08:00
configs ARM: SoC defconfig updates for v4.4 2015-11-10 15:08:32 -08:00
crypto
firmware
include ARM: SoC platform updates for v4.4 2015-11-10 14:56:23 -08:00
kernel ARM: SoC platform updates for v4.4 2015-11-10 14:56:23 -08:00
kvm ARM/arm64: KVM: test properly for a PTE's uncachedness 2015-11-24 17:58:00 +01:00
lib
mach-alpine
mach-asm9260
mach-at91 ARM: SoC platform updates for v4.4 2015-11-10 14:56:23 -08:00
mach-axxia
mach-bcm ARM: SoC platform updates for v4.4 2015-11-10 14:56:23 -08:00
mach-berlin arm: berlin: add CPU hotplug support 2015-10-15 21:14:28 +02:00
mach-clps711x
mach-cns3xxx
mach-davinci ARM: SoC non-urgent fixes for v4.4 2015-11-10 14:45:05 -08:00
mach-digicolor ARM: digicolor: select pinctrl/gpio driver 2015-10-15 22:27:30 +02:00
mach-dove
mach-ebsa110
mach-efm32
mach-ep93xx
mach-exynos ARM: SoC cleanups for v4.4 2015-11-10 14:48:36 -08:00
mach-footbridge
mach-gemini ARM: gemini: remove unnecessary mdio-gpio includes 2015-10-21 19:50:43 -07:00
mach-highbank
mach-hisi
mach-imx ARM: SoC platform updates for v4.4 2015-11-10 14:56:23 -08:00
mach-integrator
mach-iop13xx
mach-iop32x
mach-iop33x
mach-ixp4xx
mach-keystone
mach-ks8695
mach-lpc18xx
mach-lpc32xx
mach-mediatek ARM: SoC platform updates for v4.4 2015-11-10 14:56:23 -08:00
mach-meson
mach-mmp
mach-moxart
mach-mv78xx0
mach-mvebu ARM: SoC platform updates for v4.4 2015-11-10 14:56:23 -08:00
mach-mxs
mach-netx
mach-nomadik
mach-nspire
mach-omap1
mach-omap2 ARM: SoC cleanups for v4.4 2015-11-10 14:48:36 -08:00
mach-orion5x ARM: orion5x: use mac_pton() helper 2015-10-23 17:18:22 +02:00
mach-picoxcell
mach-prima2 ARM: Remove __ref on hotplug cpu die path 2015-10-22 09:55:03 -07:00
mach-pxa ARM: SoC cleanups for v4.4 2015-11-10 14:48:36 -08:00
mach-qcom ARM: Remove __ref on hotplug cpu die path 2015-10-22 09:55:03 -07:00
mach-realview ARM: Remove __ref on hotplug cpu die path 2015-10-22 09:55:03 -07:00
mach-rockchip
mach-rpc
mach-s3c24xx Samsung SoC updates for v4.4 2015-10-26 10:18:41 +09:00
mach-s3c64xx ARM: SoC platform updates for v4.4 2015-11-10 14:56:23 -08:00
mach-s5pv210
mach-sa1100
mach-shmobile ARM: SoC platform updates for v4.4 2015-11-10 14:56:23 -08:00
mach-socfpga
mach-spear ARM: SoC cleanups for v4.4 2015-11-10 14:48:36 -08:00
mach-sti
mach-stm32
mach-sunxi ARM: SoC platform updates for v4.4 2015-11-10 14:56:23 -08:00
mach-tegra ARM: SoC platform updates for v4.4 2015-11-10 14:56:23 -08:00
mach-u300 spi: Updates for v4.4 2015-11-05 13:15:12 -08:00
mach-uniphier ARM: uniphier: rework SMP operations to use trampoline code 2015-10-27 09:20:53 +09:00
mach-ux500 ARM: SoC cleanups for v4.4 2015-11-10 14:48:36 -08:00
mach-versatile
mach-vexpress ARM: Remove __ref on hotplug cpu die path 2015-10-22 09:55:03 -07:00
mach-vt8500
mach-w90x900
mach-zx
mach-zynq
mm ARM: SoC platform updates for v4.4 2015-11-10 14:56:23 -08:00
net bpf, arm: start flushing icache range from header 2015-11-16 14:40:49 -05:00
nwfpe
oprofile
plat-iop
plat-omap
plat-orion mvebu fixes for 4.3 (part 1) 2015-10-14 17:10:55 +02:00
plat-pxa
plat-samsung
plat-versatile
probes
tools
vdso ARM: 8449/1: fix bug in vdsomunge swab32 macro 2015-10-29 15:20:15 +00:00
vfp
xen mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and avoiding waking kswapd 2015-11-06 17:50:42 -08:00
Kconfig ARM: SoC cleanups for v4.4 2015-11-10 14:48:36 -08:00
Kconfig-nommu
Kconfig.debug ARM: SoC platform updates for v4.4 2015-11-10 14:56:23 -08:00
Makefile