linux/arch/arm64
Mark Rutland c1a88e9124 arm64: kasan: avoid TLB conflicts
The page table modification performed during the KASAN init risks the
allocation of conflicting TLB entries, as it swaps a set of valid global
entries for another without suitable TLB maintenance.

The presence of conflicting TLB entries can result in the delivery of
synchronous TLB conflict aborts, or may result in the use of erroneous
data being returned in response to a TLB lookup. This can affect
explicit data accesses from software as well as translations performed
asynchronously (e.g. as part of page table walks or speculative I-cache
fetches), and can therefore result in a wide variety of problems.

To avoid this, use cpu_replace_ttbr1 to swap the page tables. This
ensures that when the new tables are installed there are no stale
entries from the old tables which may conflict. As all updates are made
to the tables while they are not active, the updates themselves are
safe.

At the same time, add the missing barrier to ensure that the tmp_pg_dir
entries updated via memcpy are visible to the page table walkers at the
point the tmp_pg_dir is installed. All other page table updates made as
part of KASAN initialisation have the requisite barriers due to the use
of the standard page table accessors.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Jeremy Linton <jeremy.linton@arm.com>
Cc: Laura Abbott <labbott@fedoraproject.org>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-16 15:10:45 +00:00
..
boot ARM: SoC fixes for v4.5-rc 2016-02-07 15:23:20 -08:00
configs arm64: defconfig: updates for 4.5 2016-01-26 11:24:41 +00:00
crypto arm64: crypto: reduce priority of core AES cipher 2015-11-18 12:09:08 +00:00
include arm64: mm: add code to safely replace TTBR1_EL1 2016-02-16 15:10:45 +00:00
kernel arm64: unmap idmap earlier 2016-02-16 15:10:45 +00:00
kvm arm64: KVM: Fix guest dead loop when register accessor returns false 2016-01-24 21:56:01 +00:00
lib arm64: add KASAN support 2015-10-12 17:46:36 +01:00
mm arm64: kasan: avoid TLB conflicts 2016-02-16 15:10:45 +00:00
net arm64: bpf: add extra pass to handle faulty codegen 2016-01-17 19:15:26 -05:00
xen xen/arm: introduce HYPERVISOR_platform_op on arm and arm64 2015-12-21 14:40:56 +00:00
Kconfig dma-mapping: always provide the dma_map_ops based implementation 2016-01-20 17:09:18 -08:00
Kconfig.debug arch: consolidate CONFIG_STRICT_DEVM in lib/Kconfig.debug 2016-01-09 06:30:49 -08:00
Kconfig.platforms ARM: SoC support for Tegra platforms for v4.5 2016-01-22 17:30:52 -08:00
Makefile arm64: errata: Add -mpc-relative-literal-loads to build flags 2016-01-26 11:17:23 +00:00