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
partitions
Kconfig -rw-r--r-- 3.7 KB
Kconfig.iosched -rw-r--r-- 1.6 KB
Makefile -rw-r--r-- 923 bytes
bio-integrity.c -rw-r--r-- 14.0 KB
bio.c -rw-r--r-- 51.2 KB
blk-cgroup.c -rw-r--r-- 29.6 KB
blk-cgroup.h -rw-r--r-- 16.6 KB
blk-core.c -rw-r--r-- 89.3 KB
blk-exec.c -rw-r--r-- 3.5 KB
blk-flush.c -rw-r--r-- 14.8 KB
blk-integrity.c -rw-r--r-- 12.4 KB
blk-ioc.c -rw-r--r-- 10.2 KB
blk-iopoll.c -rw-r--r-- 5.8 KB
blk-lib.c -rw-r--r-- 7.3 KB
blk-map.c -rw-r--r-- 8.2 KB
blk-merge.c -rw-r--r-- 14.9 KB
blk-mq-cpu.c -rw-r--r-- 1.6 KB
blk-mq-cpumap.c -rw-r--r-- 2.5 KB
blk-mq-sysfs.c -rw-r--r-- 10.6 KB
blk-mq-tag.c -rw-r--r-- 14.6 KB
blk-mq-tag.h -rw-r--r-- 2.0 KB
blk-mq.c -rw-r--r-- 49.5 KB
blk-mq.h -rw-r--r-- 3.2 KB
blk-settings.c -rw-r--r-- 27.2 KB
blk-softirq.c -rw-r--r-- 4.4 KB
blk-sysfs.c -rw-r--r-- 15.5 KB
blk-tag.c -rw-r--r-- 9.4 KB
blk-throttle.c -rw-r--r-- 45.8 KB
blk-timeout.c -rw-r--r-- 5.7 KB
blk.h -rw-r--r-- 8.6 KB
bounce.c -rw-r--r-- 6.5 KB
bsg-lib.c -rw-r--r-- 6.0 KB
bsg.c -rw-r--r-- 23.6 KB
cfq-iosched.c -rw-r--r-- 120.1 KB
cmdline-parser.c -rw-r--r-- 4.9 KB
compat_ioctl.c -rw-r--r-- 20.8 KB
deadline-iosched.c -rw-r--r-- 11.3 KB
elevator.c -rw-r--r-- 23.7 KB
genhd.c -rw-r--r-- 44.3 KB
ioctl.c -rw-r--r-- 10.7 KB
ioprio.c -rw-r--r-- 5.0 KB
noop-iosched.c -rw-r--r-- 2.7 KB
partition-generic.c -rw-r--r-- 14.0 KB
scsi_ioctl.c -rw-r--r-- 19.6 KB
t10-pi.c -rw-r--r-- 5.1 KB

back to top