linux-uconsole/arch
Heiko Carstens d7248f5a0b s390/smp,vdso: fix ASCE handling
[ Upstream commit a2308c11ec ]

When a secondary CPU is brought up it must initialize its control
registers. CPU A which triggers that a secondary CPU B is brought up
stores its control register contents into the lowcore of new CPU B,
which then loads these values on startup.

This is problematic in various ways: the control register which
contains the home space ASCE will correctly contain the kernel ASCE;
however control registers for primary and secondary ASCEs are
initialized with whatever values were present in CPU A.

Typically:
- the primary ASCE will contain the user process ASCE of the process
  that triggered onlining of CPU B.
- the secondary ASCE will contain the percpu VDSO ASCE of CPU A.

Due to lazy ASCE handling we may also end up with other combinations.

When then CPU B switches to a different process (!= idle) it will
fixup the primary ASCE. However the problem is that the (wrong) ASCE
from CPU A was loaded into control register 1: as soon as an ASCE is
attached (aka loaded) a CPU is free to generate TLB entries using that
address space.
Even though it is very unlikey that CPU B will actually generate such
entries, this could result in TLB entries of the address space of the
process that ran on CPU A. These entries shouldn't exist at all and
could cause problems later on.

Furthermore the secondary ASCE of CPU B will not be updated correctly.
This means that processes may see wrong results or even crash if they
access VDSO data on CPU B. The correct VDSO ASCE will eventually be
loaded on return to user space as soon as the kernel executed a call
to strnlen_user or an atomic futex operation on CPU B.

Fix both issues by intializing the to be loaded control register
contents with the correct ASCEs and also enforce (re-)loading of the
ASCEs upon first context switch and return to user space.

Fixes: 0aaba41b58 ("s390: remove all code using the access register mode")
Cc: stable@vger.kernel.org # v4.15+
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-17 20:35:47 +01:00
..
alpha alpha: Fix Eiger NR_IRQS to 128 2019-02-20 10:25:47 +01:00
arc ARC: IOC: panic if kernel was started with previously enabled IOC 2019-12-13 08:51:12 +01:00
arm omap: pdata-quirks: remove openpandora quirks for mmc3 and wl1251 2019-12-17 20:35:27 +01:00
arm64 arm64: dts: exynos: Revert "Remove unneeded address space mapping for soc node" 2019-12-13 08:52:44 +01:00
c6x
h8300 h8300: use cc-cross-prefix instead of hardcoding h8300-unknown-linux- 2019-04-05 22:32:55 +02:00
hexagon
ia64 ia64:unwind: fix double free for mod->arch.init_unw_table 2019-10-05 13:09:38 +02:00
m68k m68k: fix command-line parsing when passed from u-boot 2019-12-01 09:16:22 +01:00
microblaze microblaze: fix multiple bugs in arch/microblaze/boot/Makefile 2019-12-05 09:20:13 +01:00
mips MIPS: OCTEON: cvmx_pko_mem_debug8: use oldest forward compatible definition 2019-12-13 08:52:26 +01:00
nds32 nds32: Fix the items of hwcap_str ordering issue. 2019-12-13 08:51:35 +01:00
nios2
openrisc openrisc: Fix broken paths to arch/or32 2019-12-05 09:20:40 +01:00
parisc parisc: Fix vmap memory leak in ioremap()/iounmap() 2019-10-29 09:20:00 +01:00
powerpc powerpc: Fix vDSO clock_getres() 2019-12-17 20:35:40 +01:00
riscv RISC-V: Avoid corrupting the upper 32-bit of phys_addr_t in ioremap 2019-12-01 09:16:53 +01:00
s390 s390/smp,vdso: fix ASCE handling 2019-12-17 20:35:47 +01:00
sh sh: kernel: hw_breakpoint: Fix missing break in switch statement 2019-08-25 10:47:42 +02:00
sparc sparc: Correct ctx->saw_frame_pointer logic. 2019-12-13 08:51:52 +01:00
um um: Make GCOV depend on !KCOV 2019-12-05 09:20:52 +01:00
unicore32
x86 x86/MCE/AMD: Carve out the MC4_MISC thresholding quirk 2019-12-17 20:35:36 +01:00
xtensa xtensa: drop EXPORT_SYMBOL for outs*/ins* 2019-10-29 09:20:00 +01:00
.gitignore
Kconfig jump_label: move 'asm goto' support test to Kconfig 2019-06-04 08:02:34 +02:00