sst-linux/arch
Will Deacon 023438d01b arm64: tls: Fix context-switching of tpidrro_el0 when kpti is enabled
commit 67ab51cbdfee02ef07fb9d7d14cc0bf6cb5a5e5c upstream.

Commit 18011eac28 ("arm64: tls: Avoid unconditional zeroing of
tpidrro_el0 for native tasks") tried to optimise the context switching
of tpidrro_el0 by eliding the clearing of the register when switching
to a native task with kpti enabled, on the erroneous assumption that
the kpti trampoline entry code would already have taken care of the
write.

Although the kpti trampoline does zero the register on entry from a
native task, the check in tls_thread_switch() is on the *next* task and
so we can end up leaving a stale, non-zero value in the register if the
previous task was 32-bit.

Drop the broken optimisation and zero tpidrro_el0 unconditionally when
switching to a native 64-bit task.

Cc: Mark Rutland <mark.rutland@arm.com>
Cc: stable@vger.kernel.org
Fixes: 18011eac28 ("arm64: tls: Avoid unconditional zeroing of tpidrro_el0 for native tasks")
Signed-off-by: Will Deacon <will@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20241114095332.23391-1-will@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-12-14 19:54:03 +01:00
..
alpha mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
arc mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
arm ARM: dts: cubieboard4: Fix DCDC5 regulator constraints 2024-12-14 19:53:22 +01:00
arm64 arm64: tls: Fix context-switching of tpidrro_el0 when kpti is enabled 2024-12-14 19:54:03 +01:00
csky mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
hexagon mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
ia64 mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
loongarch LoongArch: BPF: Sign-extend return values 2024-12-14 19:53:49 +01:00
m68k m68k: coldfire/device.c: only build FEC when HW macros are defined 2024-12-14 19:53:46 +01:00
microblaze microblaze: Export xmb_manager functions 2024-12-14 19:53:20 +01:00
mips mips: asm: fix warning when disabling MIPS_FP_SUPPORT 2024-12-14 19:53:14 +01:00
nios2 mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
openrisc mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
parisc parisc/ftrace: Fix function graph tracing disablement 2024-12-14 19:54:02 +01:00
powerpc powerpc/pseries: Fix KVM guest detection for disabling hardlockup detector 2024-12-14 19:53:58 +01:00
riscv riscv/purgatory: align riscv_kernel_entry 2024-11-14 13:15:17 +01:00
s390 s390/syscalls: Avoid creation of arch/arch/ directory 2024-12-14 19:53:16 +01:00
sh sh: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK 2024-12-14 19:54:03 +01:00
sparc mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
um um: vector: Do not use drvdata in release 2024-12-14 19:54:03 +01:00
x86 KVM: x86/mmu: Skip the "try unsync" path iff the old SPTE was a leaf SPTE 2024-12-14 19:53:58 +01:00
xtensa mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
.gitignore
Kconfig Revert "mm: mmap: allow for the maximum number of bits for randomizing mmap_base by default" 2024-06-27 13:46:24 +02:00