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
..
2017-11-15 10:56:56 -08:00
2017-03-28 18:23:24 -04:00
2017-11-15 10:56:56 -08:00
2016-06-27 16:31:25 +01:00
2017-11-15 10:56:56 -08:00
2017-06-05 17:50:44 +02:00
2017-11-03 15:24:15 +00:00
2016-05-16 17:17:24 -07:00
2017-07-05 17:09:27 -07:00
2017-08-15 18:36:04 +01:00
2017-11-03 15:24:16 +00:00
2017-11-03 15:24:16 +00:00
2017-11-15 10:56:56 -08:00
2016-04-20 12:22:42 +01:00
2017-11-15 10:56:56 -08:00
2017-08-09 12:16:28 +01:00