Revision f43c27188a49111b58e9611afa2f0365b0b55625 authored by Lorenzo Pieralisi on 19 December 2014, 17:03:47 UTC, committed by Catalin Marinas on 23 December 2014, 16:38:50 UTC
On arm64 the TTBR0_EL1 register is set to either the reserved TTBR0
page tables on boot or to the active_mm mappings belonging to user space
processes, it must never be set to swapper_pg_dir page tables mappings.

When a CPU is booted its active_mm is set to init_mm even though its
TTBR0_EL1 points at the reserved TTBR0 page mappings. This implies
that when __cpu_suspend is triggered the active_mm can point at
init_mm even if the current TTBR0_EL1 register contains the reserved
TTBR0_EL1 mappings.

Therefore, the mm save and restore executed in __cpu_suspend might
turn out to be erroneous in that, if the current->active_mm corresponds
to init_mm, on resume from low power it ends up restoring in the
TTBR0_EL1 the init_mm mappings that are global and can cause speculation
of TLB entries which end up being propagated to user space.

This patch fixes the issue by checking the active_mm pointer before
restoring the TTBR0 mappings. If the current active_mm == &init_mm,
the code sets the TTBR0_EL1 to the reserved TTBR0 mapping instead of
switching back to the active_mm, which is the expected behaviour
corresponding to the TTBR0_EL1 settings when __cpu_suspend was entered.

Fixes: 95322526ef62 ("arm64: kernel: cpu_{suspend/resume} implementation")
Cc: <stable@vger.kernel.org> # 3.14+: 18ab7db
Cc: <stable@vger.kernel.org> # 3.14+: 714f599
Cc: <stable@vger.kernel.org> # 3.14+: c3684fb
Cc: <stable@vger.kernel.org> # 3.14+
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 31dde11
History
File Mode Size
Kconfig -rw-r--r-- 20.9 KB
Kconfig.debug -rw-r--r-- 1.4 KB
Makefile -rw-r--r-- 2.5 KB
backing-dev.c -rw-r--r-- 16.9 KB
balloon_compaction.c -rw-r--r-- 6.8 KB
bootmem.c -rw-r--r-- 20.8 KB
cleancache.c -rw-r--r-- 12.7 KB
cma.c -rw-r--r-- 11.9 KB
compaction.c -rw-r--r-- 43.6 KB
debug-pagealloc.c -rw-r--r-- 2.6 KB
debug.c -rw-r--r-- 6.5 KB
dmapool.c -rw-r--r-- 13.7 KB
early_ioremap.c -rw-r--r-- 5.4 KB
fadvise.c -rw-r--r-- 3.7 KB
failslab.c -rw-r--r-- 1.3 KB
filemap.c -rw-r--r-- 70.6 KB
filemap_xip.c -rw-r--r-- 11.2 KB
fremap.c -rw-r--r-- 7.3 KB
frontswap.c -rw-r--r-- 13.4 KB
gup.c -rw-r--r-- 31.0 KB
highmem.c -rw-r--r-- 11.8 KB
huge_memory.c -rw-r--r-- 78.2 KB
hugetlb.c -rw-r--r-- 98.2 KB
hugetlb_cgroup.c -rw-r--r-- 10.4 KB
hwpoison-inject.c -rw-r--r-- 3.3 KB
init-mm.c -rw-r--r-- 619 bytes
internal.h -rw-r--r-- 12.8 KB
interval_tree.c -rw-r--r-- 3.2 KB
iov_iter.c -rw-r--r-- 17.2 KB
kmemcheck.c -rw-r--r-- 2.9 KB
kmemleak-test.c -rw-r--r-- 3.2 KB
kmemleak.c -rw-r--r-- 53.2 KB
ksm.c -rw-r--r-- 63.3 KB
list_lru.c -rw-r--r-- 3.4 KB
maccess.c -rw-r--r-- 1.6 KB
madvise.c -rw-r--r-- 14.1 KB
memblock.c -rw-r--r-- 44.6 KB
memcontrol.c -rw-r--r-- 148.4 KB
memory-failure.c -rw-r--r-- 47.7 KB
memory.c -rw-r--r-- 102.8 KB
memory_hotplug.c -rw-r--r-- 51.4 KB
mempolicy.c -rw-r--r-- 70.8 KB
mempool.c -rw-r--r-- 10.7 KB
migrate.c -rw-r--r-- 48.6 KB
mincore.c -rw-r--r-- 7.8 KB
mlock.c -rw-r--r-- 22.8 KB
mm_init.c -rw-r--r-- 5.0 KB
mmap.c -rw-r--r-- 88.5 KB
mmu_context.c -rw-r--r-- 1.3 KB
mmu_notifier.c -rw-r--r-- 11.4 KB
mmzone.c -rw-r--r-- 2.4 KB
mprotect.c -rw-r--r-- 10.5 KB
mremap.c -rw-r--r-- 15.2 KB
msync.c -rw-r--r-- 2.7 KB
nobootmem.c -rw-r--r-- 10.7 KB
nommu.c -rw-r--r-- 53.0 KB
oom_kill.c -rw-r--r-- 19.8 KB
page-writeback.c -rw-r--r-- 74.2 KB
page_alloc.c -rw-r--r-- 183.8 KB
page_counter.c -rw-r--r-- 4.7 KB
page_ext.c -rw-r--r-- 10.3 KB
page_io.c -rw-r--r-- 9.5 KB
page_isolation.c -rw-r--r-- 8.6 KB
page_owner.c -rw-r--r-- 6.9 KB
pagewalk.c -rw-r--r-- 5.9 KB
percpu-km.c -rw-r--r-- 2.8 KB
percpu-vm.c -rw-r--r-- 10.0 KB
percpu.c -rw-r--r-- 66.2 KB
pgtable-generic.c -rw-r--r-- 5.2 KB
process_vm_access.c -rw-r--r-- 10.2 KB
quicklist.c -rw-r--r-- 2.4 KB
readahead.c -rw-r--r-- 15.6 KB
rmap.c -rw-r--r-- 48.6 KB
shmem.c -rw-r--r-- 89.7 KB
slab.c -rw-r--r-- 106.7 KB
slab.h -rw-r--r-- 10.0 KB
slab_common.c -rw-r--r-- 24.1 KB
slob.c -rw-r--r-- 15.7 KB
slub.c -rw-r--r-- 125.0 KB
sparse-vmemmap.c -rw-r--r-- 6.0 KB
sparse.c -rw-r--r-- 20.9 KB
swap.c -rw-r--r-- 31.8 KB
swap_cgroup.c -rw-r--r-- 4.6 KB
swap_state.c -rw-r--r-- 12.9 KB
swapfile.c -rw-r--r-- 77.0 KB
truncate.c -rw-r--r-- 24.4 KB
util.c -rw-r--r-- 9.4 KB
vmacache.c -rw-r--r-- 3.1 KB
vmalloc.c -rw-r--r-- 68.1 KB
vmpressure.c -rw-r--r-- 11.4 KB
vmscan.c -rw-r--r-- 107.4 KB
vmstat.c -rw-r--r-- 40.7 KB
workingset.c -rw-r--r-- 13.6 KB
zbud.c -rw-r--r-- 17.9 KB
zpool.c -rw-r--r-- 9.5 KB
zsmalloc.c -rw-r--r-- 31.9 KB
zswap.c -rw-r--r-- 24.9 KB

back to top