linux-stable/arch/arm64/kernel
Dave Martin cb968afc78 arm64/sve: Avoid dereference of dead task_struct in KVM guest entry
When deciding whether to invalidate FPSIMD state cached in the cpu,
the backend function sve_flush_cpu_state() attempts to dereference
__this_cpu_read(fpsimd_last_state).  However, this is not safe:
there is no guarantee that this task_struct pointer is still valid,
because the task could have exited in the meantime.

This means that we need another means to get the appropriate value
of TIF_SVE for the associated task.

This patch solves this issue by adding a cached copy of the TIF_SVE
flag in fpsimd_last_state, which we can check without dereferencing
the task pointer.

In particular, although this patch is not a KVM fix per se, this
means that this check is now done safely in the KVM world switch
path (which is currently the only user of this code).

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Christoffer Dall <christoffer.dall@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
2017-12-06 19:08:05 +00:00
..
probes License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vdso arm64 updates for 4.15 2017-11-15 10:56:56 -08:00
.gitignore
acpi.c ACPI / boot: Correct address space of __acpi_map_table() 2017-07-24 22:47:56 +02:00
acpi_numa.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
acpi_parking_protocol.c arm64: fix endianness annotation in acpi_parking_protocol.c 2017-06-29 11:33:15 +01:00
alternative.c arm64: fix endianness annotation for __apply_alternatives()/get_alt_insn() 2017-06-29 16:32:43 +01:00
arm64ksyms.c
armv8_deprecated.c arm64 updates for 4.15 2017-11-15 10:56:56 -08:00
asm-offsets.c arm64: unwind: reference pt_regs via embedded stack frame 2017-08-09 14:07:13 +01:00
cacheinfo.c
cpu-reset.h
cpu-reset.S
cpu_errata.c
cpu_ops.c arm64: cpu_ops: Add missing 'const' qualifiers 2017-12-01 13:05:08 +00:00
cpufeature.c arm64 updates for 4.15 2017-11-15 10:56:56 -08:00
cpuidle.c
cpuinfo.c arm64/sve: Detect SVE and activate runtime support 2017-11-03 15:24:21 +00:00
crash_dump.c
debug-monitors.c arm64: introduce an order for exceptions 2017-11-02 15:55:41 +00:00
efi-entry.S arm64: efi-entry.S: avoid open-coded adr_l 2017-01-17 17:41:14 +00:00
efi-header.S
efi.c
entry-fpsimd.S arm64/sve: Low-level SVE architectural state manipulation functions 2017-11-03 15:24:14 +00:00
entry-ftrace.S arm64: Fix static use of function graph 2017-11-03 12:05:23 +00:00
entry.S arm64/sve: Detect SVE and activate runtime support 2017-11-03 15:24:21 +00:00
entry32.S
fpsimd.c arm64/sve: Avoid dereference of dead task_struct in KVM guest entry 2017-12-06 19:08:05 +00:00
ftrace.c arm64: ftrace: emit ftrace-mod.o contents through code 2017-12-01 13:04:59 +00:00
head.S arm64/sve: Low-level CPU setup 2017-11-03 15:24:15 +00:00
hibernate-asm.S
hibernate.c arm64: explicitly mask all exceptions 2017-11-02 15:55:40 +00:00
hw_breakpoint.c
hyp-stub.S
image.h
insn.c arm64 updates for 4.13: 2017-07-05 17:09:27 -07:00
io.c arm64: Avoid aligning normal memory pointers in __memcpy_{to,from}io 2017-10-24 16:23:07 +01:00
irq.c arm64: add basic VMAP_STACK support 2017-08-15 18:36:04 +01:00
jump_label.c
kaslr.c arm64: kaslr: Adjust the offset to avoid Image across alignment boundary 2017-08-22 18:15:42 +01:00
kgdb.c
kuser32.S
machine_kexec.c arm64: explicitly mask all exceptions 2017-11-02 15:55:40 +00:00
Makefile arm64: ftrace: emit ftrace-mod.o contents through code 2017-12-01 13:04:59 +00:00
module-plts.c arm64: ftrace: emit ftrace-mod.o contents through code 2017-12-01 13:04:59 +00:00
module.c arm64: fix endianness annotation for reloc_insn_movw() & reloc_insn_imm() 2017-06-29 11:09:39 +01:00
module.lds arm64: ftrace: emit ftrace-mod.o contents through code 2017-12-01 13:04:59 +00:00
paravirt.c
pci.c PCI: Add a generic weak pcibios_align_resource() 2017-08-02 14:53:16 -05:00
perf_callchain.c arm64: unwind: remove sp from struct stackframe 2017-08-09 14:10:29 +01:00
perf_event.c arm64: perf: remove unsupported events for Cortex-A73 2017-12-01 13:05:08 +00:00
perf_regs.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
process.c arm64: fpsimd: Prevent registers leaking from dead tasks 2017-12-06 18:02:21 +00:00
psci.c
ptrace.c arm64/sve: ptrace and ELF coredump support 2017-11-03 15:24:18 +00:00
reloc_test_core.c
reloc_test_syms.S
relocate_kernel.S
return_address.c arm64: unwind: remove sp from struct stackframe 2017-08-09 14:10:29 +01:00
setup.c arm64: Move the async/fiq helpers to explicitly set process context flags 2017-11-02 15:55:41 +00:00
signal.c arm64/sve: Signal handling support 2017-11-03 15:24:16 +00:00
signal32.c arm64/sve: Signal handling support 2017-11-03 15:24:16 +00:00
sleep.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
smccc-call.S
smp.c arm64: Move the async/fiq helpers to explicitly set process context flags 2017-11-02 15:55:41 +00:00
smp_spin_table.c
stacktrace.c arm64: stacktrace: avoid listing stacktrace functions in stacktrace 2017-09-13 18:53:16 -07:00
suspend.c arm64 updates for 4.15 2017-11-15 10:56:56 -08:00
sys.c
sys32.c
sys_compat.c
time.c arm64: unwind: remove sp from struct stackframe 2017-08-09 14:10:29 +01:00
topology.c arm64: Convert to using %pOF instead of full_name 2017-07-20 10:28:41 +01:00
trace-events-emulation.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
traps.c arm64 updates for 4.15 2017-11-15 10:56:56 -08:00
vdso.c arm64/vdso: Support mremap() for vDSO 2017-08-09 12:16:28 +01:00
vmlinux.lds.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00