]> git.hungrycats.org Git - linux/commit
LoongArch: Ensure FP/SIMD registers in the core dump file is up to date
authorHuacai Chen <chenhuacai@loongson.cn>
Sat, 26 Aug 2023 14:21:57 +0000 (22:21 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:48:44 +0000 (09:48 +0200)
commit95c5d3fbd3c4d9ae8035a2d1ed7e81e132ecd724
tree2023a4d9e43de38b0c7e7596fb717d7e235c4498
parentccdfcb9119674edf3a57d600ddb314a9dfec1389
LoongArch: Ensure FP/SIMD registers in the core dump file is up to date

[ Upstream commit 656f9aec07dba7c61d469727494a5d1b18d0bef4 ]

This is a port of commit 379eb01c21795edb4c ("riscv: Ensure the value
of FP registers in the core dump file is up to date").

The values of FP/SIMD registers in the core dump file come from the
thread.fpu. However, kernel saves the FP/SIMD registers only before
scheduling out the process. If no process switch happens during the
exception handling, kernel will not have a chance to save the latest
values of FP/SIMD registers. So it may cause their values in the core
dump file incorrect. To solve this problem, force fpr_get()/simd_get()
to save the FP/SIMD registers into the thread.fpu if the target task
equals the current task.

Cc: stable@vger.kernel.org
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/loongarch/include/asm/fpu.h
arch/loongarch/kernel/ptrace.c